Skip to content

Commit cc1c6c1

Browse files
Merge pull request #24 from IntelPython/upgrade-build-system
Updated build system away from numpy.distutils
2 parents b400194 + 05d9756 commit cc1c6c1

File tree

3 files changed

+347
-190
lines changed

3 files changed

+347
-190
lines changed

.github/workflows/conda-package.yml

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
name: Conda package
2+
3+
on: push
4+
5+
env:
6+
PACKAGE_NAME: mkl_random
7+
MODULE_NAME: mkl_random
8+
VER_SCRIPT1: "import json; f = open('ver.json', 'r'); j = json.load(f); f.close(); "
9+
VER_SCRIPT2: "d = j['dpctl'][0]; print('='.join((d[s] for s in ('version', 'build'))))"
10+
11+
jobs:
12+
build_linux:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python: [3.9]
17+
steps:
18+
- uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set pkgs_dirs
23+
run: |
24+
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
25+
- name: Cache conda packages
26+
uses: actions/cache@v2
27+
env:
28+
CACHE_NUMBER: 0 # Increase to reset cache
29+
with:
30+
path: ~/.conda/pkgs
31+
key:
32+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
33+
restore-keys: |
34+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
35+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
36+
37+
- name: Add conda to system path
38+
run: echo $CONDA/bin >> $GITHUB_PATH
39+
- name: Install conda-build
40+
run: conda install conda-build
41+
- name: Build conda package
42+
run: |
43+
CHANNELS="-c intel -c defaults --override-channels"
44+
VERSIONS="--python ${{ matrix.python }}"
45+
TEST="--no-test"
46+
47+
conda build \
48+
$TEST \
49+
$VERSIONS \
50+
$CHANNELS \
51+
conda-recipe
52+
- name: Upload artifact
53+
uses: actions/upload-artifact@v2
54+
with:
55+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
56+
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.tar.bz2
57+
58+
build_windows:
59+
runs-on: windows-latest
60+
61+
strategy:
62+
matrix:
63+
python: ['3.9']
64+
env:
65+
conda-bld: C:\Miniconda\conda-bld\win-64\
66+
steps:
67+
- uses: actions/checkout@v2
68+
with:
69+
fetch-depth: 0
70+
- uses: conda-incubator/setup-miniconda@v2
71+
with:
72+
auto-activate-base: true
73+
activate-environment: ""
74+
75+
- name: Cache conda packages
76+
uses: actions/cache@v3
77+
env:
78+
CACHE_NUMBER: 3 # Increase to reset cache
79+
with:
80+
path: /home/runner/conda_pkgs_dir
81+
key:
82+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
83+
restore-keys: |
84+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
85+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
86+
- name: Install conda-build
87+
run: conda install conda-build
88+
- name: Build conda package
89+
run: conda build --no-test --python ${{ matrix.python }} -c intel -c defaults --override-channels conda-recipe
90+
- name: Upload artifact
91+
uses: actions/upload-artifact@v2
92+
with:
93+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
94+
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2
95+
96+
test_linux:
97+
needs: build_linux
98+
runs-on: ${{ matrix.runner }}
99+
100+
strategy:
101+
matrix:
102+
python: [3.9]
103+
experimental: [false]
104+
runner: [ubuntu-latest]
105+
continue-on-error: ${{ matrix.experimental }}
106+
env:
107+
CHANNELS: -c intel -c defaults --override-channels
108+
109+
steps:
110+
- name: Download artifact
111+
uses: actions/download-artifact@v2
112+
with:
113+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
114+
- name: Add conda to system path
115+
run: echo $CONDA/bin >> $GITHUB_PATH
116+
- name: Install conda-build
117+
run: conda install conda-build
118+
- name: Create conda channel
119+
run: |
120+
mkdir -p $GITHUB_WORKSPACE/channel/linux-64
121+
conda index $GITHUB_WORKSPACE/channel || exit 1
122+
mv ${PACKAGE_NAME}-*.tar.bz2 $GITHUB_WORKSPACE/channel/linux-64 || exit 1
123+
conda index $GITHUB_WORKSPACE/channel || exit 1
124+
# Test channel
125+
conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels --info --json > $GITHUB_WORKSPACE/ver.json
126+
cat ver.json
127+
- name: Collect dependencies
128+
run: |
129+
. $CONDA/etc/profile.d/conda.sh
130+
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
131+
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
132+
conda create -n test_mkl_random $PACKAGE_NAME=${PACKAGE_VERSION} python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
133+
cat lockfile
134+
- name: Set pkgs_dirs
135+
run: |
136+
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
137+
- name: Cache conda packages
138+
uses: actions/cache@v2
139+
env:
140+
CACHE_NUMBER: 0 # Increase to reset cache
141+
with:
142+
path: ~/.conda/pkgs
143+
key:
144+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
145+
restore-keys: |
146+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
147+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
148+
149+
- name: Install mkl_random
150+
run: |
151+
. $CONDA/etc/profile.d/conda.sh
152+
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
153+
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
154+
conda create -n test_mkl_random $PACKAGE_NAME=${PACKAGE_VERSION} nose python=${{ matrix.python }} $CHANNELS
155+
# Test installed packages
156+
conda list
157+
- name: Run tests
158+
run: |
159+
. $CONDA/etc/profile.d/conda.sh
160+
conda activate test_mkl_random
161+
nosetests -v mkl_random
162+
163+
test_windows:
164+
needs: build_windows
165+
runs-on: ${{ matrix.runner }}
166+
167+
strategy:
168+
matrix:
169+
python: ['3.9']
170+
experimental: [false]
171+
runner: [windows-latest]
172+
continue-on-error: ${{ matrix.experimental }}
173+
env:
174+
CHANNELS: -c intel -c defaults --override-channels
175+
176+
steps:
177+
- name: Download artifact
178+
uses: actions/download-artifact@v2
179+
with:
180+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
181+
- uses: conda-incubator/setup-miniconda@v2
182+
with:
183+
auto-activate-base: true
184+
activate-environment: ""
185+
- name: Install conda-build
186+
# Needed to be able to run conda index
187+
run: conda install conda-build
188+
- name: Create conda channel
189+
run: |
190+
mkdir ${{ env.GITHUB_WORKSPACE }}\channel\win-64
191+
move ${{ env.PACKAGE_NAME }}-*.tar.bz2 ${{ env.GITHUB_WORKSPACE }}\channel\win-64
192+
conda index ${{ env.GITHUB_WORKSPACE }}/channel
193+
# Test channel
194+
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels --info --json > ${{ env.GITHUB_WORKSPACE }}\ver.json
195+
more ${{ env.GITHUB_WORKSPACE }}\ver.json
196+
- name: Collect dependencies
197+
shell: cmd
198+
run: |
199+
@ECHO ON
200+
copy /Y ${{ env.GITHUB_WORKSPACE }}\ver.json .
201+
set "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%"
202+
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
203+
SET PACKAGE_VERSION=%%F
204+
)
205+
conda create -n test_mkl_random ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
206+
more lockfile
207+
- name: Cache conda packages
208+
uses: actions/cache@v3
209+
env:
210+
CACHE_NUMBER: 3 # Increase to reset cache
211+
with:
212+
path: /home/runner/conda_pkgs_dir
213+
key:
214+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
215+
restore-keys: |
216+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
217+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
218+
- name: Install mkl_random
219+
shell: cmd
220+
run: |
221+
@ECHO ON
222+
copy /Y ${{ env.GITHUB_WORKSPACE }}\ver.json .
223+
set "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%"
224+
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
225+
SET PACKAGE_VERSION=%%F
226+
)
227+
conda create -n test_mkl_random ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% nose python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }}
228+
# Test installed packages
229+
conda list
230+
- name: Run tests
231+
run: |
232+
conda activate -n test_mkl_random
233+
nosetests -v ${{ env.MODULE_NAME }}

mkl_random/setup.py

Lines changed: 0 additions & 131 deletions
This file was deleted.

0 commit comments

Comments
 (0)