From 2032e4798b33133180346802cbda314e7c50cc10 Mon Sep 17 00:00:00 2001 From: Yevhenii Havrylko Date: Fri, 14 Jul 2023 12:18:03 -0400 Subject: [PATCH 1/2] Revert max spirv version to 1.0 --- numba_dpex/spirv_generator.py | 8 +++++++- setup.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/numba_dpex/spirv_generator.py b/numba_dpex/spirv_generator.py index fdfe7f07e8..e9c87d405b 100644 --- a/numba_dpex/spirv_generator.py +++ b/numba_dpex/spirv_generator.py @@ -76,7 +76,13 @@ def generate(self, llvm_spirv_args, ipath, opath): llvm_spirv_flags.append("--spirv-debug-info-version=ocl-100") if not config.NATIVE_FP_ATOMICS: - llvm_spirv_args = ["--spirv-max-version", "1.4"] + llvm_spirv_args + # Do NOT upgrade version unless you are 100% confident. Not all + # kernel outputs can be converted to higher version of spirv. + # That results in different spirv file versions. As next step + # requires linking of the result file and + # numba_dpex/ocl/atomics/atomic_ops.spir it will raise an error + # that two spirv files have different version and can't be linked + llvm_spirv_args = ["--spirv-max-version", "1.0"] + llvm_spirv_args llvm_spirv_tool = self._llvm_spirv() if config.DEBUG: diff --git a/setup.py b/setup.py index 4f1080560a..0c9eb684a1 100644 --- a/setup.py +++ b/setup.py @@ -107,7 +107,7 @@ def spirv_compile(): spirv_args = [ _llvm_spirv(), "--spirv-max-version", - "1.4", + "1.0", "numba_dpex/ocl/atomics/atomic_ops.bc", "-o", "numba_dpex/ocl/atomics/atomic_ops.spir", From 14a01d28242f0eb32571f04a3acac583174ec35e Mon Sep 17 00:00:00 2001 From: Yevhenii Havrylko Date: Fri, 14 Jul 2023 12:18:20 -0400 Subject: [PATCH 2/2] Make CI more reliable --- .github/actions/setup-conda-build/action.yml | 9 - .github/actions/setup-numba-dpex/action.yml | 31 -- .github/workflows/conda-package.yml | 370 +++++++------------ .github/workflows/coverage.yml | 19 +- .github/workflows/gh-pages-tags.yml | 54 --- .github/workflows/gh-pages.yml | 54 ++- environment/coverage.yml | 29 +- environment/docs.yml | 21 +- 8 files changed, 213 insertions(+), 374 deletions(-) delete mode 100644 .github/actions/setup-conda-build/action.yml delete mode 100644 .github/actions/setup-numba-dpex/action.yml delete mode 100644 .github/workflows/gh-pages-tags.yml diff --git a/.github/actions/setup-conda-build/action.yml b/.github/actions/setup-conda-build/action.yml deleted file mode 100644 index 7bf8755173..0000000000 --- a/.github/actions/setup-conda-build/action.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: Setup conda-build -description: 'Activate conda and install conda-build' -runs: - using: "composite" - steps: - - run: echo $CONDA/bin >> $GITHUB_PATH - shell: bash - - run: conda install conda-build - shell: bash diff --git a/.github/actions/setup-numba-dpex/action.yml b/.github/actions/setup-numba-dpex/action.yml deleted file mode 100644 index 6db253c703..0000000000 --- a/.github/actions/setup-numba-dpex/action.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Setup numba-dpex -description: 'Setup conda environment, build numba-dpex and setup devices' -inputs: - environment: - description: Environment file - required: true - default: environment/dev.yml -runs: - using: "composite" - steps: - - name: Setup conda - run: echo $CONDA/bin >> $GITHUB_PATH - shell: bash - - - name: Setup conda environment - run: conda env update -n base -f ${{ inputs.environment }} --prune - shell: bash - - - name: Test conda environment - run: conda list - shell: bash - - - name: Build numba-dpex - run: | - export PATH=$CONDA/bin-llvm:$PATH - python setup.py develop - shell: bash - - - name: Setup OpenCL CPU device - run: echo "OCL_ICD_FILENAMES=libintelocl.so" >> $GITHUB_ENV - shell: bash diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index d6932d684b..05be76ddc2 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -13,55 +13,37 @@ on: env: PACKAGE_NAME: numba-dpex MODULE_NAME: numba_dpex + # There is a separate action that removes defaults. + CHANNELS: 'dppy/label/dev,conda-forge,intel' + VER_JSON_NAME: 'version.json' + VER_SCRIPT1: "import json; f = open('version.json', 'r'); j = json.load(f); f.close(); " + VER_SCRIPT2: "d = j['numba-dpex'][0]; print('='.join((d[s] for s in ('version', 'build'))))" jobs: - build_linux: - runs-on: ubuntu-20.04 + build: + name: Build ['${{ matrix.os }}', python='${{ matrix.python }}'] strategy: + fail-fast: false matrix: - python: ["3.8", "3.9", "3.10"] + python: ['3.8', '3.9', '3.10'] + os: [ubuntu-latest, windows-latest] - steps: - - name: Checkout repo - uses: actions/checkout@v3 - with: - fetch-depth: 0 + runs-on: ${{ matrix.os }} - - name: Setup conda-build - uses: ./.github/actions/setup-conda-build + defaults: + run: + shell: bash -l {0} - - name: Build conda package - env: - CHANNELS: -c dppy/label/dev -c intel -c defaults -c numba -c numba/label/dev --override-channels - run: ./scripts/build_conda_package.sh ${{ matrix.python }} - - - name: Dump build linux conda environment - run: | - conda env export > /tmp/env-build-linux.yml - cat /tmp/env-build-linux.yml + continue-on-error: false - - name: Upload artifact - uses: actions/upload-artifact@v3 + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.11.0 with: - name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} - path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.tar.bz2 + access_token: ${{ github.token }} - build_windows: - runs-on: windows-latest - - strategy: - matrix: - python: ["3.8", "3.9", "3.10"] - experimental: [false] - artifact_name: [""] - continue-on-error: ${{ matrix.experimental }} - env: - CHANNELS: -c dppy/label/dev -c intel -c defaults -c numba -c numba/label/dev --override-channels - conda-bld: C:\Miniconda\conda-bld\win-64\ - - steps: - - name: Checkout repo + - name: Checkout ${{ env.PACKAGE_NAME }} repo uses: actions/checkout@v3 with: fetch-depth: 0 @@ -69,253 +51,165 @@ jobs: - name: Setup miniconda uses: conda-incubator/setup-miniconda@v2 with: - auto-activate-base: true - activate-environment: "" + python-version: ${{ inputs.python-version }} + miniforge-variant: Mambaforge + miniforge-version: latest + activate-environment: "build" + channels: ${{ env.CHANNELS }} + channel-priority: "disabled" + run-post: false - - name: Cache conda packages - uses: actions/cache@v3 - env: - CACHE_NUMBER: 0 # Increase to reset cache - with: - path: /home/runner/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: Disable defautls + run: conda config --remove channels defaults + + - name: Store conda paths as envs + run: echo "CONDA_BLD=$CONDA_PREFIX/conda-bld/${{ runner.os == 'Linux' && 'linux' || 'win' }}-64/" | tr "\\" '/' >> $GITHUB_ENV + # boa is an extention to conda so we can use mamba resolver in conda build - name: Install conda-build - run: conda install conda-build + run: mamba install boa - name: Build conda package - run: conda build --no-test --python ${{ matrix.python }} ${{ env.CHANNELS }} conda-recipe - - - name: Dump build windows conda environment - run: | - conda env export > env-build-win.yml - type env-build-win.yml + run: conda mambabuild --no-test --python ${{ matrix.python }} conda-recipe - name: Upload artifact uses: actions/upload-artifact@v3 - with: - name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} ${{ matrix.artifact_name }} - path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2 - - test_linux: - needs: build_linux - runs-on: ubuntu-20.04 - - strategy: - matrix: - python: ["3.8", "3.9", "3.10"] - numba: ["0.57"] - dpnp: ["0.11"] - - steps: - - name: Download artifact - uses: actions/download-artifact@v3 with: name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} + path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.tar.bz2 - - name: Checkout repo - uses: actions/checkout@v3 - with: - path: numba-dpex - - - name: Setup conda-build - uses: ./numba-dpex/.github/actions/setup-conda-build - - name: Create conda channel - run: | - mkdir -p $GITHUB_WORKSPACE/channel/linux-64 - mv ${PACKAGE_NAME}-*.tar.bz2 $GITHUB_WORKSPACE/channel/linux-64 - conda index $GITHUB_WORKSPACE/channel - # Test channel - conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels --info - - - name: Install numba-dpex - env: - CHANNELS: -c dppy/label/dev -c intel -c defaults -c numba -c numba/label/dev --override-channels - run: | - CHANNELS="-c $GITHUB_WORKSPACE/channel $CHANNELS" - conda list - conda create -n numba_dpex_env $PACKAGE_NAME pytest dpcpp_linux-64 python=${{ matrix.python }} numba=${{ matrix.numba }} dpctl dpnp=${{ matrix.dpnp }} dpcpp-llvm-spirv $CHANNELS - # Test installed packages - conda list + test: + name: Test ['${{ matrix.os }}', python='${{ matrix.python }}'] - - name: Check DPNP - run: | - source $CONDA/etc/profile.d/conda.sh - conda activate numba_dpex_env - python -c "import dpnp" + needs: build - - name: Check dpcpp-llvm-spirv - run: | - source $CONDA/etc/profile.d/conda.sh - conda activate numba_dpex_env - python -c "import dpcpp_llvm_spirv as p; print(p.get_llvm_spirv_path())" - - - name: Dump test linux conda environment - run: | - conda env export > /tmp/env-test-linux.yml - cat /tmp/env-test-linux.yml - - - name: Run tests - run: | - source $CONDA/etc/profile.d/conda.sh - conda activate numba_dpex_env - # echo "libintelocl.so" | tee /etc/OpenCL/vendors/intel-cpu.icd - pytest -q -ra --disable-warnings --pyargs $MODULE_NAME -vv - - - name: Run examples - run: | - ls - pwd - cd ./numba-dpex/numba_dpex/examples/ - source $CONDA/etc/profile.d/conda.sh - conda activate numba_dpex_env - # echo "libintelocl.so" | tee /etc/OpenCL/vendors/intel-cpu.icd - for script in $(find . \( -not -name "_*" -not -name "side-by-side*" -not -name "vectorize.py" -not -name "scan.py" -and -name "*.py" \)) - do - echo "Executing ${script}" - python ${script} || exit 1 - done + runs-on: ${{ matrix.os }} - test_windows: - needs: build_windows - runs-on: windows-latest + defaults: + run: + shell: ${{ matrix.os == 'windows-latest' && 'cmd /C CALL {0}' || 'bash -l {0}' }} strategy: + fail-fast: false matrix: - python: ["3.8", "3.9", "3.10"] - integration_channels: [""] - experimental: [false] # packages are not available on -c intel yet + python: ['3.8', '3.9', '3.10'] + os: [ubuntu-20.04, ubuntu-latest, windows-latest] + experimental: [false] + continue-on-error: ${{ matrix.experimental }} - env: - # conda-forge: llvm-spirv 11 not on intel channel yet - CHANNELS: -c dppy/label/dev -c intel -c defaults -c numba -c numba/label/dev --override-channels steps: - - name: Create dir for numba-dpex repo - run: | - mkdir -p ${{ github.workspace }}/dpex-repo - - - name: Checout repo - uses: actions/checkout@v3 + - name: Setup miniconda + uses: conda-incubator/setup-miniconda@v2 with: - path: dpex-repo - fetch-depth: 0 + python-version: ${{ matrix.python }} + miniforge-variant: Mambaforge + miniforge-version: latest + activate-environment: "test" + channels: ${{ env.CHANNELS }} + channel-priority: "disabled" + run-post: false + + - name: Disable defautls + run: conda config --remove channels defaults + + - name: Store conda paths as envs + shell: bash -l {0} + run: | + echo "CHANNEL_PATH=${{ github.workspace }}/channel/" | tr "\\" "/" >> $GITHUB_ENV + echo "EXTRACTED_PKG_PATH=${{ github.workspace }}/pkg/" | tr "\\" "/" >> $GITHUB_ENV + echo "VER_JSON_PATH=${{ github.workspace }}/version.json" | tr "\\" "/" >> $GITHUB_ENV + echo "PKG_PATH_IN_CHANNEL=${{ github.workspace }}/channel/${{ runner.os == 'Linux' && 'linux' || 'win' }}-64/" | tr "\\" "/" >> $GITHUB_ENV + echo "EXAMPLES_PATH=$CONDA_PREFIX/${{ runner.os == 'Linux' && format('lib/python{0}',matrix.python) || 'Lib' }}/site-packages/numba_dpex/examples/" | tr "\\" "/" >> $GITHUB_ENV - name: Download artifact uses: actions/download-artifact@v3 with: name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} + path: ${{ env.PKG_PATH_IN_CHANNEL }} - - name: Setup miniconda - uses: conda-incubator/setup-miniconda@v2 - with: - use-only-tar-bz2: true - auto-update-conda: true - conda-build-version: '*' - miniconda-version: 'latest' - activate-environment: "numba_dpex_wintest" + # We need --force-local because on windows path looks like C:/foo/bar + # and tar interprits semicolons as remote device. + - name: Extract package archive + shell: bash -l {0} + run: | + mkdir -p ${EXTRACTED_PKG_PATH} + tar -xvf ${PKG_PATH_IN_CHANNEL}${PACKAGE_NAME}-*.tar.bz2 -C ${EXTRACTED_PKG_PATH} --force-local + + - name: Install conda build + run: | + mamba install conda-build - name: Create conda channel run: | - mkdir -p $env: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 + conda index ${{ env.CHANNEL_PATH }} - - name: Collect dependencies - run: conda install ${{ env.PACKAGE_NAME }} python=${{ matrix.bpython }} -c $env:GITHUB_WORKSPACE/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile + - name: Test conda channel + run: | + mamba search ${{ env.PACKAGE_NAME }} -c ${{ env.CHANNEL_PATH }} --override-channels --info --json > ${{ env.VER_JSON_PATH }} + cat ${{ env.VER_JSON_PATH }} - - name: Cache conda packages - uses: actions/cache@v3 - env: - CACHE_NUMBER: 1 # Increase to reset cache - with: - path: /home/runner/conda_pkgs_dir - 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 numba-dpex + - name: Collect dependencies + shell: bash -l {0} run: | - conda install ${{ env.PACKAGE_NAME }} pytest dpcpp_win-64 dpcpp-llvm-spirv python=${{ matrix.python }} dpctl -c $env:GITHUB_WORKSPACE/channel ${{ env.CHANNELS }} - # Test installed packages - conda list + export PACKAGE_VERSION=$(python -c "${{ env.VER_SCRIPT1 }} ${{ env.VER_SCRIPT2 }}") + echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV - - name: Install opencl_rt - run: conda install opencl_rt -c intel --override-channels + # We want to make sure that all dependecies install automatically. + - name: Install builded package + run: mamba install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} opencl_rt pytest -c ${{ env.CHANNEL_PATH }} - - name: Add library + - name: Setup OpenCL CPU device + if: runner.os == 'Windows' shell: pwsh run: | $script_path="$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1" &$script_path - # Check the variable assisting OpenCL CPU driver to find TBB DLLs which are not located where it expects them by default - $cl_cfg="$env:CONDA_PREFIX\Library\lib\cl.cfg" - Get-Content -Tail 5 -Path $cl_cfg - - name: Add dpnp skip variable - run: echo "NUMBA_DPEX_TESTING_SKIP_NO_DPNP=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + - name: List installed packages + run: conda list - - name: Smoke test - run: python -c "import numba_dpex.core.runtime._dpexrt_python" - - - name: Smoke test for dpcpp-llvm-spirv - run: python -c "import dpcpp_llvm_spirv as p; print(p.get_llvm_spirv_path())" - - - name: Dump test windows conda environment + - name: Check dpcpp-llvm-spirv run: | - conda env export > env-test-win.yml - type env-test-win.yml + python -c "import dpcpp_llvm_spirv as p; print(p.get_llvm_spirv_path())" + + - name: Smoke test + run: python -c "import dpnp, dpctl, numba_dpex; dpctl.lsplatform()" - name: Run tests run: | pytest -q -ra --disable-warnings --pyargs ${{ env.MODULE_NAME }} -vv - upload_linux: - needs: test_linux + - name: Run examples + shell: bash -l {0} + run: | + cd ${{ env.EXAMPLES_PATH }} + for script in $(find . \( -not -name "_*" -not -name "side-by-side*" -not -name "vectorize.py" -not -name "scan.py" -and -name "*.py" \)) + do + echo "Executing ${script}" + python ${script} || exit 1 + done + + upload_anaconda: + name: Upload dppy/label/dev ['${{ matrix.os }}', python='${{ matrix.python }}'] if: ${{github.ref == 'refs/heads/main' || (startsWith(github.ref, 'refs/heads/release') == true)}} - runs-on: ubuntu-20.04 + + needs: [test] + strategy: matrix: - python: ["3.8", "3.9", "3.10"] - steps: - - name: Download artifact - uses: actions/download-artifact@v3 - with: - name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} + python: ['3.8', '3.9', '3.10'] + os: [ubuntu-latest, windows-latest] - - name: Setup miniconda - uses: conda-incubator/setup-miniconda@v2 - with: - auto-activate-base: true - activate-environment: "" + runs-on: ${{ matrix.os }} - - name: Install anaconda-client - run: conda install anaconda-client + defaults: + run: + shell: bash -l {0} - - name: Upload - env: - ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} - run: | - source /usr/share/miniconda/etc/profile.d/conda.sh - conda activate - anaconda --token $ANACONDA_TOKEN upload --user dppy --label dev ${PACKAGE_NAME}-*.tar.bz2 + continue-on-error: false - upload_windows: - needs: test_windows - if: ${{github.ref == 'refs/heads/main' || (startsWith(github.ref, 'refs/heads/release') == true)}} - runs-on: windows-latest - strategy: - matrix: - python: ["3.8", "3.9", "3.10"] steps: - name: Download artifact uses: actions/download-artifact@v3 @@ -325,14 +219,16 @@ jobs: - name: Setup miniconda uses: conda-incubator/setup-miniconda@v2 with: - auto-activate-base: true - activate-environment: "" + python-version: ${{ matrix.python }} + miniforge-variant: Mambaforge + miniforge-version: latest + activate-environment: "anaconda" + channels: ${{ env.CHANNELS }} + channel-priority: "disabled" + run-post: false - name: Install anaconda-client - run: conda install anaconda-client + run: mamba 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 + run: anaconda --token ${{ secrets.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ee1fbb0dd6..d615760451 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -12,7 +12,9 @@ jobs: main: name: Generate coverage and push to Coveralls.io runs-on: ubuntu-20.04 - + defaults: + run: + shell: bash -l {0} steps: - name: Cancel Previous Runs uses: styfle/cancel-workflow-action@0.9.1 @@ -24,10 +26,19 @@ jobs: with: fetch-depth: 0 - - name: Setup numba-dpex - uses: ./.github/actions/setup-numba-dpex + - uses: conda-incubator/setup-miniconda@v2 with: - environment: environment/coverage.yml + python-version: '3.10' + miniforge-variant: Mambaforge + miniforge-version: latest + activate-environment: "coverage" + channel-priority: "disabled" + environment-file: environment/coverage.yml + + - name: Build numba-dpex + run: | + export PATH=$CONDA/bin-llvm:$PATH + python setup.py develop - name: Test installation run: | diff --git a/.github/workflows/gh-pages-tags.yml b/.github/workflows/gh-pages-tags.yml deleted file mode 100644 index efd250d0ad..0000000000 --- a/.github/workflows/gh-pages-tags.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: GitHub Pages [Release, Tag] -on: - push: - branches: - - release* - tags: - - '[0-9]+.[0-9]+*' - -jobs: - main: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup numba-dpex - uses: ./.github/actions/setup-numba-dpex - with: - environment: environment/docs.yml - - - name: Make documentation - working-directory: docs - run: make html - - - name: Publish release - if: startsWith(github.ref, 'refs/heads/release') - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - destination_dir : next_release - publish_dir: docs/_build/html/ - allow_empty_commit : true - commit_message: ${{ github.event.head_commit.message }} - - - - name: Capture tag - id: capture_tag - if: startsWith(github.ref, 'refs/tags/') - run: | - echo "${GITHUB_REF#refs/heads/}" - echo "${GITHUB_REF#refs/tags/}" - echo ::set-output name=tag_number::${GITHUB_REF#refs/tags/} - - - name: Publish tag - if: startsWith(github.ref, 'refs/tags/') - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - destination_dir : ${{ steps.capture_tag.outputs.tag_number }} - publish_dir: docs/_build/html/ - allow_empty_commit : true - commit_message: ${{ github.event.head_commit.message }} diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 9dba355135..920881a652 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -3,6 +3,9 @@ on: push: branches: - main + - release* + tags: + - '[0-9]+.[0-9]+*' pull_request: types: [opened, synchronize, reopened, closed] paths: @@ -13,16 +16,29 @@ jobs: main: if: ${{ !(github.event.pull_request && github.event.action == 'closed') }} runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Setup numba-dpex - uses: ./.github/actions/setup-numba-dpex + - uses: conda-incubator/setup-miniconda@v2 with: - environment: environment/docs.yml + python-version: '3.10' + miniforge-variant: Mambaforge + miniforge-version: latest + activate-environment: "docs" + channels: conda-forge,nodefaults + channel-priority: "disabled" + environment-file: "environment/docs.yml" + + - name: Build numba-dpex + run: | + export PATH=$CONDA/bin-llvm:$PATH + python setup.py develop - name: Make documentation working-directory: docs @@ -58,13 +74,37 @@ jobs: if: ${{ github.event.pull_request && github.event.action != 'closed' }} env: PR_NUM: ${{ github.event.number }} - uses: mshick/add-pr-comment@v1 + uses: mshick/add-pr-comment@v2 with: message: | Documentation preview: [show](https://intelpython.github.io/numba-dpex/pull/${{ env.PR_NUM }}). - repo-token: ${{ secrets.GITHUB_TOKEN }} - repo-token-user-login: 'github-actions[bot]' - allow-repeats: true + # repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish release + if: startsWith(github.ref, 'refs/heads/release') + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + destination_dir : next_release + publish_dir: docs/_build/html/ + allow_empty_commit : true + commit_message: ${{ github.event.head_commit.message }} + + - name: Capture tag + id: capture_tag + if: startsWith(github.ref, 'refs/tags/') + run: | + echo ::set-output name=tag_number::${GITHUB_REF#refs/tags/} + + - name: Publish tag + if: startsWith(github.ref, 'refs/tags/') + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + destination_dir : ${{ steps.capture_tag.outputs.tag_number }} + publish_dir: docs/_build/html/ + allow_empty_commit : true + commit_message: ${{ github.event.head_commit.message }} clean: if: ${{ github.event.pull_request && github.event.action == 'closed' }} diff --git a/environment/coverage.yml b/environment/coverage.yml index d214b07a77..a950d49bf5 100644 --- a/environment/coverage.yml +++ b/environment/coverage.yml @@ -4,29 +4,20 @@ channels: - numba - intel - numba/label/dev - - pkgs/main + - conda-forge - nodefaults dependencies: - - python=3.9 - - defaults:libffi + - libffi - gxx_linux-64 - dpcpp_linux-64 - - numba 0.57* - - dppy/label/dev:dpctl - - dppy/label/dev:dpnp + - numba=0.57 + - dpctl + - dpnp - spirv-tools - dpcpp-llvm-spirv - - packaging + - opencl_rt + - coverage - pytest - - pip - - pip: - - coverage - - pre-commit - - flake8 - - black==20.8b1 - - pytest-cov - - pytest-xdist - - pexpect -variables: - CHANNELS: -c defaults -c numba -c intel -c numba/label/dev -c dppy/label/dev --override-channels - CHANNELS_DEV: -c dppy/label/dev -c defaults -c numba -c intel -c numba/label/dev --override-channels + - pytest-cov + - pytest-xdist + - pexpect diff --git a/environment/docs.yml b/environment/docs.yml index 7d0573c203..c394aca28c 100644 --- a/environment/docs.yml +++ b/environment/docs.yml @@ -3,29 +3,24 @@ channels: - dppy/label/dev - numba - intel + - numba/label/dev - conda-forge - nodefaults dependencies: - - python=3.10 + - libffi - gxx_linux-64 - dpcpp_linux-64 - - numba 0.57* - - dpctl 0.14* - - dpnp >=0.12* + - numba=0.57 + - dpctl + - dpnp - spirv-tools - dpcpp-llvm-spirv - - packaging - - pytest + - opencl_rt - pip - pip: - - coverage - - pre-commit - - flake8 - - black==20.8b1 - - pexpect - sphinx - - autodoc + - autodoc # there is no conda package - recommonmark - sphinx-rtd-theme - sphinxcontrib-apidoc - - sphinxcontrib-googleanalytics + - sphinxcontrib-googleanalytics # there is no conda package