forked from pyscaffold/pyscaffold
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cirrus.yml
182 lines (166 loc) · 6.31 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
---
# ---- Default values to be merged into tasks ----
env:
LC_ALL: C.UTF-8
LANG: C.UTF-8
PIP_CACHE_DIR: ${CIRRUS_WORKING_DIR}/.cache/pip
PRE_COMMIT_HOME: ${CIRRUS_WORKING_DIR}/.cache/pre-commit
# Coveralls configuration
CI_NAME: cirrus-ci
CI_BRANCH: ${CIRRUS_BRANCH}
CI_PULL_REQUEST: ${CIRRUS_PR}
CI_BUILD_NUMBER: ${CIRRUS_BUILD_ID}
CI_BUILD_URL: https://cirrus-ci.com/build/${CIRRUS_BUILD_ID}
COVERALLS_PARALLEL: "true"
COVERALLS_FLAG_NAME: ${CIRRUS_TASK_NAME}
# ---- Templates ----
.task_template: &task-template
debug_information_script:
- echo "$(which python) -- $(python -VV)"
- echo "$(which pip) -- $(pip -VV)"
- python -c 'import os, sys; print(os.name, sys.platform, getattr(sys, "abiflags", None))'
prepare_script: # avoid git failing with setuptools-scm
- git config --global user.email "you@example.com"
- git config --global user.name "Your Name"
pip_cache:
folder: "${CIRRUS_WORKING_DIR}/.cache/pip"
fingerprint_script: echo "${CIRRUS_OS}-${CIRRUS_TASK_NAME}"
reupload_on_changes: true
pre_commit_cache:
folder: "${CIRRUS_WORKING_DIR}/.cache/pre-commit"
fingerprint_script: echo "${CIRRUS_OS}-${CIRRUS_TASK_NAME}" | cat - .pre-commit-config.yaml
reupload_on_changes: true
.test_template: &test-template
# Requires pip, tox, and pipx to be installed via OS/pip
alias: test
depends_on: [build]
<<: *task-template
dist_cache: {folder: dist, fingerprint_script: echo $CIRRUS_BUILD_ID} # download
test_script: >
tox --installpkg dist/*.whl -e all --
-n 5 --randomly-seed=42 -rfEx --durations 10 --color yes
submit_coverage_script:
- pipx run coverage xml -o coverage.xml
- pipx run coveralls --submit coverage.xml
# Deep clone script for POSIX environments (required for setuptools-scm)
.clone_script: &clone |
if [ -z "$CIRRUS_PR" ]; then
git clone --recursive --branch=$CIRRUS_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
git reset --hard $CIRRUS_CHANGE_IN_REPO
else
git clone --recursive https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
git fetch origin pull/$CIRRUS_PR/head:pull/$CIRRUS_PR
git reset --hard $CIRRUS_CHANGE_IN_REPO
fi
# ---- CI Pipeline ----
build_task:
name: build (Linux - 3.10)
alias: build
container: {image: "python:3.10-bullseye"}
clone_script: *clone
dist_cache: # build once and upload to be used by other tasks
folder: dist
fingerprint_script: echo $CIRRUS_BUILD_ID
reupload_on_changes: true
<<: *task-template
install_script: pip install tox
build_script: tox -e clean,build
check_task:
name: check (Linux - 3.10)
alias: check
depends_on: [build]
container: {image: "python:3.10-bullseye"} # most recent => better types
dist_cache: {folder: dist, fingerprint_script: echo $CIRRUS_BUILD_ID} # download
<<: *task-template
install_script: pip install tox
check_script: tox --installpkg dist/*.whl -e lint,typecheck
linux_task:
matrix:
- name: test (Linux - 3.6)
container: {image: "python:3.6-bullseye"}
allow_failures: true # EoL
- name: test (Linux - 3.7)
container: {image: "python:3.7-bullseye"}
- name: test (Linux - 3.8)
container: {image: "python:3.8-bullseye"}
- name: test (Linux - 3.9)
container: {image: "python:3.9-bullseye"}
- name: test (Linux - 3.10)
container: {image: "python:3.10-bullseye"}
- name: test (Linux - 3.11)
container: {image: "python:3.11-rc-bullseye"}
allow_failures: true # Experimental
install_script:
- python -m pip install --upgrade pip tox pipx
<<: *test-template
mamba_task:
name: test (Linux - mambaforge)
container: {image: "condaforge/mambaforge"}
install_script: # Overwrite template
- mamba install -y pip tox pipx
<<: *test-template
macos_task:
name: test (macOS - brew)
macos_instance: {image: "big-sur-xcode"}
brew_cache: {folder: "$HOME/Library/Caches/Homebrew"}
install_script: brew install python tox pipx
env:
PATH: "/usr/local/opt/python/libexec/bin:${PATH}"
<<: *test-template
freebsd_task:
name: test (freebsd - 3.8)
freebsd_instance: {image_family: freebsd-13-0}
install_script:
- pkg remove -y python lang/python
- pkg install -y git python38 py38-pip py38-gdbm py38-sqlite3 py38-tox py38-pipx vim
- ln -s /usr/local/bin/python3.8 /usr/local/bin/python
<<: *test-template
windows_task:
name: test (Windows - 3.9.10)
windows_container:
image: "cirrusci/windowsservercore:2019"
os_version: 2019
env:
CIRRUS_SHELL: bash
PATH: /c/Python39:/c/Python39/Scripts:/c/tools:${PATH}
install_script:
# Activate long file paths to avoid some errors
- ps: New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
- choco install -y --no-progress python3 --version=3.9.10 --params "/NoLockdown"
- choco install -y --no-progress vim
- pip install --upgrade certifi
- python -m pip install -U pip tox pipx
<<: *test-template
finalize_task:
container: {image: "python:3.10-bullseye"}
depends_on: [test]
<<: *task-template
install_script: pip install coveralls
finalize_coverage_script: coveralls --finish
linkcheck_task:
name: linkcheck (Linux - 3.10)
container: {image: "python:3.10-bullseye"}
depends_on: [finalize]
allow_failures: true
dist_cache: {folder: dist, fingerprint_script: echo $CIRRUS_BUILD_ID} # download
<<: *task-template
install_script: pip install tox
linkcheck_script: tox --installpkg dist/*.whl -e linkcheck -- -q
# # The following task is already covered by a GitHub Action,
# # (commented to avoid errors when publishing duplicated packages to PyPI)
# publish_task:
# name: publish (Linux - 3.10)
# container: {image: "python:3.10-bullseye"}
# depends_on: [check, build, test]
# only_if: $CIRRUS_TAG =~ 'v\d.*' && $CIRRUS_USER_PERMISSION == "admin"
# <<: *task-template
# dist_cache: {folder: dist, fingerprint_script: echo $CIRRUS_BUILD_ID} # download
# env:
# TWINE_REPOSITORY: pypi
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: $PYPI_TOKEN
# # See: https://cirrus-ci.org/guide/writing-tasks/#encrypted-variables
# install_script: pip install tox
# publish_script:
# - ls dist/*
# - tox -e publish