@@ -28,201 +28,143 @@ concurrency:
28
28
29
29
defaults :
30
30
run :
31
- shell : bash
31
+ shell : bash -el {0}
32
32
jobs :
33
- package :
34
- name : ${{ matrix.os }}, Python ${{ matrix.pyver }}, ${{ matrix.micromamba && 'micromamba' || 'conda-standalone' }}
33
+ tests :
34
+ name : ${{ matrix.os }}, Python ${{ matrix.python-version }}, ${{ matrix.micromamba && 'micromamba' || 'conda-standalone' }}
35
35
runs-on : ${{ matrix.os }}-latest
36
36
strategy :
37
37
fail-fast : false
38
38
matrix :
39
39
os : [macos, ubuntu, windows]
40
- pyver : ["3.7", "3.8", "3.9", "3.10"]
40
+ python-version : ["3.8", "3.9", "3.10", "3.11"]
41
+ check-docs : [false]
41
42
include :
42
43
- os : ubuntu
43
- pyver : " 3.9"
44
+ python-version : " 3.9"
44
45
micromamba : true
46
+ check-docs : true
45
47
- os : macos
46
- pyver : " 3.10"
48
+ python-version : " 3.10"
47
49
micromamba : true
50
+ check-docs : false
48
51
# Re-enable once micromamba supports menu creation
49
52
# - os: windows
50
- # pyver : "3.8"
53
+ # python-version : "3.8"
51
54
# micromamba: true
55
+ # check-docs: false
52
56
env :
53
- PYTHONUNBUFFERED : True
57
+ PYTHONUNBUFFERED : " 1 "
54
58
steps :
55
- - name : Print github context
56
- run : |
57
- echo "EVENT_NAME:" "$GITHUB_EVENT_NAME"
58
- echo " REF:" "$GITHUB_REF"
59
- echo " HEAD_REF:" "$GITHUB_HEAD_REF"
60
- echo " BASE_REF:" "$GITHUB_BASE_REF"
61
- echo " SHA:" "$GITHUB_SHA"
62
- - name : Set temp dirs correctly
63
- if : startsWith(matrix.os, 'windows')
64
- # https://github.com/actions/virtual-environments/issues/712
65
- shell : powershell
66
- run : |
67
- echo "TMPDIR=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
68
- echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
69
- echo "TMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
70
59
- name : Retrieve the source code
71
60
uses : actions/checkout@v3
72
61
with :
73
62
fetch-depth : 0
74
- ref : ${{ github.event.pull_request.head.sha }}
75
- - name : Build the build environment
76
- run : |
77
- source $CONDA/etc/profile.d/conda.sh
78
- [ $RUNNER_OS == macOS ] && export CONDA_PKGS_DIRS=~/.pkgs
79
- conda create -p ../conda conda-build conda-verify
80
- - name : Build the package
81
- env :
82
- PYTHONIOENCODING : utf-8
83
- # Uncomment to run within conda build
84
- # RUN_EXAMPLES: "1"
85
- run : |
86
- source $CONDA/etc/profile.d/conda.sh
87
- conda activate ../conda
88
- export CODECOV_COMMIT=$(git rev-parse --verify HEAD)
89
- CODECOV_FOLDER=${PWD} \
90
- CONDA_BLD_PATH="${{ runner.temp }}/conda-bld" \
91
- conda build conda.recipe --python=${{ matrix.pyver }}
92
- - uses : codecov/codecov-action@v3
63
+ - uses : conda-incubator/setup-miniconda@v2
93
64
with :
94
- token : ${{ secrets.CODECOV_TOKEN }}
95
- flags : unit
96
- - name : Upload the packages as artifact
97
- if : github.event_name == 'push'
98
- uses : actions/upload-artifact@v3
99
- with :
100
- # By uploading to the same artifact we can download all of the packages
101
- # and upload them all to anaconda.org in a single job
102
- name : package-${{ github.sha }}
103
- path : ${{ runner.temp }}/conda-bld/*/*.tar.bz2
104
- - name : Install local constructor
105
- run : |
106
- source $CONDA/etc/profile.d/conda.sh
107
- CONDA_BLD_PATH="${{ runner.temp }}/conda-bld" \
108
- conda create -n constructor -c local --strict-channel-priority constructor coverage
109
- conda activate constructor
110
- set -x
111
- installed_channel=$(conda list constructor --json | jq -r '.[].channel')
112
- if [[ "$installed_channel" != "conda-bld" ]]; then
113
- echo $(conda list constructor --json)
114
- echo "Installed constructor is not local!"
115
- exit 1
116
- fi
117
- constructor --version
118
- constructor --help-construct
119
- - name : Update to NSIS logging builds on Windows
120
- if : startsWith(matrix.os, 'windows')
65
+ activate-environment : constructor-dev
66
+ environment-file : dev/environment.yml
67
+ python-version : ${{ matrix.python-version }}
68
+ - name : Supply extra dependencies and install constructor
121
69
run : |
122
- source $CONDA/etc/profile.d/conda.sh
123
- conda activate constructor
124
- conda install -y "conda-forge::nsis=*=*_log_*"
70
+ files=(--file "tests/requirements.txt")
71
+ test -f dev/extra-requirements-${{ matrix.os }}.txt \
72
+ && files+=(--file "dev/extra-requirements-${{ matrix.os }}.txt")
73
+ conda install ${files[@]} -y
125
74
echo "NSIS_USING_LOG_BUILD=1" >> $GITHUB_ENV
126
- - name : Generate self-signed certificate (Windows)
127
- if : startsWith(matrix.os, 'windows')
128
- shell : cmd
129
- run : |
130
- set "CONSTRUCTOR_SIGNING_CERTIFICATE=${{ runner.temp }}\certificate.pfx"
131
- set "CONSTRUCTOR_PFX_CERTIFICATE_PASSWORD=1234"
132
- powershell scripts\create_self_signed_certificate.ps1
133
- copy /Y "%CONSTRUCTOR_SIGNING_CERTIFICATE%" examples\signing\certificate.pfx
134
-
135
- :: Careful with the trailing spaces before the >> redirect!
136
- echo CONSTRUCTOR_PFX_CERTIFICATE_PASSWORD=1234>> %GITHUB_ENV%
137
- echo CONSTRUCTOR_SIGNTOOL_PATH=C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\signtool.exe>> %GITHUB_ENV%
75
+ pip install -e . --no-deps --no-build-isolation
138
76
- name : Set up conda executable
139
77
run : |
140
- source $CONDA/etc/profile.d/conda.sh
141
78
if [[ "${{ matrix.micromamba }}" != "" ]]; then
142
- conda create -yqp . /micromamba -c conda-forge micromamba
79
+ conda create -yqp "${{ runner.temp }} /micromamba" -c conda-forge micromamba
143
80
if [[ ${{ matrix.os }} == "windows" ]]; then
144
- echo "CONSTRUCTOR_CONDA_EXE=. /micromamba/Library/bin/micromamba.exe" >> $GITHUB_ENV
81
+ echo "CONSTRUCTOR_CONDA_EXE=${{ runner.temp }} /micromamba/Library/bin/micromamba.exe" >> $GITHUB_ENV
145
82
else
146
- echo "CONSTRUCTOR_CONDA_EXE=. /micromamba/bin/micromamba" >> $GITHUB_ENV
83
+ echo "CONSTRUCTOR_CONDA_EXE=${{ runner.temp }} /micromamba/bin/micromamba" >> $GITHUB_ENV
147
84
fi
148
85
else
149
- conda activate constructor
86
+ conda activate constructor-dev
150
87
echo "CONSTRUCTOR_CONDA_EXE=$CONDA_PREFIX/standalone_conda/conda.exe" >> $GITHUB_ENV
151
88
fi
152
- - name : Run examples and prepare artifacts
89
+ - name : Run unit tests
153
90
run : |
154
- rm -rf coverage.json
155
- source $CONDA/etc/profile.d/conda.sh
156
- conda activate constructor
157
- mkdir -p examples_artifacts/
158
- python scripts/run_examples.py \
159
- --keep-artifacts=examples_artifacts/ \
160
- --conda-exe="${CONSTRUCTOR_CONDA_EXE}"
91
+ pytest -vv --cov=constructor --cov-branch tests/ -m "not examples"
92
+ coverage run --branch --append -m constructor -V
161
93
coverage json
162
- - name : Test with conda-libmamba-solver
94
+ - uses : codecov/codecov-action@v3
95
+ with :
96
+ token : ${{ secrets.CODECOV_TOKEN }}
97
+ flags : unit
98
+ - name : Run examples
99
+ env :
100
+ CONSTRUCTOR_EXAMPLES_KEEP_ARTIFACTS : " ${{ runner.temp }}/examples_artifacts"
101
+ # signtool only exists on Windows, but doesn't cause errors on unix when absent
102
+ CONSTRUCTOR_SIGNTOOL_PATH : " C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe"
163
103
run : |
164
- source $CONDA/etc/profile.d/conda.sh
165
- conda activate constructor
166
- conda install -yq conda-libmamba-solver
167
- conda list
168
- CONDA_SOLVER=libmamba CONDA_VERBOSITY=1 constructor examples/noconda/ --output-dir=examples_artifacts/
104
+ rm -rf coverage.json
105
+ pytest -vv --cov=constructor --cov-branch tests/test_examples.py
106
+ coverage run --branch --append -m constructor -V
107
+ coverage json
169
108
- uses : codecov/codecov-action@v3
170
109
with :
171
110
token : ${{ secrets.CODECOV_TOKEN }}
172
111
flags : integration
112
+ - name : Test with conda-libmamba-solver
113
+ run : |
114
+ conda install -yq conda-libmamba-solver
115
+ CONDA_SOLVER=libmamba CONDA_VERBOSITY=1 pytest -vv tests/test_examples.py -k noconda
116
+ - name : Check docs are up-to-date
117
+ if : matrix.check-docs
118
+ run : |
119
+ python scripts/make_docs.py
120
+ git diff --exit-code
173
121
- name : Upload the example installers as artifacts
174
- if : github.event_name == 'pull_request' && matrix.pyver == '3.9'
122
+ if : github.event_name == 'pull_request' && matrix.python-version == '3.9'
175
123
uses : actions/upload-artifact@v3
176
124
with :
177
125
name : installers-${{ runner.os }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
178
- path : examples_artifacts/
126
+ path : " ${{ runner.temp }}/examples_artifacts "
179
127
retention-days : 7
180
128
181
- upload :
182
- needs : package
183
- runs-on : ubuntu-latest
184
- if : github.event_name == 'push'
129
+ build :
130
+ name : Canary Build
131
+ needs : [tests]
132
+ # only build canary build if
133
+ # only build canary build if
134
+ # - prior steps succeeded,
135
+ # - this is the main repo, and
136
+ # - we are on the main (or feature) branch
137
+ if : >-
138
+ success()
139
+ && !github.event.repository.fork
140
+ && (
141
+ github.ref_name == 'main'
142
+ || startsWith(github.ref_name, 'feature/')
143
+ )
144
+ strategy :
145
+ matrix :
146
+ include :
147
+ - runner : ubuntu-latest
148
+ subdir : linux-64
149
+ - runner : macos-latest
150
+ subdir : osx-64
151
+ - runner : windows-latest
152
+ subdir : win-64
153
+ runs-on : ${{ matrix.runner }}
185
154
steps :
186
- - name : Retrieve the source code
187
- uses : actions/checkout@v3
155
+ # Clean checkout of specific git ref needed for package metadata version
156
+ # which needs env vars GIT_DESCRIBE_TAG and GIT_BUILD_STR:
157
+ - uses : actions/checkout@v3
188
158
with :
159
+ ref : ${{ github.ref }}
160
+ clean : true
189
161
fetch-depth : 0
190
- - name : Download the build artifacts
191
- uses : actions/download-artifact@v3
192
- with :
193
- name : package-${{ github.sha }}
194
- path : conda-bld
195
- - name : Install conda packages
196
- run : |
197
- source $CONDA/bin/activate
198
- conda install -y sphinx anaconda-client
199
- - name : Upload to anaconda.org
200
- env :
201
- ANACONDA_TOKEN : ${{ secrets.ANACONDA_TOKEN }}
202
- GITHUB_REF : ${{ github.ref }}
203
- run : |
204
- source $CONDA/bin/activate
205
- [[ "$GITHUB_REF" =~ ^refs/tags/ ]] || export LABEL="--label dev"
206
- anaconda --verbose --token $ANACONDA_TOKEN upload --user ctools $LABEL conda-bld/*/*.tar.bz2 --force
207
-
208
- docs :
209
- name : Check docs are up-to-date
210
- runs-on : ubuntu-latest
211
- steps :
212
- - name : Retrieve the source code
213
- uses : actions/checkout@v3
162
+ - name : Create and upload canary build
163
+ uses :
conda/actions/[email protected]
214
164
with :
215
- fetch-depth : 0
216
- - name : Install local constructor
217
- run : |
218
- source $CONDA/bin/activate
219
- conda create -n constructor constructor jinja2
220
- conda activate constructor
221
- pip install -U . --no-deps
222
- - name : Build docs
223
- run : |
224
- source $CONDA/bin/activate
225
- conda activate constructor
226
- set -ex
227
- python scripts/make_docs.py
228
- git diff --exit-code
165
+ package-name : ${{ github.event.repository.name }}
166
+ subdir : ${{ matrix.subdir }}
167
+ anaconda-org-channel : conda-canary
168
+ anaconda-org-label : ${{ github.ref_name == 'main' && 'dev' || format('{0}-{1}', github.event.repository.name, github.ref_name) }}
169
+ anaconda-org-token : ${{ secrets.CONDA_CANARY_ANACONDA_ORG_TOKEN }}
170
+ conda-build-arguments : ' --override-channels -c conda-forge -c defaults'
0 commit comments