Skip to content

Commit fc2a036

Browse files
Add Windows workflow
1 parent 2f896ae commit fc2a036

File tree

1 file changed

+134
-0
lines changed

1 file changed

+134
-0
lines changed

.github/workflows/conda-package.yml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,137 @@ jobs:
115115
source $CONDA/etc/profile.d/conda.sh
116116
conda activate test_mkl_fft
117117
pytest -v --pyargs $MODULE_NAME
118+
119+
build_windows:
120+
runs-on: windows-latest
121+
122+
strategy:
123+
matrix:
124+
python: ['3.10']
125+
env:
126+
conda-bld: C:\Miniconda\conda-bld\win-64\
127+
steps:
128+
- uses: actions/checkout@v3
129+
with:
130+
fetch-depth: 0
131+
- uses: conda-incubator/setup-miniconda@v2
132+
with:
133+
auto-activate-base: true
134+
conda-build-version: "*"
135+
activate-environment: true
136+
python-version: ${{ matrix.python }}
137+
138+
- name: Cache conda packages
139+
uses: actions/cache@v3
140+
env:
141+
CACHE_NUMBER: 3 # Increase to reset cache
142+
with:
143+
path: /home/runner/conda_pkgs_dir
144+
key:
145+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
146+
restore-keys: |
147+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
148+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
149+
- name: Build conda package
150+
run: conda build --no-test --python ${{ matrix.python }} -c intel -c conda-forge --override-channels conda-recipe
151+
- name: Upload artifact
152+
uses: actions/upload-artifact@v3
153+
with:
154+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
155+
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2
156+
157+
test_windows:
158+
needs: build_windows
159+
runs-on: ${{ matrix.runner }}
160+
defaults:
161+
run:
162+
shell: cmd /C CALL {0}
163+
strategy:
164+
matrix:
165+
python: ['3.10']
166+
experimental: [false]
167+
runner: [windows-latest]
168+
continue-on-error: ${{ matrix.experimental }}
169+
env:
170+
workdir: '${{ github.workspace }}'
171+
CHANNELS: -c intel -c conda-forge --override-channels
172+
173+
steps:
174+
- name: Download artifact
175+
uses: actions/download-artifact@v3
176+
with:
177+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
178+
- uses: conda-incubator/setup-miniconda@v2
179+
with:
180+
auto-update-conda: true
181+
conda-build-version: '*'
182+
miniconda-version: 'latest'
183+
activate-environment: mkl_fft_test
184+
python-version: ${{ matrix.python }}
185+
- name: Create conda channel with the artifact bit
186+
shell: cmd /C CALL {0}
187+
run: |
188+
echo ${{ env.workdir }}
189+
mkdir ${{ env.workdir }}\channel\win-64
190+
move ${{ env.PACKAGE_NAME }}-*.tar.bz2 ${{ env.workdir }}\channel\win-64
191+
dir ${{ env.workdir }}\channel\win-64
192+
- name: Index the channel
193+
shell: cmd /C CALL {0}
194+
run: conda index ${{ env.workdir }}\channel
195+
196+
- name: Dump mkl_fft version info from created channel into ver.json
197+
shell: cmd /C CALL {0}
198+
run: |
199+
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.workdir }}/channel --override-channels --info --json > ${{ env.workdir }}\ver.json
200+
- name: Output content of produced ver.json
201+
shell: pwsh
202+
run: Get-Content -Path ${{ env.workdir }}\ver.json
203+
- name: Collect dependencies
204+
shell: cmd /C CALL {0}
205+
run: |
206+
IF NOT EXIST ver.json (
207+
copy /Y ${{ env.workdir }}\ver.json .
208+
)
209+
SET "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%"
210+
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
211+
SET PACKAGE_VERSION=%%F
212+
)
213+
conda install -n mkl_fft_test ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
214+
- name: Display lockfile content
215+
shell: pwsh
216+
run: Get-Content -Path .\lockfile
217+
- name: Cache conda packages
218+
uses: actions/cache@v3
219+
env:
220+
CACHE_NUMBER: 0 # Increase to reset cache
221+
with:
222+
path: /home/runner/conda_pkgs_dir
223+
key:
224+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
225+
restore-keys: |
226+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
227+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
228+
- name: Install mkl_fft
229+
shell: cmd /C CALL {0}
230+
run: |
231+
@ECHO ON
232+
IF NOT EXIST ver.json (
233+
copy /Y ${{ env.workdir }}\ver.json .
234+
)
235+
set "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%"
236+
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
237+
SET PACKAGE_VERSION=%%F
238+
)
239+
SET "TEST_DEPENDENCIES=pytest pytest-cov"
240+
conda install -n mkl_fft_test ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %TEST_DEPENDENCIES% python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
241+
- name: Report content of test environment
242+
shell: cmd /C CALL {0}
243+
run: |
244+
echo "Value of CONDA enviroment variable was: " %CONDA%
245+
echo "Value of CONDA_PREFIX enviroment variable was: " %CONDA_PREFIX%
246+
conda info && conda list -n mkl_fft_test
247+
- name: Run tests
248+
shell: cmd /C CALL {0}
249+
run: >-
250+
conda activate mkl_fft_test && python -m pytest -v -s --pyargs ${{ env.MODULE_NAME }}
251+

0 commit comments

Comments
 (0)