Skip to content

Commit 225453f

Browse files
author
Elena Totmenina
authored
Divide pipelines for Linux and Windows (#582)
1 parent 5793c9a commit 225453f

File tree

1 file changed

+55
-23
lines changed

1 file changed

+55
-23
lines changed

.github/workflows/conda-package.yml

Lines changed: 55 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,59 @@ env:
77
MODULE_NAME: dpctl
88

99
jobs:
10-
build:
11-
runs-on: ${{ matrix.os }}
10+
build_linux:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
python: [3.8]
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set pkgs_dirs
22+
run: |
23+
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
24+
- name: Cache conda packages
25+
uses: actions/cache@v2
26+
env:
27+
CACHE_NUMBER: 0 # Increase to reset cache
28+
with:
29+
path: ~/.conda/pkgs
30+
key:
31+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
32+
restore-keys: |
33+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
34+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
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+
conda build \
45+
$TEST \
46+
$VERSIONS \
47+
$CHANNELS \
48+
conda-recipe
49+
- name: Upload artifact
50+
uses: actions/upload-artifact@v2
51+
with:
52+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
53+
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.tar.bz2
54+
55+
build_windows:
56+
runs-on: windows-latest
57+
1258
strategy:
1359
matrix:
14-
os: [ubuntu-latest, windows-latest]
15-
include:
16-
- os: ubuntu-latest
17-
pkgs_dirs: ~/.conda/pkgs
18-
condarc: ~/.condarc
19-
conda-bld: /usr/share/miniconda/conda-bld/linux-64/
20-
- os: windows-latest
21-
pkgs_dirs: C:\Users\runneradmin\.conda\pkgs
22-
condarc: C:\Users\runneradmin\.condarc
23-
conda-bld: C:\Miniconda\conda-bld\win-64\
2460
python: [3.8]
61+
env:
62+
conda-bld: C:\Miniconda\conda-bld\win-64\
2563
steps:
2664
- uses: actions/checkout@v2
2765
with:
@@ -31,15 +69,12 @@ jobs:
3169
auto-activate-base: true
3270
activate-environment: ""
3371

34-
- name: Set pkgs_dirs
35-
run: |
36-
echo "pkgs_dirs: [${{ matrix.pkgs_dirs }}]" >> ${{ matrix.condarc }}
3772
- name: Cache conda packages
3873
uses: actions/cache@v2
3974
env:
4075
CACHE_NUMBER: 0 # Increase to reset cache
4176
with:
42-
path: ${{ matrix.pkgs_dirs }}
77+
path: /home/runner/conda_pkgs_dir
4378
key:
4479
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
4580
restore-keys: |
@@ -53,10 +88,10 @@ jobs:
5388
uses: actions/upload-artifact@v2
5489
with:
5590
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
56-
path: ${{ matrix.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2
91+
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2
5792

5893
test_linux:
59-
needs: build
94+
needs: build_linux
6095
runs-on: ${{ matrix.runner }}
6196

6297
strategy:
@@ -120,7 +155,7 @@ jobs:
120155
python -m pytest --pyargs $MODULE_NAME
121156
122157
test_windows:
123-
needs: build
158+
needs: build_windows
124159
runs-on: ${{ matrix.runner }}
125160

126161
strategy:
@@ -152,15 +187,12 @@ jobs:
152187
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels
153188
- name: Collect dependencies
154189
run: conda install ${{ env.PACKAGE_NAME }} python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
155-
- name: Set pkgs_dirs
156-
run: |
157-
echo "pkgs_dirs: [C:\Users\runneradmin\.conda\pkgs]" >> C:\Users\runneradmin\.condarc
158190
- name: Cache conda packages
159191
uses: actions/cache@v2
160192
env:
161193
CACHE_NUMBER: 0 # Increase to reset cache
162194
with:
163-
path: C:\Users\runneradmin\.conda\pkgs
195+
path: /home/runner/conda_pkgs_dir
164196
key:
165197
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
166198
restore-keys: |

0 commit comments

Comments
 (0)