-
Notifications
You must be signed in to change notification settings - Fork 88
165 lines (163 loc) · 5.16 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
name: Build and test
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
jobs:
package:
runs-on: ubuntu-latest
steps:
- name: Retrieve the source code
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v2.1.1
with:
auto-update-conda: false
miniconda-version: py37_4.10.3
auto-activate-base: true
activate-environment: ""
- name: Install build dependencies
shell: bash -l {0}
run: |
conda config --append channels conda-forge
conda install -y conda-build conda-verify flake8 pydocstyle yapf==0.30.0 sphinx sphinx_rtd_theme
- name: Verify formatting compliance
shell: bash -l {0}
run: |
if ! yapf --diff --recursive anaconda_project; then
echo "----"
echo "Please run 'yapf --in-place --recursive anaconda_project'"
echo "locally and commit the resulting changes."
exit -1
fi
flake8 anaconda_project
pydocstyle anaconda_project
- name: Build the documentation as a test
shell: bash -l {0}
run: |
cd docs
make html
- name: Build the package
shell: bash -l {0}
run: conda build --no-test conda.recipe
- name: Reduce the size of the build artifact
shell: bash -l {0}
run: rm -rf ${CONDA}/conda-bld/{git_cache,work,anaconda-project*,*/.cache}
- name: Upload the build artifact
uses: actions/upload-artifact@v2
with:
name: package-${{ github.sha }}
path: /usr/share/miniconda3/conda-bld
tests:
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
needs: package
strategy:
fail-fast: false
matrix:
os: [macos-latest,ubuntu-latest,windows-latest]
pyver: [3.6,3.7,3.8,3.9,"3.10"]
cver: [4.6,4.7,4.8, 4.9, "4.10", "4.11","4.12","4.13"]
exclude:
# Cannot instantiate these environment for these yet
- pyver: 3.8
cver: 4.6
- pyver: 3.8
cver: 4.7
# Minor test back off to save build time
- pyver: 3.7
cver: 4.6
- pyver: 3.6
cver: 4.8
- pyver: 3.6
cver: 4.7
# Conda dropped py36 for base env
- pyver: 3.6
cver: "4.11"
# Odd timestamp behavior
- pyver: 3.7
os: ubuntu-latest
cver: 4.8
- pyver: 3.8
os: ubuntu-latest
cver: 4.8
- os: windows-latest
pyver: 3.6
cver: 4.6
# Python 3.10
- cver: 4.8
pyver: "3.10"
- cver: 4.9
pyver: "3.10"
- cver: "4.11"
pyver: "3.10"
# Python 3.9
- cver: 4.8
pyver: 3.9
steps:
- name: Retrieve the source code
uses: actions/checkout@v2
- name: Build the conda environment
run: |
[ $RUNNER_OS == Windows ] && CONDA_EXE=$CONDA/Scripts/conda.exe
[ $RUNNER_OS == macOS ] && export CONDA_PKGS_DIRS=~/.pkgs
${CONDA_EXE:-conda} create -y -p ./conda conda=${{ matrix.cver }}
- name: Download the build artifact
uses: actions/download-artifact@v2
with:
name: package-${{ github.sha }}
path: ./conda/conda-bld
- name: Build the test environment
run: |
source ./conda/etc/profile.d/conda.sh
[ ${{ matrix.pyver }} == 2.7 ] && BACKPORTS="backports.tempfile backports.functools_lru_cache"
conda create -y -n anaconda-project-dev python=${{ matrix.pyver }} \
$BACKPORTS coverage pytest pytest-cov redis notebook bokeh \
keyring setuptools pip local::anaconda-project
- name: Run the tests
run: |
source ./conda/etc/profile.d/conda.sh
conda activate anaconda-project-dev
[ ${{matrix.cver}} != 4.6 ] && conda config --set restore_free_channel true
pytest -vrfe --durations=10 \
--cov-config=.coveragerc --cov-report=term-missing \
--cov-fail-under=98 --cov-report=xml:./coverage.xml \
--cov=anaconda_project anaconda_project
- uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
upload:
needs: tests
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Retrieve the source code
uses: actions/checkout@v2
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 ctools $LABEL conda-bld/*/*.tar.bz2 --force
- name: Clean up older artifacts
uses: glassechidna/artifact-cleaner@master
with:
minimumAge: 86400