Skip to content

Commit 0e8bd13

Browse files
Try using workflows to test packages
1 parent 0c6f3f3 commit 0e8bd13

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed

.github/workflows/conda-package.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Conda package
2+
3+
on: push
4+
5+
env:
6+
PACKAGE_NAME: mkl_fft
7+
MODULE_NAME: mkl_fft
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python: [3.8]
15+
steps:
16+
- uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set pkgs_dirs
21+
run: |
22+
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
23+
- name: Cache conda packages
24+
uses: actions/cache@v2
25+
env:
26+
CACHE_NUMBER: 0 # Increase to reset cache
27+
with:
28+
path: ~/.conda/pkgs
29+
key:
30+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
31+
restore-keys: |
32+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
33+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
34+
35+
- name: Add conda to system path
36+
run: echo $CONDA/bin >> $GITHUB_PATH
37+
- name: Install conda-build
38+
run: conda install conda-build
39+
- name: Build conda package
40+
run: |
41+
CHANNELS="-c intel -c defaults --override-channels"
42+
VERSIONS="--python ${{ matrix.python }}"
43+
TEST="--no-test"
44+
45+
conda build \
46+
$TEST \
47+
$VERSIONS \
48+
$CHANNELS \
49+
conda-recipe
50+
- name: Upload artifact
51+
uses: actions/upload-artifact@v2
52+
with:
53+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
54+
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.tar.bz2
55+
56+
test:
57+
needs: build
58+
runs-on: ${{ matrix.runner }}
59+
60+
strategy:
61+
matrix:
62+
python: [3.8]
63+
experimental: [false]
64+
runner: [ubuntu-latest]
65+
continue-on-error: ${{ matrix.experimental }}
66+
env:
67+
CHANNELS: -c intel -c defaults --override-channels
68+
69+
steps:
70+
- name: Download artifact
71+
uses: actions/download-artifact@v2
72+
with:
73+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
74+
- name: Add conda to system path
75+
run: echo $CONDA/bin >> $GITHUB_PATH
76+
- name: Install conda-build
77+
run: conda install conda-build
78+
- name: Create conda channel
79+
run: |
80+
mkdir -p $GITHUB_WORKSPACE/channel/linux-64
81+
mv ${PACKAGE_NAME}-*.tar.bz2 $GITHUB_WORKSPACE/channel/linux-64
82+
conda index $GITHUB_WORKSPACE/channel
83+
# Test channel
84+
conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels
85+
86+
- name: Collect dependencies
87+
run: |
88+
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
89+
conda install $PACKAGE_NAME python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
90+
- name: Set pkgs_dirs
91+
run: |
92+
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
93+
- name: Cache conda packages
94+
uses: actions/cache@v2
95+
env:
96+
CACHE_NUMBER: 0 # Increase to reset cache
97+
with:
98+
path: ~/.conda/pkgs
99+
key:
100+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
101+
restore-keys: |
102+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
103+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
104+
105+
- name: Install mkl_fft
106+
run: |
107+
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
108+
conda install $PACKAGE_NAME pytest python=${{ matrix.python }} $CHANNELS
109+
# Test installed packages
110+
conda list
111+
- name: Run tests
112+
run: |
113+
python -m pytest --pyargs $MODULE_NAME

0 commit comments

Comments
 (0)