From 26149fefeebe8471d4948f98b21b8d4c19353721 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Sun, 8 Nov 2026 19:19:18 +0100 Subject: [PATCH] Factor the Miniconda setup retry out into a local composite action Every conda job repeated the same pair of `conda-incubator/setup-miniconda` steps, a first attempt with `continue-on-error` and a `ReSetup miniconda` retry with identical inputs: 13 copies in 6 workflows, each pinning the action SHA twice. The new `.github/actions/setup-miniconda` action holds that pair once. Jobs pass only `miniforge-version`, `activate-environment` and either `environment-file` or `python-version` with `channels`; `use-mamba` and `conda-remove-defaults` were `'true'` everywhere and are fixed in the action. Related changes: - Jobs that check dpnp out into `source/` use the action from `./source/.github/actions/setup-miniconda`. - `cron-run-tests.yaml` had no checkout, so it gets a sparse one of `.github/actions`. - `cleanup_packages` checked `devops-tools` out over the dpnp tree, which would remove the action before its post step runs, so that checkout now goes to a `devops-tools/` subdirectory. - Dependabot scans `/.github/actions/*` too, so the moved pin keeps being bumped. - `.github/AGENTS.md` notes the action. --- .github/AGENTS.md | 1 + .github/actions/setup-miniconda/action.yml | 51 +++++++++++ .github/dependabot.yml | 5 +- .github/workflows/build-sphinx.yml | 16 +--- .github/workflows/check-onemath.yaml | 32 +------ .github/workflows/conda-build-test.yml | 32 +------ .github/workflows/conda-package.yml | 99 ++-------------------- .github/workflows/cron-run-tests.yaml | 24 ++---- .github/workflows/generate_coverage.yaml | 16 +--- 9 files changed, 79 insertions(+), 197 deletions(-) create mode 100644 .github/actions/setup-miniconda/action.yml diff --git a/.github/AGENTS.md b/.github/AGENTS.md index 6b807a17df70..ce9bce418c1c 100644 --- a/.github/AGENTS.md +++ b/.github/AGENTS.md @@ -8,6 +8,7 @@ These keep zizmor (`zizmor.yml`, fails on medium or higher findings) and the Ope - Never inline untrusted contexts (`github.event.*`, `github.head_ref`, `inputs.*`) in `run:`; pass them through `env:`. Prefer `env:` for every value in new code. - Every job sets `timeout-minutes`; for a job that calls a reusable workflow, set it inside the called workflow. - `actionlint` runs in pre-commit. +- Set up conda with the local `.github/actions/setup-miniconda` action, which retries a failed setup once, instead of calling `conda-incubator/setup-miniconda` directly; a job that checks dpnp out into a subdirectory uses it from there (`./source/.github/actions/setup-miniconda`). - `workflows/array-api-skips.txt` lists array-api-tests node IDs skipped by the conformance job; precede each with a comment naming the upstream issue. - `bump-sycl-deps.yml` rewrites the `DRIVER_PATH`, `OCLCPUEXP_FN`, `TBB_URL`, `TBB_INSTALL_DIR` and `TBB_FN` pins in `.github/sycl-build-deps.env` with `sed`, and `os-llvm-sycl-build.yml` reads exactly those five; keep one unquoted `KEY=VALUE` per line, starting at column 0. - Dependabot (`dependabot.yml`) bumps actions, `environments/` pins and pre-commit hooks weekly with a 7-day cooldown. diff --git a/.github/actions/setup-miniconda/action.yml b/.github/actions/setup-miniconda/action.yml new file mode 100644 index 000000000000..29d2b8174baf --- /dev/null +++ b/.github/actions/setup-miniconda/action.yml @@ -0,0 +1,51 @@ +name: Set up Miniconda +description: Install Miniforge and create the conda environment, retrying once on failure + +inputs: + miniforge-version: + description: Miniforge version to install + required: true + activate-environment: + description: Name of the conda environment to create and activate + required: true + environment-file: + description: Environment file to create the environment from + required: false + default: '' + python-version: + description: Python version to install into the environment + required: false + default: '' + channels: + description: Comma-separated list of conda channels + required: false + default: '' + +runs: + using: composite + steps: + # A transient network or solver error fails the first attempt now and then + - name: Setup miniconda + id: setup_miniconda + continue-on-error: true + uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 + with: + miniforge-version: ${{ inputs.miniforge-version }} + use-mamba: 'true' + conda-remove-defaults: 'true' + environment-file: ${{ inputs.environment-file }} + python-version: ${{ inputs.python-version }} + channels: ${{ inputs.channels }} + activate-environment: ${{ inputs.activate-environment }} + + - name: ReSetup miniconda + if: steps.setup_miniconda.outcome == 'failure' + uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 + with: + miniforge-version: ${{ inputs.miniforge-version }} + use-mamba: 'true' + conda-remove-defaults: 'true' + environment-file: ${{ inputs.environment-file }} + python-version: ${{ inputs.python-version }} + channels: ${{ inputs.channels }} + activate-environment: ${{ inputs.activate-environment }} diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 7af8cbab0077..21a03dbf3ce4 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,7 +1,10 @@ version: 2 updates: - package-ecosystem: "github-actions" - directory: "/" + # "/" covers .github/workflows only; local composite actions need their own entry + directories: + - "/" + - "/.github/actions/*" schedule: interval: "weekly" day: "saturday" diff --git a/.github/workflows/build-sphinx.yml b/.github/workflows/build-sphinx.yml index 11f3d6c74f2c..e8f61235d16c 100644 --- a/.github/workflows/build-sphinx.yml +++ b/.github/workflows/build-sphinx.yml @@ -113,23 +113,9 @@ jobs: cat ${{ env.environment-file }} - name: Setup miniconda - id: setup_miniconda - continue-on-error: true - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 + uses: ./.github/actions/setup-miniconda with: miniforge-version: ${{ env.MINIFORGE_VERSION }} - use-mamba: 'true' - conda-remove-defaults: 'true' - environment-file: ${{ env.environment-file }} - activate-environment: 'docs' - - - name: ReSetup miniconda - if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 - with: - miniforge-version: ${{ env.MINIFORGE_VERSION }} - use-mamba: 'true' - conda-remove-defaults: 'true' environment-file: ${{ env.environment-file }} activate-environment: 'docs' diff --git a/.github/workflows/check-onemath.yaml b/.github/workflows/check-onemath.yaml index 544367ae8197..6790d4caaa1e 100644 --- a/.github/workflows/check-onemath.yaml +++ b/.github/workflows/check-onemath.yaml @@ -126,23 +126,9 @@ jobs: path: ${{ env.environment-file-loc }} - name: Setup miniconda - id: setup_miniconda - continue-on-error: true - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 + uses: ./.github/actions/setup-miniconda with: miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' - environment-file: ${{ env.environment-file }} - activate-environment: ${{ env.test-env-name }} - - - name: ReSetup miniconda - if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 - with: - miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' environment-file: ${{ env.environment-file }} activate-environment: ${{ env.test-env-name }} @@ -262,23 +248,9 @@ jobs: ls -la ${{ env.onemkl-source-dir }} - name: Setup miniconda - id: setup_miniconda - continue-on-error: true - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 - with: - miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' - environment-file: ${{ env.environment-file }} - activate-environment: ${{ env.test-env-name }} - - - name: ReSetup miniconda - if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 + uses: ./.github/actions/setup-miniconda with: miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' environment-file: ${{ env.environment-file }} activate-environment: ${{ env.test-env-name }} diff --git a/.github/workflows/conda-build-test.yml b/.github/workflows/conda-build-test.yml index 77a934a15981..bc6a187ef95a 100644 --- a/.github/workflows/conda-build-test.yml +++ b/.github/workflows/conda-build-test.yml @@ -79,23 +79,9 @@ jobs: filter: blob:none - name: Setup miniconda - id: setup_miniconda - continue-on-error: true - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 - with: - miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' - environment-file: ${{ env.build-conda-pkg-env }} - activate-environment: ${{ env.build-env-name }} - - - name: ReSetup miniconda - if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 + uses: ./.github/actions/setup-miniconda with: miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' environment-file: ${{ env.build-conda-pkg-env }} activate-environment: ${{ env.build-env-name }} @@ -191,23 +177,9 @@ jobs: path: ${{ env.pkg-path-in-channel }} - name: Setup miniconda - id: setup_miniconda - continue-on-error: true - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 - with: - miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' - environment-file: ${{ env.create-conda-channel-env }} - activate-environment: ${{ env.test-env-name }} - - - name: ReSetup miniconda - if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 + uses: ./source/.github/actions/setup-miniconda with: miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' environment-file: ${{ env.create-conda-channel-env }} activate-environment: ${{ env.test-env-name }} diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index 4fc22b5b4676..a88ef263211f 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -208,23 +208,9 @@ jobs: path: ${{ env.pkg-path-in-channel }} - name: Setup miniconda - id: setup_miniconda - continue-on-error: true - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 + uses: ./source/.github/actions/setup-miniconda with: miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' - environment-file: ${{ env.create-conda-channel-env }} - activate-environment: ${{ env.test-env-name }} - - - name: ReSetup miniconda - if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 - with: - miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' environment-file: ${{ env.create-conda-channel-env }} activate-environment: ${{ env.test-env-name }} @@ -363,23 +349,9 @@ jobs: path: ${{ env.pkg-path-in-channel }} - name: Setup miniconda - id: setup_miniconda - continue-on-error: true - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 - with: - miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' - environment-file: ${{ env.examples-conda-pkg-env }} - activate-environment: ${{ env.examples-env-name }} - - - name: ReSetup miniconda - if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 + uses: ./source/.github/actions/setup-miniconda with: miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' environment-file: ${{ env.examples-conda-pkg-env }} activate-environment: ${{ env.examples-env-name }} @@ -497,23 +469,9 @@ jobs: (echo FULL_PACKAGE_PATH=%FULL_PACKAGE_PATH%) >> %GITHUB_ENV% - name: Setup miniconda - id: setup_miniconda - continue-on-error: true - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 - with: - miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' - environment-file: ${{ env.create-conda-channel-env }} - activate-environment: ${{ env.test-env-name }} - - - name: ReSetup miniconda - if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 + uses: ./source/.github/actions/setup-miniconda with: miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' environment-file: ${{ env.create-conda-channel-env }} activate-environment: ${{ env.test-env-name }} @@ -692,23 +650,9 @@ jobs: name: ${{ env.package-name }} ${{ runner.os }} Wheels Python ${{ env.python-label }} - name: Setup miniconda - id: setup_miniconda - continue-on-error: true - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 + uses: ./.github/actions/setup-miniconda with: miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' - environment-file: ${{ env.upload-conda-pkg-env }} - activate-environment: ${{ env.upload-env-name }} - - - name: ReSetup miniconda - if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 - with: - miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' environment-file: ${{ env.upload-conda-pkg-env }} activate-environment: ${{ env.upload-env-name }} @@ -773,23 +717,9 @@ jobs: path: ${{ env.pkg-path-in-channel }} - name: Setup miniconda - id: setup_miniconda - continue-on-error: true - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 - with: - miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' - environment-file: ${{ env.create-conda-channel-env }} - activate-environment: ${{ env.conda-env-name }} - - - name: ReSetup miniconda - if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 + uses: ./source/.github/actions/setup-miniconda with: miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' environment-file: ${{ env.create-conda-channel-env }} activate-environment: ${{ env.conda-env-name }} @@ -924,34 +854,23 @@ jobs: fetch-depth: ${{ env.fetch-depth }} - name: Setup miniconda - id: setup_miniconda - continue-on-error: true - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 - with: - miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' - environment-file: ${{ env.cleanup-conda-pkg-env }} - activate-environment: ${{ env.cleanup-env-name }} - - - name: ReSetup miniconda - if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 + uses: ./.github/actions/setup-miniconda with: miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' environment-file: ${{ env.cleanup-conda-pkg-env }} activate-environment: ${{ env.cleanup-env-name }} + # A subdirectory keeps the setup-miniconda action in place for its post step - name: Checkout repo uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false repository: IntelPython/devops-tools fetch-depth: ${{ env.fetch-depth }} + path: devops-tools - name: Cleanup old packages + working-directory: devops-tools run: | python scripts/cleanup-old-packages.py \ --verbose --force --token "${ANACONDA_TOKEN}" \ diff --git a/.github/workflows/cron-run-tests.yaml b/.github/workflows/cron-run-tests.yaml index b832ebbec610..b450d2160ef0 100644 --- a/.github/workflows/cron-run-tests.yaml +++ b/.github/workflows/cron-run-tests.yaml @@ -75,27 +75,19 @@ jobs: run: | echo "Latest tag is ${{ steps.find_latest_tag.outputs.tag }}" - - name: Setup miniconda - id: setup_miniconda - continue-on-error: true - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 + # Only for the local setup-miniconda action; the tests run from the installed package + - name: Checkout DPNP repo + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: - miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - channels: conda-forge - conda-remove-defaults: 'true' - python-version: ${{ matrix.python }} - activate-environment: ${{ env.test-env-name }} + persist-credentials: false + sparse-checkout: .github/actions - - name: ReSetup miniconda - if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 + - name: Setup miniconda + uses: ./.github/actions/setup-miniconda with: miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - channels: conda-forge - conda-remove-defaults: 'true' python-version: ${{ matrix.python }} + channels: conda-forge activate-environment: ${{ env.test-env-name }} - name: Install OCL CPU RT from Intel channel diff --git a/.github/workflows/generate_coverage.yaml b/.github/workflows/generate_coverage.yaml index 3978b68cb038..e5b779fd1b59 100644 --- a/.github/workflows/generate_coverage.yaml +++ b/.github/workflows/generate_coverage.yaml @@ -77,23 +77,9 @@ jobs: cat ${{ env.environment-file }} - name: Setup miniconda - id: setup_miniconda - continue-on-error: true - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 + uses: ./.github/actions/setup-miniconda with: miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' - environment-file: ${{ env.environment-file }} - activate-environment: 'coverage' - - - name: ReSetup miniconda - if: steps.setup_miniconda.outcome == 'failure' - uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0 - with: - miniforge-version: ${{ env.miniforge-version }} - use-mamba: 'true' - conda-remove-defaults: 'true' environment-file: ${{ env.environment-file }} activate-environment: 'coverage'