diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index 5b2a177ff2c6..0cc50d6dfb29 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -24,80 +24,24 @@ env: VER_SCRIPT2: "d = j['dpnp'][0]; print('='.join((d[s] for s in ('version', 'build'))))" jobs: - build_linux: - runs-on: ubuntu-latest - - defaults: - run: - shell: bash -l {0} + build: + name: Build ['${{ matrix.os }}', python='${{ matrix.python }}'] strategy: matrix: python: ['3.8', '3.9'] + os: [ubuntu-latest, windows-latest] + include: + - python: '3.10' + os: ubuntu-latest - env: - conda-pkgs: '/home/runner/conda_pkgs_dir/' - - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - with: - access_token: ${{ github.token }} - - - name: Checkout DPNP repo - uses: actions/checkout@v3.1.0 - with: - fetch-depth: 0 - - - name: Setup miniconda - uses: conda-incubator/setup-miniconda@v2.2.0 - with: - auto-update-conda: true - python-version: ${{ matrix.python }} - miniconda-version: 'latest' - activate-environment: 'build' - use-only-tar-bz2: true - - - name: Store conda paths as envs - run: echo "CONDA_BLD=$CONDA_PREFIX/conda-bld/linux-64/" >> $GITHUB_ENV - - - name: Install conda-build - run: conda install conda-build - - - name: Cache conda packages - uses: actions/cache@v3.0.11 - 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: Build conda package - run: conda build --no-test --python ${{ matrix.python }} ${{ env.CHANNELS }} conda-recipe - - - name: Upload artifact - uses: actions/upload-artifact@v3.1.1 - with: - name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} - path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.tar.bz2 - - build_windows: - runs-on: windows-latest + runs-on: ${{ matrix.os }} defaults: run: - shell: cmd /C CALL {0} + shell: ${{ matrix.os == 'windows-latest' && 'cmd /C CALL {0}' || 'bash -l {0}' }} - strategy: - matrix: - python: ['3.8', '3.9'] - - env: - conda-pkgs: 'C:\Users\runneradmin\conda_pkgs_dir\' + continue-on-error: false steps: - name: Cancel Previous Runs @@ -119,26 +63,31 @@ jobs: activate-environment: 'build' use-only-tar-bz2: true - - name: Store conda paths as envs + - if: matrix.os == 'ubuntu-latest' + name: Store conda paths as envs on Linux + run: echo "CONDA_BLD=$CONDA_PREFIX/conda-bld/linux-64/" >> $GITHUB_ENV + + - if: matrix.os == 'windows-latest' + name: Store conda paths as envs on Win run: | @echo on (echo CONDA_BLD=%CONDA_PREFIX%\conda-bld\win-64\) >> %GITHUB_ENV% + - name: Install conda-build + run: conda install conda-build + - name: Cache conda packages uses: actions/cache@v3.0.11 env: CACHE_NUMBER: 1 # Increase to reset cache with: - path: ${{ env.conda-pkgs }} + path: ${{ env.CONDA_PKGS_DIR }} 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 }} ${{ env.CHANNELS }} conda-recipe @@ -149,7 +98,9 @@ jobs: path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.tar.bz2 test_linux: - needs: build_linux + name: Test ['ubuntu-latest', python='${{ matrix.python }}'] + + needs: build runs-on: ubuntu-latest @@ -250,7 +201,9 @@ jobs: working-directory: ${{ env.tests-path }} test_windows: - needs: build_windows + name: Test ['windows-latest', python='${{ matrix.python }}'] + + needs: build runs-on: windows-latest @@ -422,61 +375,28 @@ jobs: python -m pytest -q -ra --disable-warnings -vv ${{ env.TEST_SCOPE }} working-directory: ${{ env.tests-path }} - upload_linux: - needs: test_linux - - if: | - (github.repository == 'IntelPython/dpnp') && - (github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/')) - - runs-on: ubuntu-latest + upload: + name: Upload ['${{ matrix.os }}', python='${{ matrix.python }}'] - defaults: - run: - shell: bash -l {0} + needs: [test_linux, test_windows] strategy: matrix: python: ['3.8', '3.9'] + os: [ubuntu-latest, windows-latest] - steps: - - name: Download artifact - uses: actions/download-artifact@v3.0.1 - with: - name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} - - - name: Setup miniconda - uses: conda-incubator/setup-miniconda@v2.2.0 - with: - auto-update-conda: true - python-version: ${{ matrix.python }} - miniconda-version: 'latest' - activate-environment: 'upload' + runs-on: ${{ matrix.os }} - - name: Install anaconda-client - run: conda install anaconda-client - - - name: Upload - run: anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2 - env: - ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} + defaults: + run: + shell: ${{ matrix.os == 'windows-latest' && 'cmd /C CALL {0}' || 'bash -l {0}' }} - upload_windows: - needs: test_windows + continue-on-error: false if: | (github.repository == 'IntelPython/dpnp') && (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 - - defaults: - run: - shell: cmd /C CALL {0} - - strategy: - matrix: - python: ['3.8', '3.9'] steps: - name: Download artifact uses: actions/download-artifact@v3.0.1