From fd301849d3010c4ccde4f3cbccb3c06848dbc330 Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Mon, 14 Oct 2024 21:31:07 +0100 Subject: [PATCH] Test wheel builds during PR CI on demand Refactor the wheels-build and deployment workflow into one re-usable "build wheels" workflow and two orchestration workflows. The orchestration workflows are the existing "tag push" event, which also deploys the wheels to PyPI, and a new "PR" trigger that runs the all-wheels build if the PR is labelled with `ci: test wheels`. The deployment job is slightly reorganised so that all the "core" platforms build and deploy before the less common platforms even begin the build. The core platforms are all tier 1 platforms, the 32-bit platforms, and the sdist. These core platforms were already tied together, but the other platforms ran concurrently with them. This could lead to other projects' CI failing when Qiskit was part way through a deployment. The "other" wheels are all tied together in this PR mostly as a convenience to avoid repetition. They could easily be untied from each other (as the current state does). --- .github/workflows/wheels-build.yml | 242 +++++++++++++++++++++++++++++ .github/workflows/wheels-pr.yml | 23 +++ .github/workflows/wheels.yml | 222 +++++--------------------- 3 files changed, 301 insertions(+), 186 deletions(-) create mode 100644 .github/workflows/wheels-build.yml create mode 100644 .github/workflows/wheels-pr.yml diff --git a/.github/workflows/wheels-build.yml b/.github/workflows/wheels-build.yml new file mode 100644 index 000000000000..60bd3c4bb018 --- /dev/null +++ b/.github/workflows/wheels-build.yml @@ -0,0 +1,242 @@ +name: Build release artifacts +on: + workflow_call: + inputs: + default-action: + description: >- + The default action for each artifact. + Choose from 'build' (default) or 'skip'. + type: string + default: "build" + required: false + + sdist: + description: >- + The action to take for the sdist. + Choose from 'default', 'build' or 'skip'. + type: string + default: "default" + required: false + + wheels-tier-1: + description: >- + The action to take for Tier 1 wheels. + Choose from 'default', 'build' or 'skip'. + This builds multiple artifacts, which all match 'wheels-tier-1-*'. + type: string + default: "default" + required: false + + wheels-32bit: + description: >- + The action to take for Tier 1 wheels. + Choose from 'default', 'build' or 'skip'. + This builds multiple artifacts, which all match 'wheels-32bit-*'. + type: string + default: "default" + required: false + + wheels-linux-s390x: + description: >- + The action to take for Linux s390x wheels. + Choose from 'default', 'build' or 'skip'. + type: string + default: "default" + required: false + + wheels-linux-ppc64le: + description: >- + The action to take for Linux ppc64le wheels. + Choose from 'default', 'build' or 'skip'. + type: string + default: "default" + required: false + + wheels-linux-aarch64: + description: >- + The action to take for Linux AArch64 wheels. + Choose from 'default', 'build' or 'skip'. + type: string + default: "default" + required: false + + artifact-prefix: + description: "A prefix to give all artifacts uploaded with 'actions/upload-artifact'." + type: string + default: "" + required: false + + python-version: + description: "The Python version to use to host the build runner." + type: string + default: "3.10" + required: false + + pgo: + description: "Whether to enable PGO for supported platforms." + type: boolean + default: true + required: false + + +jobs: + wheels-tier-1: + name: "Wheels / Tier 1" + if: (inputs.wheels-tier-1 == 'default' && inputs.default-action || inputs.wheels-tier-1) == 'build' + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + # Used for the x86_64 builds. + - macos-12 + # Used for the ARM builds. + - macos-14 + - windows-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python-version }} + architecture: ${{ matrix.os == 'macos-14' && 'arm64' || 'x64' }} + - uses: dtolnay/rust-toolchain@stable + with: + components: llvm-tools-preview + - name: Configure PGO + shell: bash + if: inputs.pgo + # The `$GITHUB_ENV` magic file uses some sort of custom parsing, so the variables shouldn't + # be quoted like they would be if bash were interpreting them. You still need to use quotes + # to avoid word splitting where appropriate in compound environment variables. + # + # Beware that the heredoc is configured to expand bash variables, but cibuildwheel has + # special handling for certain variables (`$PATH`, in particular), so you may need to escape + # some dollar signs to pass those through to cibuildwheel as variables, not expanded. + run: | + cat >>"$GITHUB_ENV" <