Skip to content

Divide pipelines for Linux and Windows #582

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 3 commits into from
Sep 16, 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
78 changes: 55 additions & 23 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,59 @@ env:
MODULE_NAME: dpctl

jobs:
build:
runs-on: ${{ matrix.os }}
build_linux:
runs-on: ubuntu-latest

strategy:
matrix:
python: [3.8]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set pkgs_dirs
run: |
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
- name: Cache conda packages
uses: actions/cache@v2
env:
CACHE_NUMBER: 0 # Increase to reset cache
with:
path: ~/.conda/pkgs
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
- 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

build_windows:
runs-on: windows-latest

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
condarc: C:\Users\runneradmin\.condarc
conda-bld: C:\Miniconda\conda-bld\win-64\
python: [3.8]
env:
conda-bld: C:\Miniconda\conda-bld\win-64\
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -31,15 +69,12 @@ jobs:
auto-activate-base: true
activate-environment: ""

- name: Set pkgs_dirs
run: |
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: ${{ matrix.pkgs_dirs }}
path: /home/runner/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
restore-keys: |
Expand All @@ -53,10 +88,10 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ matrix.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2

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

strategy:
Expand Down Expand Up @@ -120,7 +155,7 @@ jobs:
python -m pytest --pyargs $MODULE_NAME

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

strategy:
Expand Down Expand Up @@ -152,15 +187,12 @@ jobs:
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
path: /home/runner/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
restore-keys: |
Expand Down