-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcloudbuild-pypi.yaml
60 lines (56 loc) · 1.4 KB
/
cloudbuild-pypi.yaml
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
# - Airflow Env variables.
substitutions:
_GCP_PROJECT_ID: airflow-framework
_BUILD_IMG_NAME: airflow2_cicd:latest
_PYTHON_VERSION: '3.8'
steps:
# - Build a new Airflow2 image.
# [START build-airflow2]
- name: 'gcr.io/cloud-builders/docker'
waitFor: ['-']
entrypoint: 'bash'
args:
- '-c'
- |
docker build -t gcr.io/${PROJECT_ID}/${_BUILD_IMG_NAME} \
--build-arg PYTHON_VERSION=${_PYTHON_VERSION} \
-f docker/Dockerfile-ci .
#env:
# - 'FOO=$_BAR'
dir: '.'
id: 'build-airflow2'
# [END build-airflow2]
# - Unit tests.
# [START unit-test]
- name: 'gcr.io/${PROJECT_ID}/${_BUILD_IMG_NAME}'
waitFor: ['build-airflow2']
entrypoint: 'bash'
args:
- '-c'
- |
pytest tests/unit -vv
id: "unit-test"
# [END unit-test]
# - Publish to PyPI.
# [START publish]
- name: python
waitFor: ['unit-test']
entrypoint: 'bash'
args:
- '-c'
- |
pip install build wheel
python3 -m pip install --user --upgrade twine
python3 setup.py sdist
echo $$PYPI_TOKEN > ~/.pypirc
python3 -m twine upload dist/*
secretEnv: ['PYPI_TOKEN']
id: "publish"
# [END publish]
availableSecrets:
secretManager:
- versionName: projects/144161360649/secrets/PyPI/versions/1
env: 'PYPI_TOKEN'
timeout: 3600s
images:
- 'gcr.io/${PROJECT_ID}/${_BUILD_IMG_NAME}'