diff --git a/.github/AGENTS.md b/.github/AGENTS.md index 1ea5ae37ea0..7c041f1dbe5 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. - Every write to `gh-pages` (`build-sphinx.yml`, `prune-pr-docs.yml`) goes through `.github/scripts/update_gh_pages.sh`, which retries a push rejected by a concurrent writer; don't push to `gh-pages` any other way. diff --git a/.github/actions/setup-miniconda/action.yml b/.github/actions/setup-miniconda/action.yml new file mode 100644 index 00000000000..29d2b8174ba --- /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 4bf5234ec7a..f79ab62c047 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 380cd9f7e2c..c2df4c15e71 100644 --- a/.github/workflows/build-sphinx.yml +++ b/.github/workflows/build-sphinx.yml @@ -105,23 +105,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 ab09f12ab2e..e9b53dba708 100644 --- a/.github/workflows/check-onemath.yaml +++ b/.github/workflows/check-onemath.yaml @@ -135,23 +135,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 }} @@ -273,23 +259,9 @@ jobs: ls -la ${{ env.onemath-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 77a934a1598..bc6a187ef95 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 61410f9b3ec..e5ee385a2b5 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 }} @@ -691,23 +649,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 }} @@ -772,23 +716,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 }} @@ -911,34 +841,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 3b2e42aa73d..4b6f7a56fad 100644 --- a/.github/workflows/cron-run-tests.yaml +++ b/.github/workflows/cron-run-tests.yaml @@ -74,27 +74,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 3978b68cb03..e5b779fd1b5 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'