Skip to content

Commit 3a671f3

Browse files
author
Elena Totmenina
authored
Add workflow for win (#534)
* Add workflow for win * .github/workflows/conda-package.yml * Add win tests + some fixes * add upload win * Del self-hosted win
1 parent 8e716ae commit 3a671f3

File tree

1 file changed

+107
-22
lines changed

1 file changed

+107
-22
lines changed

.github/workflows/conda-package.yml

Lines changed: 107 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,54 @@ env:
88

99
jobs:
1010
build:
11-
runs-on: ubuntu-latest
11+
runs-on: ${{ matrix.os }}
1212
strategy:
1313
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\
1424
python: [3.8]
1525
steps:
1626
- uses: actions/checkout@v2
1727
with:
1828
fetch-depth: 0
29+
- uses: conda-incubator/setup-miniconda@v2
30+
with:
31+
auto-activate-base: true
32+
activate-environment: ""
1933

2034
- name: Set pkgs_dirs
2135
run: |
22-
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
36+
echo "pkgs_dirs: [${{ matrix.pkgs_dirs }}]" >> ${{ matrix.condarc }}
2337
- name: Cache conda packages
2438
uses: actions/cache@v2
2539
env:
2640
CACHE_NUMBER: 0 # Increase to reset cache
2741
with:
28-
path: ~/.conda/pkgs
42+
path: ${{ matrix.pkgs_dirs }}
2943
key:
3044
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
3145
restore-keys: |
3246
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
3347
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
34-
35-
- name: Add conda to system path
36-
run: echo $CONDA/bin >> $GITHUB_PATH
3748
- name: Install conda-build
3849
run: conda install conda-build
3950
- 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
51+
run: conda build --no-test --python ${{ matrix.python }} -c intel -c defaults --override-channels conda-recipe
5052
- name: Upload artifact
5153
uses: actions/upload-artifact@v2
5254
with:
5355
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
54-
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.tar.bz2
56+
path: ${{ matrix.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2
5557

56-
test:
58+
test_linux:
5759
needs: build
5860
runs-on: ${{ matrix.runner }}
5961

@@ -86,7 +88,6 @@ jobs:
8688
conda index $GITHUB_WORKSPACE/channel
8789
# Test channel
8890
conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels
89-
9091
- name: Collect dependencies
9192
run: |
9293
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
@@ -105,7 +106,6 @@ jobs:
105106
restore-keys: |
106107
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
107108
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
108-
109109
- name: Install dpctl
110110
run: |
111111
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
@@ -119,8 +119,67 @@ jobs:
119119
# clinfo -l
120120
python -m pytest --pyargs $MODULE_NAME
121121
122-
upload:
123-
needs: test
122+
test_windows:
123+
needs: build
124+
runs-on: ${{ matrix.runner }}
125+
126+
strategy:
127+
matrix:
128+
python: [3.8]
129+
experimental: [false]
130+
runner: [windows-latest]
131+
continue-on-error: ${{ matrix.experimental }}
132+
env:
133+
CHANNELS: -c intel -c defaults --override-channels
134+
135+
steps:
136+
- name: Download artifact
137+
uses: actions/download-artifact@v2
138+
with:
139+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
140+
- uses: conda-incubator/setup-miniconda@v2
141+
with:
142+
auto-activate-base: true
143+
activate-environment: ""
144+
- name: Install conda-build
145+
run: conda install conda-build
146+
- name: Create conda channel
147+
run: |
148+
mkdir -p $GITHUB_WORKSPACE/channel/win-64
149+
mv ${{ env.PACKAGE_NAME }}-*.tar.bz2 ${{ env.GITHUB_WORKSPACE }}/channel/win-64
150+
conda index ${{ env.GITHUB_WORKSPACE }}/channel
151+
# Test channel
152+
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels
153+
- name: Collect dependencies
154+
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
158+
- name: Cache conda packages
159+
uses: actions/cache@v2
160+
env:
161+
CACHE_NUMBER: 0 # Increase to reset cache
162+
with:
163+
path: C:\Users\runneradmin\.conda\pkgs
164+
key:
165+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
166+
restore-keys: |
167+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
168+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
169+
- name: Install opencl_rt
170+
run: conda install opencl_rt -c intel --override-channels
171+
- name: Install dpctl
172+
run: |
173+
conda install ${{ env.PACKAGE_NAME }} pytest python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }}
174+
# Test installed packages
175+
conda list
176+
- name: Add library
177+
run: echo "OCL_ICD_FILENAMES=C:\Miniconda\Library\lib\intelocl64.dll" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
178+
- name: Run tests
179+
run: python -m pytest --pyargs ${{ env.MODULE_NAME }}
180+
181+
upload_linux:
182+
needs: test_linux
124183
if: ${{ github.ref == 'refs/heads/master' }}
125184
runs-on: ubuntu-latest
126185
strategy:
@@ -143,3 +202,29 @@ jobs:
143202
run: |
144203
conda install anaconda-client
145204
anaconda --token $ANACONDA_TOKEN upload --user dppy --label dev ${PACKAGE_NAME}-*.tar.bz2
205+
206+
upload_windows:
207+
needs: test_windows
208+
if: ${{ github.ref == 'refs/heads/master' }}
209+
runs-on: windows-latest
210+
strategy:
211+
matrix:
212+
python: [3.8]
213+
steps:
214+
- name: Download artifact
215+
uses: actions/download-artifact@v2
216+
with:
217+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
218+
- uses: conda-incubator/setup-miniconda@v2
219+
with:
220+
auto-activate-base: true
221+
activate-environment: ""
222+
- name: Install anaconda-client
223+
run: conda install anaconda-client
224+
225+
- name: Upload
226+
env:
227+
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
228+
run: |
229+
conda install anaconda-client
230+
anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2

0 commit comments

Comments
 (0)