Skip to content

Commit 6ea48be

Browse files
authored
Merge pull request #9 from Datatamer/reorg
CLOUD-8255: semantic release
2 parents 7d16986 + 402b395 commit 6ea48be

File tree

12 files changed

+187
-25
lines changed

12 files changed

+187
-25
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
build/*
55
tamr_cloud_sdk.egg-info
66
__pycache__/
7+
dist/*
8+
poetry.lock

.releaserc.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
repositoryUrl: https://github.com/Datatamer/tamr-cloud-sdk-python
2+
branches: main
3+
plugins:
4+
- - "@semantic-release/commit-analyzer"
5+
- preset: conventionalcommits
6+
- "@semantic-release/release-notes-generator"
7+
- - "@semantic-release/exec"
8+
- prepareCmd: "pip install toml-cli && toml set --toml-path pyproject.toml tool.poetry.version ${nextRelease.version}"
9+
publishCmd: "poetry install --no-dev && poetry publish -r artifact-registry --build"
10+
- - "@semantic-release/github"
11+
- assets:
12+
- path: "dist/tamr_cloud_sdk*"

install_proto.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
2929
fi
3030
popd
3131
fi
32-
exit 0
32+
exit 0

jenkins/build/Jenkinsfile

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
@Library('ops') _
2+
def notifier = new com.tamr.jenkins.slack.SlackNotifier()
3+
def helper = new com.tamr.jenkins.util.JenkinsHelper()
4+
5+
podTemplate(
6+
containers: [
7+
containerTemplate(
8+
name: 'python-poetry',
9+
image: 'us-docker.pkg.dev/tamr-docker/ops/python-poetry:latest',
10+
resourceLimitCpu: "2",
11+
resourceLimitMemory: "2048Mi",
12+
resourceRequestCpu: "100m",
13+
resourceRequestMemory: "1024Mi",
14+
ttyEnabled: true,
15+
command: 'cat'
16+
),
17+
containerTemplate(
18+
name: 'python-poetry-with-java-8',
19+
image: 'us-docker.pkg.dev/tamr-docker/ops/python-poetry-with-java8:latest',
20+
resourceLimitCpu: "2",
21+
resourceLimitMemory: "2048Mi",
22+
resourceRequestCpu: "100m",
23+
resourceRequestMemory: "1024Mi",
24+
ttyEnabled: true,
25+
command: 'cat'
26+
),
27+
containerTemplate(
28+
name: 'semantic-release-poetry',
29+
image: 'us-docker.pkg.dev/tamr-docker/ops/semantic-release-poetry:latest',
30+
alwaysPullImage: false,
31+
ttyEnabled: true,
32+
command: 'cat'
33+
),
34+
containerTemplate(
35+
name: 'jnlp',
36+
image: 'us-docker.pkg.dev/tamr-docker/ops/jenkins-agent:latest',
37+
alwaysPullImage: false,
38+
privileged: false,
39+
// Resources for jnlp container
40+
resourceLimitCpu: "2",
41+
resourceLimitMemory: "1Gi",
42+
resourceRequestCpu: "300m",
43+
resourceRequestMemory: "1Gi"
44+
),
45+
],
46+
serviceAccount: "jenkins-emaas",
47+
annotations: [
48+
podAnnotation(key: "iam.gke.io/gcp-service-account", value: "[email protected]")
49+
]
50+
) {
51+
node(POD_LABEL) {
52+
helper.cancelPreviousBuilds()
53+
54+
def projectName = helper.getProjectName().tokenize('/').last()
55+
def projectRepo = scm.userRemoteConfigs.first().url - '.git'
56+
57+
stage('Checkout') {
58+
echo projectName
59+
echo projectRepo
60+
checkout([
61+
$class : 'GitSCM',
62+
branches : scm.branches,
63+
extensions : scm.extensions + [[$class: 'CloneOption', noTags: false]],
64+
userRemoteConfigs: scm.userRemoteConfigs
65+
])
66+
sh 'pwd'
67+
sh 'id'
68+
sh 'export'
69+
sh 'ls -l .'
70+
}
71+
try {
72+
container('python-poetry-with-java-8') {
73+
74+
stage('Build tamr_sdk') {
75+
timeout(time: 10, unit: 'MINUTES') {
76+
{
77+
sh """
78+
poetry build
79+
"""
80+
}
81+
}
82+
}
83+
}
84+
85+
container("semantic-release-poetry") {
86+
stage('Lint Commits') {
87+
if (helper.isPRBuild()) {
88+
sh "./cicd/scripts/lint-commits.sh"
89+
}
90+
}
91+
}
92+
93+
stage('Release') {
94+
if (currentBuild.result == null || currentBuild.result == 'SUCCESS') {
95+
container("semantic-release-poetry") {
96+
withCredentials([string(credentialsId: 'github-oauth', variable: 'GH_TOKEN')]) {
97+
withEnv(["GH_TOKEN=${GH_TOKEN}"]) {
98+
sh "semantic-release --dry-run"
99+
}
100+
if (helper.getBranchName() == 'main' && !helper.isPRBuild()) {
101+
withEnv(["GH_TOKEN=${GH_TOKEN}"]) {
102+
sh "poetry config repositories.artifact-registry"
103+
sh "semantic-release"
104+
}
105+
}
106+
}
107+
}
108+
}
109+
}
110+
}
111+
}
112+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
set -e
2+
3+
echo "BRANCH_NAME: \"${BRANCH_NAME}\""
4+
echo "CHANGE_TARGET: \"${CHANGE_TARGET}\""
5+
echo "NODE_VERSION: \"${NODE_VERSION}\""
6+
7+
git --version
8+
echo ----------------
9+
firstCommit=$(git rev-list HEAD --not '--remotes=*/release*' '--remotes=*/main' '--remotes=*/develop' | tail -n1)
10+
echo "first commit: ${firstCommit}"
11+
git log -1 ${firstCommit}
12+
echo ----------------
13+
baseCommit=$(git rev-parse ${firstCommit}~)
14+
echo "base commit: ${baseCommit}"
15+
git log -1 ${baseCommit}
16+
echo ----------------
17+
npm install -g @commitlint/cli @commitlint/config-conventional
18+
npx commitlint -V --from=${baseCommit}

mypy.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ follow_imports = normal
1111
explicit_package_bases = True
1212

1313
packages = tamr_sdk, examples
14-
modules = setup
1514

1615
[mypy-tamr.api.*]
1716
ignore_errors = true

pyproject.toml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[tool.poetry]
2+
name = "tamr_cloud_sdk"
3+
version = "0.dev"
4+
description = "A package that facilitates the use of Tamr Cloud APIs in python"
5+
authors = ["Tamr Inc."]
6+
readme = "README.md"
7+
packages = [
8+
{ include = "tamr_sdk" },
9+
{ include = "tamr" },
10+
{ include = "protoc_gen_openapiv2" },
11+
]
12+
13+
[tool.poetry.dependencies]
14+
python = "^3.8"
15+
google-api-python-client = "2.126.0"
16+
grpcio = "1.62.2"
17+
18+
[tool.poetry.group.dev.dependencies]
19+
ruff = "0.4.4"
20+
21+
[tool.semantic_release]
22+
version_variable = [
23+
"pyproject.toml:version",
24+
]
25+
branch = "main"
26+
upload_to_pypi = false
27+
upload_to_release = true
28+
build_command = "pip install poetry && poetry build"
29+
30+
[build-system]
31+
requires = ["poetry-core"]
32+
build-backend = "poetry.core.masonry.api"

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
google-api-python-client==2.126.0
22
grpcio==1.62.2
33
typing_extensions
4-

requirements_dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ grpc-stubs
22
mypy
33
ruff
44
types-protobuf
5-
types-setuptools
5+
types-setuptools

ruff.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,3 @@ split-on-trailing-comma=false
5757

5858
[lint.mccabe]
5959
max-complexity = 6
60-
61-

0 commit comments

Comments
 (0)