This repository has been archived by the owner on Jun 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
117 lines (112 loc) · 3.87 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
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.8
jobs:
build:
runs-on: ubuntu-latest
steps:
- 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 flake8 pytest pip
pip install --no-deps -e .
- name: Lint with flake8
shell: bash -l {0}
run: |
flake8 numba_extras
- 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-extras/
# 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-extras/)
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:
pyver: ["3.7", "3.8", "3.9", "3.10"]
runs-on: [macos-latest, ubuntu-latest, 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 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_extras
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=numba/label/dev" >> $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