Skip to content

Commit 73aedc4

Browse files
committed
Add matrix for python version
1 parent 5cce14f commit 73aedc4

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

.github/workflows/conda-package.yml

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ on: push
44

55
env:
66
PACKAGE_NAME: dpctl
7+
MODULE_NAME: dpctl
78

89
jobs:
910
build:
1011
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python: ["3.8"]
1115
steps:
1216
- uses: actions/checkout@v2
1317
with:
@@ -23,7 +27,10 @@ jobs:
2327
with:
2428
path: ~/.conda/pkgs
2529
key:
26-
${{ runner.os }}-conda-build-${{ env.CACHE_NUMBER }}-${{hashFiles('**/meta.yaml') }}
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 }}-
2734
2835
- name: Add conda to system path
2936
run: echo $CONDA/bin >> $GITHUB_PATH
@@ -32,7 +39,7 @@ jobs:
3239
- name: Build conda package
3340
run: |
3441
CHANNELS="-c intel -c defaults --override-channels"
35-
VERSIONS="--python 3.8"
42+
VERSIONS="--python ${{ matrix.python }}"
3643
TEST="--no-test"
3744
3845
conda build \
@@ -43,17 +50,24 @@ jobs:
4350
- name: Upload artifact
4451
uses: actions/upload-artifact@v2
4552
with:
46-
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }}
53+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
4754
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.tar.bz2
4855

4956
test:
5057
needs: build
5158
runs-on: ubuntu-latest
59+
60+
strategy:
61+
matrix:
62+
python: ["3.8"]
63+
env:
64+
CHANNELS: -c intel -c defaults --override-channels
65+
5266
steps:
5367
- name: Download artifact
5468
uses: actions/download-artifact@v2
5569
with:
56-
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }}
70+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
5771
- name: Add conda to system path
5872
run: echo $CONDA/bin >> $GITHUB_PATH
5973
- name: Install conda-build
@@ -65,10 +79,11 @@ jobs:
6579
conda index $GITHUB_WORKSPACE/channel
6680
# Test channel
6781
conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels
82+
6883
- name: Collect dependencies
6984
run: |
70-
CHANNELS="-c $GITHUB_WORKSPACE/channel -c intel -c defaults --override-channels"
71-
conda install $PACKAGE_NAME $CHANNELS --only-deps --dry-run > lockfile
85+
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
86+
conda install $PACKAGE_NAME python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
7287
- name: Set pkgs_dirs
7388
run: |
7489
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
@@ -79,28 +94,35 @@ jobs:
7994
with:
8095
path: ~/.conda/pkgs
8196
key:
82-
${{ runner.os }}-conda-test-${{ env.CACHE_NUMBER }}-${{hashFiles('lockfile') }}
83-
- name: Install ${{ env.PACKAGE_NAME }}
97+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
98+
restore-keys: |
99+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
100+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
101+
102+
- name: Install dpctl
84103
run: |
85-
CHANNELS="-c $GITHUB_WORKSPACE/channel -c intel -c defaults --override-channels"
86-
conda install $PACKAGE_NAME pytest $CHANNELS
104+
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
105+
conda install $PACKAGE_NAME pytest python=${{ matrix.python }} $CHANNELS
87106
# Test installed packages
88107
conda list
89108
- name: Run tests
90109
run: |
91110
# echo "libintelocl.so" | tee /etc/OpenCL/vendors/intel-cpu.icd
92111
export OCL_ICD_FILENAMES=libintelocl.so
93-
python -m pytest --pyargs $PACKAGE_NAME
112+
python -m pytest --pyargs $MODULE_NAME
94113
95114
upload:
96115
needs: test
97116
if: ${{ github.ref == 'refs/heads/master' }}
98117
runs-on: ubuntu-latest
118+
strategy:
119+
matrix:
120+
python: ["3.8"]
99121
steps:
100122
- name: Download artifact
101123
uses: actions/download-artifact@v2
102124
with:
103-
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }}
125+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
104126

105127
- name: Install anaconda-client
106128
run: conda install anaconda-client

0 commit comments

Comments
 (0)