forked from pyscaffold/configupdater
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.cirrus.yml
174 lines (164 loc) · 6.43 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
---
# Default values to be merged into tasks:
auto_cancellation: false
env:
PATH: ${HOME}/.local/bin:${PATH}
# ^ add user paths
COVERALLS_REPO_TOKEN: vYvXrHgKfcDffAEuHHfZs9LiiDTkaQXU6
PIP_CACHE: ${HOME}/.cache/pip
LC_ALL: C.UTF-8
LANG: C.UTF-8
# use custom cloning since otherwise git tags are missing
clone_script: &clone_script |
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
# This template is used in all tasks
regular_task_template: ®ULAR_TASK_TEMPLATE
tox_install_script:
# Tox is a bit exigent about the name of the python executable,
# (for example, tox requires a `python3.7` to be available)
# and the shape of the directory python is installed to.
# Because of that, some errors might appear in some kinds of installation
# (e.g. OSX with homebrew).
# Luckily, pipx install tox inside its own unique virtualenv, which
# resembles a very standard installation directory.
# So here we install tox using pipx to avoid such problems
- python -m pip install --upgrade pip setuptools
- python -m pip install --user pipx
- pipx install tox
prepare_script:
- rm -rf .coverage junit-*.xml
# ^ avoid information carried from one run to the other
test_script:
- tox -e all -- -rfEx --color yes
# Task definitions:
linux_mac_task:
clone_script: *clone_script
matrix:
- name: test (Linux - 3.6)
container: {image: "python:3.6-buster"}
pip_cache: &pip-cache
folder: $PIP_CACHE
install_script: &debian-install
- apt-get install -y git
- name: test (Linux - 3.7)
container: {image: "python:3.7-buster"}
pip_cache: *pip-cache
install_script: *debian-install
- name: test (Linux - 3.8)
container: {image: "python:3.8-buster"}
pip_cache: *pip-cache
install_script: *debian-install
- name: test (Linux - Anaconda)
container: {image: "continuumio/anaconda3:2019.03"}
pip_cache: *pip-cache
install_script: *debian-install
- name: test (OS X)
osx_instance: {image: "mojave-xcode-10.2"}
env:
PYTHON_VERSION: 3.7
# ^ it is important to update this env vars when the default version
# of python in homebrew changes
PATH: "${HOME}/.local/bin:${HOME}/Library/Python/${PYTHON_VERSION}/bin:/usr/local/opt/python/libexec/bin:${PATH}"
# ^ add user and homebrew paths
PIP_CACHE: "${HOME}/Library/Caches/pip"
brew_cache:
folder: "$HOME/Library/Caches/Homebrew"
pip_cache: *pip-cache
install_script:
- brew install python gnu-tar
- brew cleanup
<< : *REGULAR_TASK_TEMPLATE
windows_task:
name: test (Windows)
workaround_git_script:
- git config --system core.longpaths true # Fix for windows git checkout problems
clone_script:
CMD.exe /C ECHO ON &
IF NOT DEFINED CIRRUS_PR (
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%
)
windows_container:
image: "cirrusci/windowsservercore:cmake"
# ^ this image have MSYS2 pre-installed, which means we can use some
# of the GNU tools (like the `rm` command)
os_version: 2019
env:
# Single quotes are used bellow to escape Windows backslash and %
# (YAML restrictions).
PYTHON_HOME: 'C:\Python38'
PYTHON_APPDATA: '%APPDATA%\Python\Python38'
# ^ it is important to update these 2 env vars when the default version
# of python in chocolatey changes
MSYS_HOME: 'C:\tools\msys64'
HOME: '%USERPROFILE%'
USERNAME: 'ContainerAdministrator'
# ^ Ensure USERNAME is set in Windows, so the getpass module doesn't
# raise exceptions
ToolsDir: 'C:\tools'
PATH: '%HOME%\.local\bin\;%PYTHON_APPDATA%\Scripts\;%PYTHON_HOME%\;%PYTHON_HOME%\Scripts\;%MSYS_HOME%\bin\;%MSYS_HOME%\usr\bin\;%MSYS_HOME%\usr\local\bin\;%PATH%'
# ^ add user, chocolatey and msys paths
CHOCOLATEY_CACHE: '%LocalAppData%\chocolatey\Cache'
PIP_CACHE: '%LocalAppData%\pip\Cache'
PIP_TRUSTED_HOST: 'pypi.org pypi.python.org files.pythonhosted.org'
PIP_CONFIG_FILE: '%AppData%\pip\pip.ini'
COVERAGE: 'NO'
chocolatey_cache:
folder: '%CHOCOLATEY_CACHE%'
pip_cache:
folder: '%PIP_CACHE%'
install_script:
# Activate long file paths to avoid some errors
- REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f
# Set Windows encoding to UTF-8
- REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v Autorun /t REG_SZ /d "@chcp 65001>nul" /f
- choco config set cacheLocation %CHOCOLATEY_CACHE%
- choco install --no-progress -y python --version=3.8.1
tox_install_script:
- python -m pip install --upgrade --user pip setuptools
- python -m pip install --user certifi tox
prepare_script:
- rm -rf .coverage junit-*.xml
# ^ avoid information carried from one run to the other
test_script:
- python -m tox -e all -- --color yes
windows_clean_script:
# CMD is not capable of globbing, so we have to use PowerShell
- ps: rm junit-*.xml
coverage_task:
name: coverage (Linux)
clone_script: *clone_script
container: {image: "python:3.6-buster"}
env:
COVERAGE: yes
depends_on:
- test (Linux - 3.6)
- test (Linux - 3.7)
- test (Linux - 3.8)
- test (Linux - Anaconda)
- test (OS X)
- test (Windows)
install_script: *debian-install
pip_install_script:
pip install --user --upgrade
pytest pytest-cov pytest-virtualenv
coverage coveralls
flake8 pre-commit
precommit_script:
- pre-commit install
- pre-commit run --all-files
<<: *REGULAR_TASK_TEMPLATE
coverage_script:
# - coverage combine .coverage
- coveralls