/
.cirrus.yml
207 lines (198 loc) · 6.26 KB
/
.cirrus.yml
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
Lint_task:
container:
image: python:3.12-slim
install_script:
- pip install -U --upgrade-strategy eager pip 'setuptools>61'
- pip install .
- pip install .[lint] .[test]
script:
- pylint --version
- mypy --version
- bork run lint
Zipapp_bootstrap_task:
alias: Zipapp bootstraps
container:
matrix:
image: python:3.8-slim
image: python:3.9-slim
image: python:3.10-slim
image: python:3.11-slim
image: python:3.12-slim
setup_script:
- pip install -U --upgrade-strategy eager pip 'setuptools>61'
- cp -r . /tmp/bork-pristine
- cp -r /tmp/bork-pristine /tmp/pass1
- cp -r /tmp/bork-pristine /tmp/pass2
- cp -r /tmp/bork-pristine /tmp/pass3
# Make sure Bork can build itself.
pass_1_script:
- cd /tmp/pass1
- python3 --version
- pip install . .[test]
- bork build
# Make sure the Bork zipapp from Pass 1 can build Bork.
pass_2_script:
- cd /tmp/pass2
- cp /tmp/pass1/dist/bork-*.pyz /tmp/bork-pass1.pyz
- python3 /tmp/bork-pass1.pyz build
# Make sure the Bork zipapp built from Pass 2 can build Bork.
# ime with other self-building software, this is prone to blowing up.
pass_3_script:
- cd /tmp/pass3
- cp /tmp/pass2/dist/bork-*.pyz /tmp/bork-pass2.pyz
- python3 /tmp/bork-pass2.pyz build
- '[ -e ./dist/bork-*.pyz ]'
Linux_task:
alias: Linux tests
container:
matrix:
- image: python:3.8-slim
- image: python:3.9-slim
- image: python:3.10-slim
- image: python:3.11-slim
- image: python:3.12-slim
install_script:
- apt-get update
- apt-get install -y git
- pip install -U --upgrade-strategy eager pip 'setuptools>61'
- pip install . .[test]
script:
- python3 --version
- bork run test
macOS_task:
alias: macOS tests
macos_instance:
image: ghcr.io/cirruslabs/macos-ventura-base:latest
env:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
PATH: ${HOME}/.pyenv/shims:${PATH}
matrix:
# https://formulae.brew.sh/formula/python@3.10
- PYTHON: 3.8.18
- PYTHON: 3.9.18
- PYTHON: 3.10.13
- PYTHON: 3.11.6
- PYTHON: 3.12.0
brew_update_script:
- brew update
brew_install_script:
# Per the pyenv homebrew recommendations.
# https://github.com/pyenv/pyenv/wiki#suggested-build-environment
- brew install openssl readline sqlite3 xz zlib pyenv git
pyenv_install_script:
- pyenv install ${PYTHON}
- pyenv global ${PYTHON}
- pyenv rehash
pip_install_script:
- pip install -U --upgrade-strategy eager pip 'setuptools>61'
- pip install .[test]
script:
- python3 --version
- bork run test
always:
upload_results_artifacts:
path: ./bork-junit.xml
format: junit
type: text/xml
FreeBSD_task:
alias: FreeBSD tests
freebsd_instance:
image_family: freebsd-13-2
env:
matrix:
- PYTHON: 3.8
- PYTHON: 3.9
- PYTHON: 3.10
- PYTHON: 3.11
# TODO: PYTHON: 3.12
install_script:
- PY=`echo $PYTHON | tr -d '.'`
- pkg install -y python${PY} git
- python${PYTHON} -m ensurepip
pip_install_script:
- python${PYTHON} -m pip install -U --upgrade-strategy eager pip 'setuptools>61'
- python${PYTHON} -m pip install .[test]
script:
- python${PYTHON} --version
- bork run test
always:
upload_results_artifacts:
path: ./bork-junit.xml
format: junit
type: text/xml
Windows_task:
windows_container:
image: cirrusci/windowsservercore:2019
env:
matrix:
- PYTHON: 3.8.10
- PYTHON: 3.9.13
- PYTHON: 3.10.11
- PYTHON: 3.11.6
- PYTHON: 3.12.0
python_install_script:
# https://docs.python.org/3.6/using/windows.html#installing-without-ui
- ps: Invoke-WebRequest -Uri https://www.python.org/ftp/python/${env:PYTHON}/python-${env:PYTHON}-amd64.exe -OutFile C:\python-installer.exe
- C:\python-installer.exe /quiet TargetDir=C:\Python SimpleInstall=1
install_script:
- C:\Python\python.exe -m pip install -U --upgrade-strategy eager pip "setuptools>61"
- C:\Python\python.exe -m pip install .[test]
version_info_script:
- C:\Python\python.exe --version
test_script:
- C:\Python\python.exe -m pytest --verbose
always:
upload_results_artifacts:
path: ./bork-junit.xml
format: junit
type: text/xml
success_task:
name: CI success
container: {image: "busybox"}
depends_on:
- FreeBSD tests
- Linux tests
- macOS tests
- Zipapp bootstraps
- Lint
- Windows
# If bork/version.py is modified on the main branch, make a release.
Release_task:
only_if: "changesInclude('bork/version.py') && $BRANCH == 'main' && $CIRRUS_CRON == ''"
depends_on: [CI success]
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ENCRYPTED[00007524e18bea7b59efea288653efa57b1dbd235ed8af00cc325febfc9076631a2bf58ed330d8fa7ca057adb81579b0]
BORK_GITHUB_TOKEN: ENCRYPTED[29eac4d276e1e86020bbc415c04ce91136508e5bdeacd756310c32ebdd3fb7f910c6ed3159f08765915d9e656964e8f5]
container:
image: python:3.11-slim
install_script:
- apt-get update
- apt-get install -y git
- pip install -U --upgrade-strategy eager pip 'setuptools>61'
- pip3 install . .[test]
build_script:
- bork clean
- bork build
test_script:
- bork run test
release_script:
- bork release
# If there's a new tag, which should only happen after a successful release
# to PyPi, publish an image on Docker Hub.
docker_builder:
only_if: $CIRRUS_TAG != ''
name: "Release on Docker Hub"
depends_on:
- Release
env:
DOCKER_USERNAME: ENCRYPTED[a957943032559f0859a16a4421bc3602338080e6d9ce63a980db4fd34dbdc2afbe3a20c620139c669182eced4211a515]
DOCKER_PASSWORD: ENCRYPTED[dd7f31d490b645298258ac9ec78ac3a7e034e8bfcf8fbfec0137787eef3934e01a42ef3b5eda42b1b1f7a3296fae619e]
delay_script: sleep 10 # Attempt to ensure it is available via pip.
build_script:
- docker build --tag duckinator/bork:${CIRRUS_TAG} --tag duckinator/bork:latest --build-arg "VERSION=$(echo $CIRRUS_TAG | sed 's/^v//')" .
login_script: docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
push_tag_script: docker push duckinator/bork:$CIRRUS_TAG
push_latest_script:
- if grep -qE "^__version__\s+=\s+['\"]([0-9.]+)['\"]$" bork/version.py; then docker push duckinator/bork:latest; fi