Skip to content

Commit ac0f6f6

Browse files
Merge pull request #1176 from antonwolfy/build_and_upload_for_win
Add git workflow factions or Windows
2 parents 59ef493 + c91f912 commit ac0f6f6

File tree

5 files changed

+164
-27
lines changed

5 files changed

+164
-27
lines changed

.github/workflows/conda-package.yml

Lines changed: 157 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,35 @@
11
name: Conda package
22

3-
on: push
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
48

59
env:
6-
PACKAGE_NAME: dpctl
10+
PACKAGE_NAME: dpnp
11+
MODULE_NAME: dpnp
12+
VER_SCRIPT1: "import json; f = open('ver.json', 'r'); j = json.load(f); f.close(); "
13+
VER_SCRIPT2: "d = j['dpnp'][0]; print('='.join((d[s] for s in ('version', 'build'))))"
714

815
jobs:
9-
build:
10-
runs-on: ubuntu-20.04
16+
build_linux:
17+
runs-on: ubuntu-latest
18+
19+
defaults:
20+
run:
21+
shell: bash -l {0}
1122

1223
strategy:
1324
matrix:
14-
python: [3.8, 3.9]
25+
python: ['3.8', '3.9']
26+
27+
env:
28+
conda-pkgs: '/home/runner/conda_pkgs_dir/'
29+
conda-bld: '/usr/share/miniconda3/envs/build/conda-bld/linux-64/'
1530

1631
steps:
17-
- name: Checkout repo
32+
- name: Checkout DPNP repo
1833
uses: actions/checkout@v3
1934
with:
2035
fetch-depth: 0
@@ -24,44 +39,165 @@ jobs:
2439
with:
2540
repository: oneapi-src/oneDPL
2641
path: oneDPL
27-
ref: oneDPL-2021.6.1-release
42+
ref: oneDPL-2021.7.0-release
43+
44+
- name: Setup miniconda
45+
uses: conda-incubator/setup-miniconda@v2
46+
with:
47+
auto-update-conda: true
48+
python-version: ${{ matrix.python }}
49+
miniconda-version: 'latest'
50+
activate-environment: 'build'
51+
use-only-tar-bz2: true
52+
53+
- name: Cache conda packages
54+
uses: actions/cache@v3
55+
env:
56+
CACHE_NUMBER: 1 # Increase to reset cache
57+
with:
58+
path: ${{ env.conda-pkgs }}
59+
key:
60+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
61+
restore-keys: |
62+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
63+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
2864
29-
- name: Add conda to system path
30-
run: echo $CONDA/bin >> $GITHUB_PATH
3165
- name: Install conda-build
3266
run: conda install conda-build
67+
3368
- name: Build conda package
3469
run: ./scripts/build_conda_package.sh ${{ matrix.python }} $GITHUB_WORKSPACE/oneDPL
3570

3671
- name: Upload artifact
3772
uses: actions/upload-artifact@v2
3873
with:
39-
name: dpnp ${{ runner.os }} ${{ matrix.python }}
40-
path: /usr/share/miniconda/conda-bld/linux-64/dpnp-*.tar.bz2
74+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
75+
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2
76+
77+
build_windows:
78+
runs-on: windows-latest
79+
80+
defaults:
81+
run:
82+
shell: cmd /C CALL {0}
83+
84+
strategy:
85+
matrix:
86+
python: ['3.8', '3.9']
87+
88+
env:
89+
conda-pkgs: 'C:\Users\runneradmin\conda_pkgs_dir\'
90+
conda-bld: 'C:\Miniconda3\envs\build\conda-bld\win-64\'
91+
92+
steps:
93+
- name: Checkout DPNP repo
94+
uses: actions/checkout@v3
95+
with:
96+
fetch-depth: 0
97+
98+
- name: Checkout oneDPL
99+
uses: actions/checkout@v3
100+
with:
101+
repository: oneapi-src/oneDPL
102+
path: oneDPL
103+
ref: oneDPL-2021.7.0-release
104+
105+
- name: Setup miniconda
106+
uses: conda-incubator/setup-miniconda@v2
107+
with:
108+
auto-update-conda: true
109+
python-version: ${{ matrix.python }}
110+
miniconda-version: 'latest'
111+
activate-environment: 'build'
112+
use-only-tar-bz2: true
113+
114+
- name: Cache conda packages
115+
uses: actions/cache@v3
116+
env:
117+
CACHE_NUMBER: 1 # Increase to reset cache
118+
with:
119+
path: ${{ env.conda-pkgs }}
120+
key:
121+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
122+
restore-keys: |
123+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
124+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
125+
126+
- name: Install conda-build
127+
run: conda install conda-build
128+
129+
- name: Build conda package
130+
run: conda build --no-test --python ${{ matrix.python }} -c dppy/label/dev -c intel -c defaults --override-channels conda-recipe
131+
env:
132+
DPLROOT: '%GITHUB_WORKSPACE%\oneDPL'
133+
134+
- name: Upload artifact
135+
uses: actions/upload-artifact@v2
136+
with:
137+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
138+
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2
139+
140+
upload_linux:
141+
needs: build_linux
142+
143+
if: ${{github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/')}}
41144

42-
upload:
43-
needs: build
44-
if: ${{ github.ref == 'refs/heads/master' }}
45145
runs-on: ubuntu-latest
46146

47147
strategy:
48148
matrix:
49-
python: [3.8, 3.9]
149+
python: ['3.8', '3.9']
150+
151+
steps:
152+
- name: Download artifact
153+
uses: actions/download-artifact@v2
154+
with:
155+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
50156

157+
- name: Setup miniconda
158+
uses: conda-incubator/setup-miniconda@v2
159+
with:
160+
auto-update-conda: true
161+
python-version: ${{ matrix.python }}
162+
miniconda-version: 'latest'
163+
activate-environment: 'upload'
164+
165+
- name: Install anaconda-client
166+
run: conda install anaconda-client
167+
168+
- name: Upload
169+
env:
170+
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
171+
run: anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2
172+
173+
upload_windows:
174+
needs: build_windows
175+
176+
if: ${{github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/')}}
177+
178+
runs-on: windows-latest
179+
180+
strategy:
181+
matrix:
182+
python: ['3.8', '3.9']
51183
steps:
52184
- name: Download artifact
53185
uses: actions/download-artifact@v2
54186
with:
55-
name: dpnp ${{ runner.os }} ${{ matrix.python }}
187+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
188+
189+
- name: Setup miniconda
190+
uses: conda-incubator/setup-miniconda@v2
191+
with:
192+
auto-update-conda: true
193+
python-version: ${{ matrix.python }}
194+
miniconda-version: 'latest'
195+
activate-environment: 'upload'
56196

57197
- name: Install anaconda-client
58198
run: conda install anaconda-client
59-
- name: Add conda to system path
60-
run: echo $CONDA/bin >> $GITHUB_PATH
61199

62200
- name: Upload
63201
env:
64202
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
65-
run: |
66-
conda install anaconda-client
67-
anaconda --token $ANACONDA_TOKEN upload --user dppy --label dev dpnp-*.tar.bz2
203+
run: anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2

conda-recipe/bld.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
REM A workaround for activate-dpcpp.bat issue to be addressed in 2021.4
2+
set "LIB=%BUILD_PREFIX%\Library\lib;%BUILD_PREFIX%\compiler\lib;%LIB%"
23
SET "INCLUDE=%BUILD_PREFIX%\include;%INCLUDE%"
34

45
IF DEFINED DPLROOT (

conda-recipe/meta.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ requirements:
88
host:
99
- python
1010
- setuptools
11-
- numpy 1.19
11+
- numpy >=1.19
1212
- cython
13-
- cmake 3.19
13+
- cmake >=3.19
1414
- dpctl >=0.13
1515
- mkl-devel-dpcpp {{ environ.get('MKL_VER', '>=2021.1.1') }}
1616
- tbb-devel
1717
- wheel
1818
build:
19-
- {{ compiler('dpcpp') }}
20-
- dpcpp-cpp-rt {{ environ.get('DPCPP_VER', '>=2021.1.1') }}
19+
- {{ compiler('cxx') }}
20+
- {{ compiler('dpcpp') }} >=2022.1 # [not osx]
2121
run:
2222
- python
2323
- dpctl >=0.13

scripts/build_conda_package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ DPLROOT=$2
55

66
export DPLROOT
77

8-
CHANNELS="-c dppy/label/dev -c intel -c defaults --override-channels"
8+
CHANNELS="-c dppy/label/dev -c defaults -c intel --override-channels"
99
VERSIONS="--python $PYTHON_VERSION"
1010
TEST="--no-test"
1111

utils/dpnp_build_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def find_cmplr(verbose=False):
126126
verbose=verbose)
127127

128128
# try to find in Python environment
129-
if not cmplr_include or not mathlib_path:
129+
if not cmplr_include or not cmplr_libpath:
130130
if sys.platform in ['linux']:
131131
rel_include_path = os.path.join('include')
132132
rel_libdir_path = os.path.join('lib')

0 commit comments

Comments
 (0)