From 4b21f4c9aa1731fe7c3ad7f8a80992ddd617aa8f Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 13 Jan 2025 19:59:35 +0100 Subject: [PATCH 1/3] Add environment file to build docs workflow --- .github/workflows/build-sphinx.yml | 52 ++++++++++-------------------- environments/base_build_docs.txt | 3 ++ environments/base_build_docs.yml | 18 +++++++++++ environments/build_pkgs.yml | 8 +++++ 4 files changed, 46 insertions(+), 35 deletions(-) create mode 100644 environments/base_build_docs.txt create mode 100644 environments/base_build_docs.yml create mode 100644 environments/build_pkgs.yml diff --git a/.github/workflows/build-sphinx.yml b/.github/workflows/build-sphinx.yml index 62a50b1d029..5dad027148c 100644 --- a/.github/workflows/build-sphinx.yml +++ b/.github/workflows/build-sphinx.yml @@ -36,11 +36,11 @@ jobs: pull-requests: write env: - python-ver: '3.12' - CHANNELS: '-c dppy/label/dev -c intel -c conda-forge --override-channels' - NO_INTEL_CHANNELS: '-c dppy/label/dev -c conda-forge --override-channels' - # Install the latest oneAPI compiler to work around an issue - INSTALL_ONE_API: 'yes' + environment-file: 'environments/environment.yml' + base-doc-env: 'environments/base_build_docs.yml' + build-pkgs-env: '' + # Enable env when it's required to use only conda packages without OneAPI installation + # build-pkgs-env: 'environments/build_pkgs.yml' steps: - name: Cancel Previous Runs @@ -101,6 +101,16 @@ jobs: with: fetch-depth: 0 + - name: Install conda-merge tool + uses: BSFishy/pip-action@8f2d471d809dc20b6ada98c91910b6ae6243f318 # v1 + with: + packages: conda-merge + + - name: Merge conda env files + run: | + conda-merge ${{ env.base-doc-env }} ${{ env.build-pkgs-env }} > ${{ env.environment-file }} + cat ${{ env.environment-file }} + - name: Setup miniconda id: setup_miniconda continue-on-error: true @@ -108,9 +118,8 @@ jobs: with: miniforge-version: latest use-mamba: 'true' - channels: conda-forge conda-remove-defaults: 'true' - python-version: ${{ env.python-ver }} + environment-file: '${{ env.environment-file }}' activate-environment: 'docs' - name: ReSetup miniconda @@ -119,35 +128,10 @@ jobs: with: miniforge-version: latest use-mamba: 'true' - channels: conda-forge conda-remove-defaults: 'true' - python-version: ${{ env.python-ver }} + environment-file: '${{ env.environment-file }}' activate-environment: 'docs' - # Sometimes `mamba install ...` fails due to slow download speed rate, so disable the check in mamba - - name: Disable speed limit check in mamba - run: echo "MAMBA_NO_LOW_SPEED_LIMIT=1" >> $GITHUB_ENV - - - name: Install sphinx dependencies - run: | - mamba install sphinx sphinx_rtd_theme - pip install sphinxcontrib-googleanalytics==0.4 \ - pyenchant sphinxcontrib-spelling - - - name: Install dpnp dependencies - if: env.INSTALL_ONE_API == 'yes' - run: | - mamba install numpy dpctl">=0.18.0dev0" cmake cython pytest ninja scikit-build ${{ env.NO_INTEL_CHANNELS }} - - - name: Install dpnp dependencies - if: env.INSTALL_ONE_API != 'yes' - run: | - mamba install numpy dpctl">=0.18.0dev0" mkl-devel-dpcpp onedpl-devel tbb-devel dpcpp_linux-64 \ - cmake cython pytest ninja scikit-build ${{ env.CHANNELS }} - - - name: Install cuPy dependencies - run: mamba install cupy - - name: Conda info run: mamba info @@ -178,7 +162,6 @@ jobs: echo PROJECT_NUMBER=${PROJECT_NUMBER} echo "PROJECT_NUMBER=$PROJECT_NUMBER" >> $GITHUB_ENV - # https://github.com/marketplace/actions/doxygen-action - name: Build backend docs uses: mattnotmitt/doxygen-action@cbe72c8e402e8a3faa1f0b247ef90aa6c8e4ce74 # v1.9.8 with: @@ -187,7 +170,6 @@ jobs: - name: Copy backend docs run: cp -r dpnp/backend/doc/html ${{ env.PUBLISH_DIR }}/backend_doc - # https://github.com/marketplace/actions/github-pages-action # The step is only used to build docs while pushing a PR to "master" - name: Deploy docs if: env.GH_EVENT_PUSH_UPSTREAM == 'true' diff --git a/environments/base_build_docs.txt b/environments/base_build_docs.txt new file mode 100644 index 00000000000..edab09ee45a --- /dev/null +++ b/environments/base_build_docs.txt @@ -0,0 +1,3 @@ +pyenchant==3.2.2 +sphinxcontrib-googleanalytics==0.4 +sphinxcontrib-spelling==8.0.1 diff --git a/environments/base_build_docs.yml b/environments/base_build_docs.yml new file mode 100644 index 00000000000..1f59c81b32b --- /dev/null +++ b/environments/base_build_docs.yml @@ -0,0 +1,18 @@ +name: Base building docs env +channels: + - dppy/label/dev + - conda-forge +dependencies: + - python=3.12 + - cmake + - cupy + - cython + - dpctl>=0.19.0dev0 + - ninja + - numpy + - pytest + - scikit-build + - sphinx + - sphinx_rtd_theme + - pip: + - -r base_build_docs.txt diff --git a/environments/build_pkgs.yml b/environments/build_pkgs.yml new file mode 100644 index 00000000000..d2f53a5ea7f --- /dev/null +++ b/environments/build_pkgs.yml @@ -0,0 +1,8 @@ +name: Packages to build DPNP +channels: + - https://software.repos.intel.com/python/conda/ +dependencies: + - dpcpp_linux-64 + - mkl-devel-dpcpp + - onedpl-devel + - tbb-devel From 3dd57a6bcc20a49f674f12ce6efda135a4af9901 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Tue, 14 Jan 2025 13:48:22 +0100 Subject: [PATCH 2/3] Add environment file to coverage workflow --- .github/workflows/build-sphinx.yml | 9 +-- .github/workflows/generate_coverage.yaml | 67 ++++++++----------- ...e_build_docs.yml => build_with_oneapi.yml} | 8 +-- environments/building_docs.yml | 10 +++ environments/coverage.txt | 1 + environments/coverage.yml | 10 +++ .../{build_pkgs.yml => oneapi_pkgs.yml} | 2 +- 7 files changed, 57 insertions(+), 50 deletions(-) rename environments/{base_build_docs.yml => build_with_oneapi.yml} (54%) create mode 100644 environments/building_docs.yml create mode 100644 environments/coverage.txt create mode 100644 environments/coverage.yml rename environments/{build_pkgs.yml => oneapi_pkgs.yml} (69%) diff --git a/.github/workflows/build-sphinx.yml b/.github/workflows/build-sphinx.yml index 5dad027148c..8376f702f1a 100644 --- a/.github/workflows/build-sphinx.yml +++ b/.github/workflows/build-sphinx.yml @@ -37,10 +37,11 @@ jobs: env: environment-file: 'environments/environment.yml' - base-doc-env: 'environments/base_build_docs.yml' - build-pkgs-env: '' + build-with-oneapi-env: 'environments/build_with_oneapi.yml' + building-docs-env: 'environments/building_docs.yml' + oneapi-pkgs-env: '' # Enable env when it's required to use only conda packages without OneAPI installation - # build-pkgs-env: 'environments/build_pkgs.yml' + # oneapi-pkgs-env: 'environments/oneapi_pkgs.yml' steps: - name: Cancel Previous Runs @@ -108,7 +109,7 @@ jobs: - name: Merge conda env files run: | - conda-merge ${{ env.base-doc-env }} ${{ env.build-pkgs-env }} > ${{ env.environment-file }} + conda-merge ${{ env.build-with-oneapi-env }} ${{ env.building-docs-env }} ${{ env.oneapi-pkgs-env }} > ${{ env.environment-file }} cat ${{ env.environment-file }} - name: Setup miniconda diff --git a/.github/workflows/generate_coverage.yaml b/.github/workflows/generate_coverage.yaml index 0ad572a9360..131134ef91e 100644 --- a/.github/workflows/generate_coverage.yaml +++ b/.github/workflows/generate_coverage.yaml @@ -20,11 +20,12 @@ jobs: shell: bash -el {0} env: - python-ver: '3.12' - CHANNELS: '-c dppy/label/dev -c intel -c conda-forge --override-channels' - NO_INTEL_CHANNELS: '-c dppy/label/dev -c conda-forge --override-channels' - # Install the latest oneAPI compiler to work around an issue - INSTALL_ONE_API: 'yes' + environment-file: 'environments/environment.yml' + build-with-oneapi-env: 'environments/build_with_oneapi.yml' + coverage-env: 'environments/coverage.yml' + oneapi-pkgs-env: '' + # Enable env when it's required to use only conda packages without OneAPI installation + # oneapi-pkgs-env: 'environments/oneapi_pkgs.yml' steps: - name: Cancel Previous Runs @@ -32,13 +33,7 @@ jobs: with: access_token: ${{ github.token }} - - name: Checkout repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 - - name: Add Intel repository - if: env.INSTALL_ONE_API == 'yes' run: | wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB cat GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null @@ -47,7 +42,6 @@ jobs: sudo apt update - name: Install latest Intel OneAPI - if: env.INSTALL_ONE_API == 'yes' run: | sudo apt install hwloc \ intel-oneapi-mkl \ @@ -60,6 +54,22 @@ jobs: - name: Install Lcov run: | sudo apt-get install lcov + sudo gem install coveralls-lcov + + - name: Checkout repo + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + + - name: Install conda-merge tool + uses: BSFishy/pip-action@8f2d471d809dc20b6ada98c91910b6ae6243f318 # v1 + with: + packages: conda-merge + + - name: Merge conda env files + run: | + conda-merge ${{ env.build-with-oneapi-env }} ${{ env.coverage-env }} ${{ env.oneapi-pkgs-env }} > ${{ env.environment-file }} + cat ${{ env.environment-file }} - name: Setup miniconda id: setup_miniconda @@ -68,9 +78,8 @@ jobs: with: miniforge-version: latest use-mamba: 'true' - channels: conda-forge conda-remove-defaults: 'true' - python-version: ${{ env.python-ver }} + environment-file: '${{ env.environment-file }}' activate-environment: 'coverage' - name: ReSetup miniconda @@ -79,27 +88,10 @@ jobs: with: miniforge-version: latest use-mamba: 'true' - channels: conda-forge conda-remove-defaults: 'true' - python-version: ${{ env.python-ver }} + environment-file: '${{ env.environment-file }}' activate-environment: 'coverage' - # Sometimes `mamba install ...` fails due to slow download speed rate, so disable the check in mamba - - name: Disable speed limit check in mamba - run: echo "MAMBA_NO_LOW_SPEED_LIMIT=1" >> $GITHUB_ENV - - - name: Install dpnp dependencies - if: env.INSTALL_ONE_API == 'yes' - run: | - mamba install cython llvm cmake">=3.21" scikit-build ninja pytest pytest-cov coverage[toml] \ - dpctl">=0.18.0dev0" ${{ env.NO_INTEL_CHANNELS }} - - - name: Install dpnp dependencies - if: env.INSTALL_ONE_API != 'yes' - run: | - mamba install cython llvm cmake">=3.21" scikit-build ninja pytest pytest-cov coverage[toml] \ - dpctl">=0.18.0dev0" dpcpp_linux-64 mkl-devel-dpcpp tbb-devel onedpl-devel ${{ env.CHANNELS }} - - name: Conda info run: | mamba info @@ -122,12 +114,7 @@ jobs: - name: Total number of coverage attempts run: | - echo "Total number of coverage attempts made: ${{ steps.build_coverage.outputs.total_attempts }}" - - - name: Install coverall dependencies - run: | - sudo gem install coveralls-lcov - pip install coveralls==4.0.1 + echo "Total number of coverage attempts: ${{ steps.build_coverage.outputs.total_attempts }}" - name: Upload coverage data to coveralls.io run: | @@ -144,9 +131,13 @@ jobs: coveralls: name: Indicate completion to coveralls.io + needs: generate-coverage + runs-on: ubuntu-latest + container: python:3-slim + steps: - name: Finished run: | diff --git a/environments/base_build_docs.yml b/environments/build_with_oneapi.yml similarity index 54% rename from environments/base_build_docs.yml rename to environments/build_with_oneapi.yml index 1f59c81b32b..715023ee48d 100644 --- a/environments/base_build_docs.yml +++ b/environments/build_with_oneapi.yml @@ -1,18 +1,12 @@ -name: Base building docs env +name: Packages to build DPNP with OneAPI env activated channels: - dppy/label/dev - conda-forge dependencies: - - python=3.12 - cmake - - cupy - cython - dpctl>=0.19.0dev0 - ninja - numpy - pytest - scikit-build - - sphinx - - sphinx_rtd_theme - - pip: - - -r base_build_docs.txt diff --git a/environments/building_docs.yml b/environments/building_docs.yml new file mode 100644 index 00000000000..2d452ddf3e4 --- /dev/null +++ b/environments/building_docs.yml @@ -0,0 +1,10 @@ +name: Building docs specific packages +channels: + - conda-forge +dependencies: + - python=3.12 + - cupy + - sphinx + - sphinx_rtd_theme + - pip: + - -r base_build_docs.txt diff --git a/environments/coverage.txt b/environments/coverage.txt new file mode 100644 index 00000000000..12f4cc07e1f --- /dev/null +++ b/environments/coverage.txt @@ -0,0 +1 @@ +coveralls==4.0.1 diff --git a/environments/coverage.yml b/environments/coverage.yml new file mode 100644 index 00000000000..0fcc8d82129 --- /dev/null +++ b/environments/coverage.yml @@ -0,0 +1,10 @@ +name: Coverage specific packages +channels: + - conda-forge +dependencies: + - python=3.12 + - coverage[toml] + - llvm + - pytest-cov + - pip: + - -r coverage.txt diff --git a/environments/build_pkgs.yml b/environments/oneapi_pkgs.yml similarity index 69% rename from environments/build_pkgs.yml rename to environments/oneapi_pkgs.yml index d2f53a5ea7f..8882c82fdc7 100644 --- a/environments/build_pkgs.yml +++ b/environments/oneapi_pkgs.yml @@ -1,4 +1,4 @@ -name: Packages to build DPNP +name: OneAPI packages to build DPNP without OneAPI env activated channels: - https://software.repos.intel.com/python/conda/ dependencies: From 469f6333f5e4db884c2e433b6e60115e09e33a1d Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 20 Jan 2025 17:29:28 +0100 Subject: [PATCH 3/3] Specify message-id per mshick/add-pr-comment step --- .github/workflows/build-sphinx.yml | 1 + .github/workflows/conda-package.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-sphinx.yml b/.github/workflows/build-sphinx.yml index 8376f702f1a..9858f146220 100644 --- a/.github/workflows/build-sphinx.yml +++ b/.github/workflows/build-sphinx.yml @@ -206,6 +206,7 @@ jobs: PR_NUM: ${{ github.event.number }} uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2 with: + message-id: url_to_docs message: | View rendered docs @ https://intelpython.github.io/dpnp/pull/${{ env.PR_NUM }}/index.html allow-repeats: false diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index c284c173e9d..7e617c241f2 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -612,9 +612,9 @@ jobs: if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork }} uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2 with: + message-id: array_api_results message: | ${{ env.MESSAGE }} - refresh-message-position: true cleanup_packages: name: Clean up anaconda packages