-
Notifications
You must be signed in to change notification settings - Fork 11
167 lines (165 loc) · 5.61 KB
/
main.yaml
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
name: Build and test
on:
push:
paths-ignore:
- "README.md"
- "LICENSE"
- "MANIFEST"
- "docs/**"
- ".github/workflows/docs.yml"
branches:
- main
pull_request:
paths-ignore:
- "README.md"
- "LICENSE"
- "MANIFEST"
- "docs/**"
- ".github/workflows/docs.yml"
branches:
- main
jobs:
package:
name: Build package
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
activate-environment: build-conda-token
environment-file: etc/build-environment.yml
python-version: 3.8
auto-activate-base: false
- name: conda Build
shell: bash -l {0}
run: |
VERSION=`python -m setuptools_scm` conda build conda.recipe
mv $CONDA_PREFIX/conda-bld .
- name: Upload the build artifact
uses: actions/upload-artifact@v3
with:
name: package-${{ github.sha }}
path: conda-bld
test:
name: Test (conda ${{ matrix.conda-version }}, Python ${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: [3.8, 3.9, "3.10"]
conda-version: ["4.11", "4.12", "4.13", "4.14", "22.9", "22.11", "23.1", "23.3", "23.5"]
exclude:
# Python 3.10
- conda-version: "4.11"
python-version: "3.10"
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
- name: Download conda standalone
shell: bash
run: |
if [ $RUNNER_OS == 'Linux' ]; then
curl https://repo.anaconda.com/pkgs/misc/conda-execs/conda-latest-linux-64.exe -o conda.exe
elif [ $RUNNER_OS == 'Windows' ]; then
curl https://repo.anaconda.com/pkgs/misc/conda-execs/conda-4.10.3-win-64.exe -o conda.exe
elif [ $RUNNER_OS == 'macOS' ]; then
curl https://repo.anaconda.com/pkgs/misc/conda-execs/conda-latest-osx-64.exe -o conda.exe
fi
chmod +x conda.exe
./conda.exe config --set auto_update_conda false
./conda.exe clean -ay
./conda.exe info
- name: Setup miniconda
shell: bash
run: |
./conda.exe create -p $HOME/miniconda conda=${{ matrix.conda-version }} python=${{ matrix.python-version }}
- name: Update with test dependencies
shell: bash
run: |
if [ $RUNNER_OS == 'Windows' ]; then
source $HOME/miniconda/Scripts/activate root && conda env update -f etc/test-environment.yml -p $HOME/miniconda && $HOME/miniconda/Scripts/pip install --no-deps .
else
source $HOME/miniconda/bin/activate root && conda env update -f etc/test-environment.yml -p $HOME/miniconda && $HOME/miniconda/bin/pip install --no-deps .
fi
- name: Install Libmamba
shell: bash
run: |
if [[ ! "${{ matrix.conda-version }}" =~ ^("4.9"|"4.10"|"4.11")$ ]]; then
if [ $RUNNER_OS == 'Windows' ]; then
source $HOME/miniconda/Scripts/activate root && \
conda install conda-libmamba-solver -p $HOME/miniconda
else
source $HOME/miniconda/bin/activate root && \
conda install conda-libmamba-solver -p $HOME/miniconda
fi
fi
- name: py.test
shell: bash
env:
CONDA_DEFAULT_CHANNELS: conda-forge
run: |
if [ $RUNNER_OS == 'Windows' ]; then
source $HOME/miniconda/Scripts/activate root && \
conda --version && \
py.test \
-xv \
--cov-report xml:./coverage.xml \
--cov conda_project \
tests
else
source $HOME/miniconda/bin/activate root && \
conda --version && \
py.test \
-xv \
--cov-report xml:./coverage.xml \
--cov conda_project \
tests
fi
- uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
env_vars: OS,PYTHON
upload:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Retrieve the source code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download the build artifacts
uses: actions/download-artifact@v2
with:
name: package-${{ github.sha }}
path: conda-bld
- name: Upload to anaconda.org
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
GITHUB_REF: ${{ github.ref }}
run: |
source $CONDA/bin/activate
conda install -y anaconda-client
[[ "$GITHUB_REF" =~ ^refs/tags/ ]] || export LABEL="--label dev"
anaconda --verbose --token $ANACONDA_TOKEN upload --user defusco $LABEL conda-bld/noarch/conda-project*.tar.bz2 --force
- name: Clean up older artifacts
uses: glassechidna/artifact-cleaner@master
with:
minimumAge: 86400
# This check job runs to ensure all tests have passed, such that we can use it as a "wildcard" for branch
# protection to ensure all tests pass before a PR can be merged.
check:
if: always()
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Decide whether all required jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}