-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
120 lines (106 loc) · 3.65 KB
/
cloudbuild.yaml
File metadata and controls
120 lines (106 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
timeout: 7200s
steps:
- id: setup
name: 'gcr.io/cloud-builders/gcloud@sha256:b50f18d45d6711dd2f6e81daf66e30c2ea5df8d40e40116e91c2aa25c8e92162'
entrypoint: 'bash'
args:
- '-e'
- '-c'
# language=bash
- |
gcloud secrets versions access latest \
--secret=cli-test-env-default \
--project=cloud-builld-webhook \
--out-file=/root/.env
# Your current directory is a workspace.
gcloud auth list
gsutil cp gs://dnastack-ci-content/bootstrap-workspace.tar.gz /tmp
cd /tmp
tar xzf bootstrap-workspace.tar.gz
gcloud kms decrypt --ciphertext-file=.ssh/github_rsa_key.enc --plaintext-file=.ssh/id_rsa --location=global --keyring=cloud-build-webhook --key=secret_key
cp -r .ssh /root/
rm -r .ssh
chmod 700 /root/.ssh
chmod 600 /root/.ssh/id_rsa
# Decrypt the pypirc
gcloud kms decrypt --ciphertext-file=.pypirc.enc --plaintext-file=.pypirc --location=global --keyring=cloud-build-webhook --key=secret_key
cp .pypirc /root/
rm .pypirc
chmod 600 /root/.pypirc
# Specific setup for the CLI tool
cd dnastack-client-library
# Decrypt github (required for deploying to github releases)
gcloud kms decrypt --ciphertext-file=github.enc --plaintext-file=github --location=global --keyring=cloud-build-webhook --key=secret_key
cp github /root/
rm github
chmod 600 /root/github
cd ../..
rm -rf /tmp
volumes:
- name: 'homedir'
path: /root
# End
# Build the package
- id: build-package
name: python:3.11-slim@sha256:e9f0a08f0d1bfbe10dbdaef481acda96ceac20c9755ad58343de1fcd45fce23a
entrypoint: bash
args:
- '-ec'
# language=bash
- |
apt update --quiet && apt install -qqy git curl
git config --global --add safe.directory /workspace
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$$HOME/.local/bin:$$PATH"
# Build package with dynamic versioning (uses uv build internally)
# This generates unique version numbers like 3.1.203 to avoid PyPI conflicts
# For pre-release builds, add: --pre-release a (a=alpha, b=beta, rc=release-candidate)
./scripts/build-package.py
volumes:
- name: 'homedir'
path: /root
# End
# Perform the sanity check for the CLI
# NOTE: This is to ensure that the CLI works with the minimum requirements.
- id: sanity-check
name: python:3.11-slim@sha256:e9f0a08f0d1bfbe10dbdaef481acda96ceac20c9755ad58343de1fcd45fce23a
entrypoint: bash
args:
- '-ec'
# language=bash
- |
cp dist/*.whl /tmp
cd /tmp
pip install *.whl
dnastack use --no-auth viral.ai
# End
# Test with the latest stable release of Python.
- id: python-3.12
name: python:3.12-slim@sha256:744a20876a5eb3cfb2b21c62f1755e286da9af3715ad92179f1f78e853f00bee
entrypoint: bash
args:
- '-ec'
# language=bash
- |
export E2E_ENV_FILE=/root/.env
./scripts/run-e2e-tests-in-container.sh -fv tests/e2e_tests/cli/test_*
volumes:
- name: 'homedir'
path: /root
# End
# Publish the package
- id: publish-package
name: python:3.11-slim@sha256:e9f0a08f0d1bfbe10dbdaef481acda96ceac20c9755ad58343de1fcd45fce23a
entrypoint: bash
args:
- '-ec'
# language=bash
- |
cp /root/.pypirc ~/.pypirc
pip3 install --quiet twine
twine upload --verbose --non-interactive --disable-progress-bar dist/*.whl
volumes:
- name: 'homedir'
path: /root
# End