Skip to content

Commit 0f0e464

Browse files
committed
Update Cirrus CI config from latest PyScaffold template
1 parent c1c5c28 commit 0f0e464

File tree

1 file changed

+31
-19
lines changed

1 file changed

+31
-19
lines changed

.cirrus.yml

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ env:
66
LANG: C.UTF-8
77
PIP_CACHE_DIR: ${CIRRUS_WORKING_DIR}/.cache/pip
88
PRE_COMMIT_HOME: ${CIRRUS_WORKING_DIR}/.cache/pre-commit
9+
CIRRUS_ARTIFACT_URL: https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}
910
# Coveralls configuration
1011
CI_NAME: cirrus-ci
1112
CI_BRANCH: ${CIRRUS_BRANCH}
@@ -41,12 +42,15 @@ env:
4142
alias: test
4243
depends_on: [build]
4344
<<: *task-template
44-
dist_cache: {folder: dist, fingerprint_script: echo $CIRRUS_BUILD_ID} # download
4545
test_files_cache:
4646
folder: ${VALIDATE_PYPROJECT_CACHE_REMOTE}
4747
fingerprint_script: echo $CIRRUS_BUILD_ID
4848
populate_script: python tools/cache_urls_for_tests.py
4949
reupload_on_changes: true
50+
download_artifact_script: &download-artifact
51+
- curl -L -O ${CIRRUS_ARTIFACT_URL}/build/upload/dist.tar.gz
52+
- tar xzf dist.tar.gz
53+
- rm dist.tar.gz
5054
test_script: >
5155
tox --installpkg dist/*.whl --
5256
-n 5 --randomly-seed=42 -rfEx --durations 10 --color yes
@@ -69,17 +73,17 @@ env:
6973
# ---- CI Pipeline ----
7074

7175
build_task:
72-
name: build (Linux - 3.10)
76+
name: build and check (Linux - 3.11)
7377
alias: build
74-
container: {image: "python:3.10-bullseye"}
78+
container: {image: "python:3.11-bullseye"}
7579
clone_script: *clone
76-
dist_cache: # build once and upload to be used by other tasks
77-
folder: dist
78-
fingerprint_script: echo $CIRRUS_BUILD_ID
79-
reupload_on_changes: true
8080
<<: *task-template
8181
install_script: pip install tox
82-
build_script: tox -e clean,build
82+
build_script:
83+
- tox -e clean,build
84+
- tar czf dist.tar.gz dist
85+
upload_artifacts:
86+
path: dist.tar.gz
8387

8488
check_task:
8589
name: check (Linux - 3.10)
@@ -89,18 +93,19 @@ check_task:
8993
dist_cache: {folder: dist, fingerprint_script: echo $CIRRUS_BUILD_ID} # download
9094
<<: *task-template
9195
install_script: pip install tox
96+
download_artifact_script: *download-artifact
9297
check_script: tox --installpkg dist/*.whl -e lint,typecheck
9398

9499
linux_task:
95100
matrix:
96101
- name: test (Linux - 3.8)
97102
container: {image: "python:3.8-bookworm"}
98-
- name: test (Linux - 3.9)
99-
container: {image: "python:3.9-bookworm"}
100103
- name: test (Linux - 3.10)
101104
container: {image: "python:3.10-bookworm"}
105+
skip: $BRANCH !=~ "^(main|master)$"
102106
- name: test (Linux - 3.11)
103107
container: {image: "python:3.11-bookworm"}
108+
skip: $BRANCH !=~ "^(main|master)$"
104109
- name: test (Linux - 3.12)
105110
container: {image: "python:3.12-bookworm"}
106111
- name: test (Linux - 3.13)
@@ -109,23 +114,26 @@ linux_task:
109114
install_script:
110115
- python -m pip install --upgrade pip tox pipx
111116
<<: *test-template
117+
alias: base-test
112118

113119
mamba_task:
114120
name: test (Linux - mambaforge)
115121
container: {image: "condaforge/mambaforge"}
116122
install_script: # Overwrite template
117-
- mamba install -y pip tox pipx
123+
- mamba install -y pip pipx tox curl
118124
<<: *test-template
125+
depends_on: [base-test]
119126

120127
macos_task:
121128
name: test (macOS - brew)
122129
macos_instance:
123130
image: ghcr.io/cirruslabs/macos-runner:sonoma
124-
brew_cache: {folder: "$HOME/Library/Caches/Homebrew"}
125-
install_script: brew install python tox pipx
126131
env:
127132
PATH: "/opt/homebrew/opt/python/libexec/bin:${PATH}"
133+
brew_cache: {folder: "$HOME/Library/Caches/Homebrew"}
134+
install_script: brew install python tox pipx
128135
<<: *test-template
136+
depends_on: [build, base-test]
129137

130138
freebsd_task:
131139
name: test (freebsd - 3.11)
@@ -135,22 +143,25 @@ freebsd_task:
135143
- pkg install -y git python311 py311-pip py311-gdbm py311-sqlite3 py311-tox py311-tomli py311-pipx
136144
- ln -s /usr/local/bin/python3.11 /usr/local/bin/python
137145
<<: *test-template
146+
depends_on: [build, base-test]
138147

139148
windows_task:
140-
name: test (Windows - 3.9.13)
149+
name: test (Windows - 3.12.5)
141150
windows_container:
142151
image: "cirrusci/windowsservercore:2019"
143152
os_version: 2019
144153
env:
145154
CIRRUS_SHELL: bash
146-
PATH: /c/Python39:/c/Python39/Scripts:/c/tools:${PATH}
155+
PATH: /c/Python312:/c/Python312/Scripts:/c/tools:${PATH}
147156
install_script:
148157
# Activate long file paths to avoid some errors
149158
- ps: New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
150-
- choco install -y --no-progress python3 --version=3.9.13 --params "/NoLockdown"
159+
- choco install -y --no-progress python3 --version=3.12.5 --params "/NoLockdown"
160+
- choco install -y --no-progress curl
151161
- pip install --upgrade certifi
152162
- python -m pip install -U pip tox pipx
153163
<<: *test-template
164+
depends_on: [build, base-test]
154165

155166
finalize_task:
156167
container: {image: "python:3.10-bullseye"}
@@ -162,29 +173,30 @@ finalize_task:
162173

163174
linkcheck_task:
164175
name: linkcheck (Linux - 3.10)
176+
only_if: $BRANCH =~ "^(main|master)$"
165177
container: {image: "python:3.10-bullseye"}
166178
depends_on: [finalize]
167179
allow_failures: true
168-
dist_cache: {folder: dist, fingerprint_script: echo $CIRRUS_BUILD_ID} # download
169180
<<: *task-template
170181
install_script: pip install tox
182+
download_artifact_script: *download-artifact
171183
linkcheck_script: tox --installpkg dist/*.whl -e linkcheck -- -q
172184

173185
# # The following task is already covered by a GitHub Action,
174186
# # (commented to avoid errors when publishing duplicated packages to PyPI)
175187
# publish_task:
176188
# name: publish (Linux - 3.10)
177189
# container: {image: "python:3.10-bullseye"}
178-
# depends_on: [check, build, test]
190+
# depends_on: [check, build, base-test, test]
179191
# only_if: $CIRRUS_TAG =~ 'v\d.*' && $CIRRUS_USER_PERMISSION == "admin"
180192
# <<: *task-template
181-
# dist_cache: {folder: dist, fingerprint_script: echo $CIRRUS_BUILD_ID} # download
182193
# env:
183194
# TWINE_REPOSITORY: pypi
184195
# TWINE_USERNAME: __token__
185196
# TWINE_PASSWORD: $PYPI_TOKEN
186197
# # See: https://cirrus-ci.org/guide/writing-tasks/#encrypted-variables
187198
# install_script: pip install tox
199+
# download_artifact_script: *download-artifact
188200
# publish_script:
189201
# - ls dist/*
190202
# - tox -e publish

0 commit comments

Comments
 (0)