-
Notifications
You must be signed in to change notification settings - Fork 34
146 lines (140 loc) · 4.86 KB
/
test_and_deploy.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
name: Test and Deploy
on:
# Run this workflow every time a PR is opened or a new commit is pushed to the PR
pull_request:
# Run this workflow every time a PR is merged to main or a release tag is added
push:
branches:
- main
tags:
- '*'
env:
MAIN_PYVER: "3.10"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
scipy-version: [">=1.4,<1.11.0"]
numpy-version: ["<1.22.0", ">=1.22.0"]
steps:
- name: Install glibc-tools
shell: bash -l {0}
run: |
if [[ $(uname) == Linux ]]; then
sudo apt-get install glibc-tools
fi
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
auto-activate-base: false
activate-environment: test_env
- name: Install dependencies
shell: bash -l {0}
run: |
conda install -c numba conda-build python=${{ env.MAIN_PYVER }} numba>=0.45 'scipy${{ matrix.scipy-version }}' 'numpy${{ matrix.numpy-version }}' flake8 pytest pip
pip install --no-deps -e .
- name: Lint with flake8
shell: bash -l {0}
run: |
flake8 numba_scipy
- name: Pytest
shell: bash -l {0}
run: |
bash ./buildscripts/incremental/test.sh
- name: Conda Build
shell: bash -l {0}
run: |
conda build -c defaults -c numba --python ${{ env.MAIN_PYVER }} buildscripts/conda_recipes/numba-scipy/
# This doesn't rebuild, but simply computes the name of the file that was previously built
OUTPUT=$(conda build --output -c defaults -c numba --python ${{ env.MAIN_PYVER }} buildscripts/conda_recipes/numba-scipy/)
echo "Path to built package:"
echo $OUTPUT
echo "CONDA_BUILD_OUTPUT=$OUTPUT" >> $GITHUB_ENV
- name: Upload build artifact
uses: actions/upload-artifact@v2
with:
name: built_package
path: ${{ env.CONDA_BUILD_OUTPUT }}
retention-days: 7
test_pyver:
needs: build
strategy:
matrix:
scipy-version: [">=1.4,<1.11.0"]
pyver: [3.8, 3.9, "3.10", 3.11, 3.12]
runs-on: [macos-latest, ubuntu-latest, windows-latest]
numpy-version: ["<1.22.0", ">=1.22.0"]
exclude:
- pyver: 3.11
numpy-version: "<1.22.0"
include:
- pyver: 3.8
scipy-version: ">=0.16,<1.4"
numpy-version: "<1.22.0"
runs-on: macos-latest
- pyver: 3.8
scipy-version: ">=0.16,<1.4"
numpy-version: "<1.22.0"
runs-on: ubuntu-latest
- pyver: 3.8
scipy-version: ">=0.16,<1.4"
numpy-version: "<1.22.0"
runs-on: windows-latest
runs-on: ${{ matrix.runs-on }}
steps:
- name: Download build artifact
uses: actions/download-artifact@v2
with:
name: built_package
path: ./artifact_storage
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
auto-activate-base: false
activate-environment: test_env
- name: Install dependencies and build artifact
shell: bash -l {0}
run: |
conda install -c numba python=${{ matrix.pyver }} numba>=0.45 'scipy${{ matrix.scipy-version }}' 'numpy${{ matrix.numpy-version }}' flake8 pytest
# Install built_package
BUILT_PKG=$(ls ./artifact_storage | head -1)
conda install ./artifact_storage/$BUILT_PKG
conda list
- name: Pytest
shell: bash -l {0}
run: |
pytest --pyargs numba_scipy.tests
dev_deploy:
runs-on: ubuntu-latest
needs: test_pyver
if: (github.ref == 'refs/heads/main') || contains(github.ref, 'refs/tags/')
env:
AC_LABEL: dev
steps:
- name: Download build artifact
uses: actions/download-artifact@v2
with:
name: built_package
path: ./artifact_storage
- name: Determine label
if: contains(github.ref, 'refs/tags/')
run: |
echo "AC_LABEL=main" >> $GITHUB_ENV
- name: Deploy to Anaconda Cloud
shell: bash -l {0}
# workaround issues with setup-miniconda an anaconda-client
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda config --set always_yes yes --set changeps1 no
conda install -q anaconda-client
ls -la ./artifact_storage
UPLOAD=$(ls ./artifact_storage | head -1)
echo "Uploading $UPLOAD with label=${{ env.AC_LABEL }}"
$CONDA/bin/anaconda -t ${{ secrets.ANACONDA_ORG_TOKEN }} upload -u numba -l ${{ env.AC_LABEL }} --no-progress --force --no-register ./artifact_storage/$UPLOAD