-
Notifications
You must be signed in to change notification settings - Fork 167
236 lines (231 loc) · 9.28 KB
/
main.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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
name: Build
on:
push:
branches:
- main
tags:
- "*"
pull_request:
paths:
- ".github/workflows/main.yml"
- "conda.recipe/**"
- "constructor/**"
- "examples/**"
- "scripts/**"
- "tests/**"
- "dev/**"
- "pyproject.toml"
- "setup.cfg"
- "setup.py"
concurrency:
# Concurrency group that uses the workflow name and PR number if available
# or commit SHA as a fallback. If a new build is triggered under that
# concurrency group while a previous build is running it will be canceled.
# Repeated pushes to a PR will cancel all previous builds, while multiple
# merges to main will not cancel.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
defaults:
run:
shell: bash -el {0}
jobs:
tests:
name: ${{ matrix.os }}, Python ${{ matrix.python-version }}, ${{ matrix.conda-standalone }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# UBUNTU
- os: ubuntu-latest
python-version: "3.8"
conda-standalone: conda-standalone
check-docs: true
- os: ubuntu-latest
python-version: "3.9"
conda-standalone: conda-standalone
check-docs: true
- os: ubuntu-latest
python-version: "3.10"
conda-standalone: conda-standalone-nightly
- os: ubuntu-latest
python-version: "3.11"
conda-standalone: micromamba
- os: ubuntu-latest
python-version: "3.12"
conda-standalone: conda-standalone
# MACOS
- os: macos-13
python-version: "3.8"
conda-standalone: conda-standalone-nightly
# Not running for 3.9, 3.10 to save some CI resources
# - os: macos
# python-version: "3.9"
# conda-standalone: conda-standalone
# - os: macos-13
# python-version: "3.10"
# conda-standalone: micromamba
- os: macos-latest
python-version: "3.11"
conda-standalone: conda-standalone
- os: macos-latest
python-version: "3.12"
conda-standalone: micromamba
# WINDOWS
- os: windows-latest
python-version: "3.8"
conda-standalone: conda-standalone
- os: windows-latest
python-version: "3.9"
conda-standalone: conda-standalone-nightly
- os: windows-latest
python-version: "3.10"
conda-standalone: conda-standalone
- os: windows-latest
python-version: "3.11"
# conda-standalone: micromamba
conda-standalone: conda-standalone-nightly
- os: windows-latest
python-version: "3.12"
# conda-standalone: micromamba
conda-standalone: conda-standalone
env:
PYTHONUNBUFFERED: "1"
steps:
- name: Retrieve the source code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
activate-environment: constructor-dev
environment-file: dev/environment.yml
python-version: ${{ matrix.python-version }}
- name: Install AzureSignTool
if: startswith(matrix.os, 'windows')
run: dotnet.exe tool install --global AzureSignTool
shell: pwsh
- name: Supply extra dependencies and install constructor
run: |
files=(--file "tests/requirements.txt")
test -f dev/extra-requirements-${{ runner.os }}.txt \
&& files+=(--file "dev/extra-requirements-${{ runner.os }}.txt")
conda install ${files[@]} -y
echo "NSIS_USING_LOG_BUILD=1" >> $GITHUB_ENV
pip install -e . --no-deps --no-build-isolation
- name: Set up conda executable
run: |
if [[ "${{ matrix.conda-standalone }}" == "micromamba" ]]; then
conda create -yqp "${{ runner.temp }}/micromamba" -c conda-forge micromamba
if [[ "${{ runner.os }}" == "Windows" ]]; then
echo "CONSTRUCTOR_CONDA_EXE=${{ runner.temp }}/micromamba/Library/bin/micromamba.exe" >> $GITHUB_ENV
else
echo "CONSTRUCTOR_CONDA_EXE=${{ runner.temp }}/micromamba/bin/micromamba" >> $GITHUB_ENV
fi
elif [[ "${{ matrix.conda-standalone }}" == "conda-standalone-nightly" ]]; then
conda create -yqp "${{ runner.temp }}/conda-standalone-nightly" -c conda-canary/label/dev conda-standalone
echo "CONSTRUCTOR_CONDA_EXE=${{ runner.temp }}/conda-standalone-nightly/standalone_conda/conda.exe" >> $GITHUB_ENV
else
conda activate constructor-dev
echo "CONSTRUCTOR_CONDA_EXE=$CONDA_PREFIX/standalone_conda/conda.exe" >> $GITHUB_ENV
fi
- name: Run unit tests
run: |
pytest -vv --cov=constructor --cov-branch tests/ -m "not examples"
coverage run --branch --append -m constructor -V
coverage json
- uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit
- name: Run examples
env:
AZURE_SIGNTOOL_KEY_VAULT_CERTIFICATE: ${{ secrets.AZURE_SIGNTOOL_KEY_VAULT_CERTIFICATE }}
AZURE_SIGNTOOL_KEY_VAULT_CLIENT_ID: ${{ secrets.AZURE_SIGNTOOL_KEY_VAULT_CLIENT_ID }}
AZURE_SIGNTOOL_KEY_VAULT_SECRET: ${{ secrets.AZURE_SIGNTOOL_KEY_VAULT_SECRET }}
AZURE_SIGNTOOL_KEY_VAULT_TENANT_ID: ${{ secrets.AZURE_SIGNTOOL_KEY_VAULT_TENANT_ID }}
AZURE_SIGNTOOL_KEY_VAULT_URL: ${{ secrets.AZURE_SIGNTOOL_KEY_VAULT_URL }}
CONSTRUCTOR_EXAMPLES_KEEP_ARTIFACTS: "${{ runner.temp }}/examples_artifacts"
CONSTRUCTOR_SIGNTOOL_PATH: "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe"
run: |
rm -rf coverage.json
pytest -vv --cov=constructor --cov-branch tests/test_examples.py
coverage run --branch --append -m constructor -V
coverage json
- uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: integration
- name: Check docs are up-to-date
if: matrix.check-docs
run: |
python scripts/make_docs.py
git diff --exit-code
- name: Upload the example installers as artifacts
if: github.event_name == 'pull_request' && matrix.python-version == '3.9'
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: installers-${{ runner.os }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
path: "${{ runner.temp }}/examples_artifacts"
retention-days: 7
report:
name: Report failures
needs: [tests]
if: always() && github.event_name == 'push' && github.ref_name == 'main' && needs.tests.result == 'failure'
runs-on: ubuntu-latest
steps:
- name: Retrieve the source code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Report failures
uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 # v2.9.2
env:
GITHUB_TOKEN: ${{ secrets.CONSTRUCTOR_ISSUES }}
RUN_ID: ${{ github.run_id }}
TITLE: "Constructor tests failed"
with:
filename: .github/TEST_FAILURE_REPORT_TEMPLATE.md
update_existing: true
build:
name: Canary Build
needs: [tests]
# only build canary build if
# only build canary build if
# - prior steps succeeded,
# - this is the main repo, and
# - we are on the main (or feature) branch
if: >-
success()
&& !github.event.repository.fork
&& (
github.ref_name == 'main'
|| startsWith(github.ref_name, 'feature/')
)
strategy:
matrix:
include:
- runner: ubuntu-latest
subdir: linux-64
- runner: macos-13
subdir: osx-64
- runner: macos-latest
subdir: osx-arm64
- runner: windows-latest
subdir: win-64
runs-on: ${{ matrix.runner }}
steps:
# Clean checkout of specific git ref needed for package metadata version
# which needs env vars GIT_DESCRIBE_TAG and GIT_BUILD_STR:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.ref }}
clean: true
fetch-depth: 0
- name: Create and upload canary build
uses: conda/actions/canary-release@6e72e0db87e72f0020e493aeb02f864363bd9258 # v24.11.1
with:
package-name: ${{ github.event.repository.name }}
subdir: ${{ matrix.subdir }}
anaconda-org-channel: conda-canary
anaconda-org-label: ${{ github.ref_name == 'main' && 'dev' || format('{0}-{1}', github.event.repository.name, github.ref_name) }}
anaconda-org-token: ${{ secrets.ANACONDA_ORG_CONDA_CANARY_TOKEN }}
conda-build-arguments: '--override-channels -c conda-forge -c defaults'