Skip to content

Commit

Permalink
Merge branch 'main' into qasm3/tweak-performance
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelishman authored Nov 1, 2024
2 parents 44d3b2f + 667ee8e commit 87bf820
Show file tree
Hide file tree
Showing 396 changed files with 17,268 additions and 4,962 deletions.
25 changes: 2 additions & 23 deletions .azure/lint_docs_qpy-linux.yml → .azure/lint_docs-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ parameters:
displayName: "Version of Python to use"

jobs:
- job: 'Lint_Docs_QPY'
displayName: 'Lint, documentation and QPY'
- job: 'Lint_Docs'
displayName: 'Lint and documentation'
pool: {vmImage: 'ubuntu-latest'}

variables:
Expand Down Expand Up @@ -43,24 +43,3 @@ jobs:
artifactName: 'html_docs'
Parallel: true
ParallelCount: 8

- task: Cache@2
inputs:
key: 'qpy | test/qpy_compat/test_qpy.py | "$(Build.BuildNumber)"'
restoreKeys: |
qpy | test/qpy_compat/test_qpy.py
path: qpy_files
displayName: Cache old QPY files

- bash: |
set -e
# Reuse the docs environment to avoid needing to rebuild another
# version of Qiskit.
source .tox/docs/bin/activate
mv qpy_files/* test/qpy_compat || :
pushd test/qpy_compat
./run_tests.sh
popd
mkdir -p qpy_files
mv test/qpy_compat/qpy_* qpy_files/.
displayName: 'Run QPY backwards compat tests'
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
lcov --add-tracefile python.info --add-tracefile rust.info --output-file coveralls.info
- name: Coveralls
uses: coverallsapp/github-action@v2.3.0
uses: coverallsapp/github-action@v2.3.4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coveralls.info
39 changes: 39 additions & 0 deletions .github/workflows/qpy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: QPY

on:
push:
branches:
- 'main'
- 'stable/*'
pull_request:
merge_group:
concurrency:
group: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
backward_compat:
if: github.repository_owner == 'Qiskit'
name: Backwards compatibility
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.9'

- uses: dtolnay/rust-toolchain@stable

- uses: actions/cache@v4
with:
path: test/qpy_compat/qpy_cache
# The hashing is this key can be too eager to invalidate the cache,
# but since we risk the QPY tests failing to update if they're not in
# sync, it's better safe than sorry.
key: qpy-${{ hashFiles('test/qpy_compat/**') }}

- name: Run QPY backwards compatibility tests
working-directory: test/qpy_compat
run: ./run_tests.sh
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
matrix:
# Normally we test min and max version but we can't run python
# 3.9 on arm64 until actions/setup-python#808 is resolved
python-version: ["3.10", "3.12"]
python-version: ["3.10", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
Expand All @@ -44,7 +44,7 @@ jobs:
python -m pip install -U -r requirements.txt -c constraints.txt
python -m pip install -U -r requirements-dev.txt -c constraints.txt
python -m pip install -c constraints.txt -e .
if: matrix.python-version == '3.12'
if: matrix.python-version == '3.13'
- name: 'Install optionals'
run: |
python -m pip install -r requirements-optional.txt -c constraints.txt
Expand Down
247 changes: 247 additions & 0 deletions .github/workflows/wheels-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
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 profile-guided optimizations 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, or use single quotes
# to prevent shell expansion.
run: |
set -e
mkdir -p "$PGO_WORK_DIR"
cat >>"$GITHUB_ENV" <<EOF
CIBW_BEFORE_BUILD=bash ./tools/build_pgo.sh $PGO_WORK_DIR $PGO_OUT_PATH
CIBW_ENVIRONMENT=RUSTUP_TOOLCHAIN=stable RUSTFLAGS='-Cprofile-use=$PGO_OUT_PATH -Cllvm-args=-pgo-warn-missing-function'
CIBW_ENVIRONMENT_LINUX=RUSTUP_TOOLCHAIN=stable RUSTFLAGS='-Cprofile-use=$PGO_OUT_PATH -Cllvm-args=-pgo-warn-missing-function' PATH="\$PATH:\$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI="true"
EOF
env:
PGO_WORK_DIR: ${{ github.workspace }}/pgo-data
PGO_OUT_PATH: ${{ github.workspace }}/merged.profdata
- uses: pypa/cibuildwheel@v2.21.3
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: ${{ inputs.artifact-prefix }}wheels-tier-1-${{ matrix.os }}

wheels-32bit:
name: "Wheels / 32bit"
if: (inputs.wheels-32bit == 'default' && inputs.default-action || inputs.wheels-32bit) == 'build'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_SKIP: 'pp* cp36-* cp37-* cp38-* *musllinux* *amd64 *x86_64'
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: ${{ inputs.artifact-prefix }}wheels-32bit-${{ matrix.os }}

wheels-linux-s390x:
name: "Wheels / Linux s390x"
if: (inputs.wheels-linux-s390x == 'default' && inputs.default-action || inputs.wheels-linux-s390x) == 'build'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: ${{ inputs.python-version }}
- uses: dtolnay/rust-toolchain@stable
- uses: docker/setup-qemu-action@v3
with:
platforms: all
- uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_ARCHS_LINUX: s390x
CIBW_TEST_SKIP: "cp*"
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: ${{ inputs.artifact-prefix }}wheels-linux-s390x

wheels-linux-ppc64le:
name: "Wheels / Linux ppc64le"
if: (inputs.wheels-linux-ppc64le == 'default' && inputs.default-action || inputs.wheels-linux-ppc64le) == 'build'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: ${{ inputs.python-version }}
- uses: dtolnay/rust-toolchain@stable
- uses: docker/setup-qemu-action@v3
with:
platforms: all
- uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_ARCHS_LINUX: ppc64le
CIBW_TEST_SKIP: "cp*"
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: ${{ inputs.artifact-prefix }}wheels-linux-ppc64le

wheels-linux-aarch64:
name: "Wheels / Linux AArch64"
if: (inputs.wheels-linux-aarch64 == 'default' && inputs.default-action || inputs.wheels-linux-aarch64) == 'build'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- uses: dtolnay/rust-toolchain@stable
- uses: docker/setup-qemu-action@v3
with:
platforms: all
- uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_ARCHS_LINUX: aarch64
CIBW_TEST_COMMAND: cp -r {project}/test . && QISKIT_PARALLEL=FALSE stestr --test-path test/python run --abbreviate -n test.python.compiler.test_transpiler
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: ${{ inputs.artifact-prefix }}wheels-linux-aarch64

sdist:
name: "sdist"
if: (inputs.sdist == 'default' && inputs.default-action || inputs.sdist) == 'build'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Build sdist
run: |
set -e
python -m pip install -U build
python -m build --sdist .
- uses: actions/upload-artifact@v4
with:
path: ./dist/*.tar.gz
name: ${{ inputs.artifact-prefix }}sdist
23 changes: 23 additions & 0 deletions .github/workflows/wheels-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build wheels

on:
pull_request:
types:
- opened
- synchronize
- reopened
# Above are the defaults for the PR trigger, below are our insertions.
# Trigger on 'labeled' so we catch the initial manual labelling event.
- labeled

concurrency:
group: ${{ github.repository }}-${{ github.ref_name }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
test-wheels:
name: Build
if: '${{ contains(github.event.pull_request.labels.*.name, ''ci: test wheels'') }}'
uses: './.github/workflows/wheels-build.yml'
with:
default-action: "build"
Loading

0 comments on commit 87bf820

Please sign in to comment.