Skip to content

Add workflow for win #534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 107 additions & 22 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,52 +8,54 @@ env:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
pkgs_dirs: ~/.conda/pkgs
condarc: ~/.condarc
conda-bld: /usr/share/miniconda/conda-bld/linux-64/
- os: windows-latest
pkgs_dirs: C:\Users\runneradmin\.conda\pkgs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use Windows env variables like %HOMEDRIVE%%HOMEPATH% to replace hard-coded home path which may change down the road?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is currently no way to use environment variables here

condarc: C:\Users\runneradmin\.condarc
conda-bld: C:\Miniconda\conda-bld\win-64\
python: [3.8]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v2
with:
auto-activate-base: true
activate-environment: ""

- name: Set pkgs_dirs
run: |
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
echo "pkgs_dirs: [${{ matrix.pkgs_dirs }}]" >> ${{ matrix.condarc }}
- name: Cache conda packages
uses: actions/cache@v2
env:
CACHE_NUMBER: 0 # Increase to reset cache
with:
path: ~/.conda/pkgs
path: ${{ matrix.pkgs_dirs }}
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
restore-keys: |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-

- name: Add conda to system path
run: echo $CONDA/bin >> $GITHUB_PATH
- name: Install conda-build
run: conda install conda-build
- name: Build conda package
run: |
CHANNELS="-c intel -c defaults --override-channels"
VERSIONS="--python ${{ matrix.python }}"
TEST="--no-test"

conda build \
$TEST \
$VERSIONS \
$CHANNELS \
conda-recipe
run: conda build --no-test --python ${{ matrix.python }} -c intel -c defaults --override-channels conda-recipe
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.tar.bz2
path: ${{ matrix.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2

test:
test_linux:
needs: build
runs-on: ${{ matrix.runner }}

Expand Down Expand Up @@ -86,7 +88,6 @@ jobs:
conda index $GITHUB_WORKSPACE/channel
# Test channel
conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels

- name: Collect dependencies
run: |
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
Expand All @@ -105,7 +106,6 @@ jobs:
restore-keys: |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-

- name: Install dpctl
run: |
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
Expand All @@ -119,8 +119,67 @@ jobs:
# clinfo -l
python -m pytest --pyargs $MODULE_NAME

upload:
needs: test
test_windows:
needs: build
runs-on: ${{ matrix.runner }}

strategy:
matrix:
python: [3.8]
experimental: [false]
runner: [windows-latest]
continue-on-error: ${{ matrix.experimental }}
env:
CHANNELS: -c intel -c defaults --override-channels

steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
- uses: conda-incubator/setup-miniconda@v2
with:
auto-activate-base: true
activate-environment: ""
- name: Install conda-build
run: conda install conda-build
- name: Create conda channel
run: |
mkdir -p $GITHUB_WORKSPACE/channel/win-64
mv ${{ env.PACKAGE_NAME }}-*.tar.bz2 ${{ env.GITHUB_WORKSPACE }}/channel/win-64
conda index ${{ env.GITHUB_WORKSPACE }}/channel
# Test channel
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels
- name: Collect dependencies
run: conda install ${{ env.PACKAGE_NAME }} python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
- name: Set pkgs_dirs
run: |
echo "pkgs_dirs: [C:\Users\runneradmin\.conda\pkgs]" >> C:\Users\runneradmin\.condarc
- name: Cache conda packages
uses: actions/cache@v2
env:
CACHE_NUMBER: 0 # Increase to reset cache
with:
path: C:\Users\runneradmin\.conda\pkgs
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
restore-keys: |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
- name: Install opencl_rt
run: conda install opencl_rt -c intel --override-channels
- name: Install dpctl
run: |
conda install ${{ env.PACKAGE_NAME }} pytest python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }}
# Test installed packages
conda list
- name: Add library
run: echo "OCL_ICD_FILENAMES=C:\Miniconda\Library\lib\intelocl64.dll" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Run tests
run: python -m pytest --pyargs ${{ env.MODULE_NAME }}

upload_linux:
needs: test_linux
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
strategy:
Expand All @@ -143,3 +202,29 @@ jobs:
run: |
conda install anaconda-client
anaconda --token $ANACONDA_TOKEN upload --user dppy --label dev ${PACKAGE_NAME}-*.tar.bz2

upload_windows:
needs: test_windows
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: windows-latest
strategy:
matrix:
python: [3.8]
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
- uses: conda-incubator/setup-miniconda@v2
with:
auto-activate-base: true
activate-environment: ""
- name: Install anaconda-client
run: conda install anaconda-client

- name: Upload
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
conda install anaconda-client
anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2