Skip to content

Add git workflow actions for Windows #1176

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
Show file tree
Hide file tree
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
178 changes: 157 additions & 21 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
name: Conda package

on: push
on:
push:
branches:
- master
pull_request:

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

jobs:
build:
runs-on: ubuntu-20.04
build_linux:
runs-on: ubuntu-latest

defaults:
run:
shell: bash -l {0}

strategy:
matrix:
python: [3.8, 3.9]
python: ['3.8', '3.9']

env:
conda-pkgs: '/home/runner/conda_pkgs_dir/'
conda-bld: '/usr/share/miniconda3/envs/build/conda-bld/linux-64/'

steps:
- name: Checkout repo
- name: Checkout DPNP repo
uses: actions/checkout@v3
with:
fetch-depth: 0
Expand All @@ -24,44 +39,165 @@ jobs:
with:
repository: oneapi-src/oneDPL
path: oneDPL
ref: oneDPL-2021.6.1-release
ref: oneDPL-2021.7.0-release

- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
miniconda-version: 'latest'
activate-environment: 'build'
use-only-tar-bz2: true

- name: Cache conda packages
uses: actions/cache@v3
env:
CACHE_NUMBER: 1 # Increase to reset cache
with:
path: ${{ env.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: ./scripts/build_conda_package.sh ${{ matrix.python }} $GITHUB_WORKSPACE/oneDPL

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: dpnp ${{ runner.os }} ${{ matrix.python }}
path: /usr/share/miniconda/conda-bld/linux-64/dpnp-*.tar.bz2
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2

build_windows:
runs-on: windows-latest

defaults:
run:
shell: cmd /C CALL {0}

strategy:
matrix:
python: ['3.8', '3.9']

env:
conda-pkgs: 'C:\Users\runneradmin\conda_pkgs_dir\'
conda-bld: 'C:\Miniconda3\envs\build\conda-bld\win-64\'

steps:
- name: Checkout DPNP repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Checkout oneDPL
uses: actions/checkout@v3
with:
repository: oneapi-src/oneDPL
path: oneDPL
ref: oneDPL-2021.7.0-release

- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
miniconda-version: 'latest'
activate-environment: 'build'
use-only-tar-bz2: true

- name: Cache conda packages
uses: actions/cache@v3
env:
CACHE_NUMBER: 1 # Increase to reset cache
with:
path: ${{ env.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: Install conda-build
run: conda install conda-build

- name: Build conda package
run: conda build --no-test --python ${{ matrix.python }} -c dppy/label/dev -c intel -c defaults --override-channels conda-recipe
env:
DPLROOT: '%GITHUB_WORKSPACE%\oneDPL'

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2

upload_linux:
needs: build_linux

if: ${{github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/')}}

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

strategy:
matrix:
python: [3.8, 3.9]
python: ['3.8', '3.9']

steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}

- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
miniconda-version: 'latest'
activate-environment: 'upload'

- name: Install anaconda-client
run: conda install anaconda-client

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

upload_windows:
needs: build_windows

if: ${{github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/')}}

runs-on: windows-latest

strategy:
matrix:
python: ['3.8', '3.9']
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: dpnp ${{ runner.os }} ${{ matrix.python }}
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}

- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
miniconda-version: 'latest'
activate-environment: 'upload'

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

- name: Upload
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
conda install anaconda-client
anaconda --token $ANACONDA_TOKEN upload --user dppy --label dev dpnp-*.tar.bz2
run: anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2
1 change: 1 addition & 0 deletions conda-recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
REM A workaround for activate-dpcpp.bat issue to be addressed in 2021.4
set "LIB=%BUILD_PREFIX%\Library\lib;%BUILD_PREFIX%\compiler\lib;%LIB%"
SET "INCLUDE=%BUILD_PREFIX%\include;%INCLUDE%"

IF DEFINED DPLROOT (
Expand Down
8 changes: 4 additions & 4 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ requirements:
host:
- python
- setuptools
- numpy 1.19
- numpy >=1.19
- cython
- cmake 3.19
- cmake >=3.19
- dpctl >=0.13
- mkl-devel-dpcpp {{ environ.get('MKL_VER', '>=2021.1.1') }}
- tbb-devel
- wheel
build:
- {{ compiler('dpcpp') }}
- dpcpp-cpp-rt {{ environ.get('DPCPP_VER', '>=2021.1.1') }}
- {{ compiler('cxx') }}
- {{ compiler('dpcpp') }} >=2022.1 # [not osx]
run:
- python
- dpctl >=0.13
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_conda_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DPLROOT=$2

export DPLROOT

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

Expand Down
2 changes: 1 addition & 1 deletion utils/dpnp_build_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def find_cmplr(verbose=False):
verbose=verbose)

# try to find in Python environment
if not cmplr_include or not mathlib_path:
if not cmplr_include or not cmplr_libpath:
if sys.platform in ['linux']:
rel_include_path = os.path.join('include')
rel_libdir_path = os.path.join('lib')
Expand Down