-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
423 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
name: Qiskit CI Workflow (Docs, Lint, and Tests) | ||
on: | ||
push: | ||
branches: [main, "stable/*"] | ||
pull_request: | ||
branches: [main, "stable/*"] | ||
merge_group: | ||
|
||
concurrency: | ||
group: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint-docs: | ||
name: Lint and Docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: ./.github/workflows/lint_docs.yml | ||
preliminary-tests: | ||
name: Preliminary Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: ./.github/workflows/test-linux.yml | ||
with: | ||
python-version: "3.9" | ||
# A PR is more likely to fail CI because it introduces a logic error | ||
# into an existing test than because it adds a new test / optional | ||
# dependency that isn't accounted for in the test-skipping logic | ||
# (and such a failure would need fewer iterations to fix). We want | ||
# to fail fast in the first CI stage. | ||
install-optionals: true | ||
test-rust: true | ||
test-images: true | ||
main-tests-ubuntu: | ||
runs-on: ubuntu-latest | ||
name: Main Tests (ubuntu-latest) | ||
needs: [lint-docs, preliminary-tests] | ||
strategy: | ||
matrix: | ||
python_version: ["3.13"] | ||
steps: | ||
- uses: ./.github/workflows/test-linux.yml | ||
with: | ||
python-version: ${{ matrix.python_version }} | ||
test-rust: false | ||
test-images: false | ||
install-from-sdist: true | ||
install-optionals: false | ||
|
||
main-tests-mac: | ||
runs-on: macos-14 | ||
name: Main Tests (ubuntu-latest) | ||
needs: [lint-docs, preliminary-tests] | ||
strategy: | ||
matrix: | ||
python_version: ["3.9", "3.13"] | ||
steps: | ||
- uses: ./.github/workflows/test-macos.yml | ||
with: | ||
python-version: ${{ matrix.python_version }} | ||
install-optionals: ${{ matrix.python_version == '3.9'}} | ||
|
||
main-tests-windows: | ||
runs-on: macos-14 | ||
name: Main Tests (ubuntu-latest) | ||
needs: [lint-docs, preliminary-tests] | ||
strategy: | ||
matrix: | ||
python_version: ["3.9", "3.13"] | ||
steps: | ||
- uses: ./.github/workflows/test-windows.yml | ||
with: | ||
python-version: ${{ matrix.python_version }} | ||
install-optionals: ${{ matrix.python_version == '3.9'}} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- | ||
name: Test Windows | ||
on: | ||
workflow_call: | ||
inputs: | ||
python-version: | ||
description: > | ||
Python version to currently test | ||
type: string | ||
required: true | ||
|
||
install-optionals: | ||
description: > | ||
Decides whether we install optyional dependencies | ||
type: boolean | ||
default: false | ||
|
||
merge_group: | ||
|
||
jobs: | ||
tests-mac: | ||
if: github.repository_owner == 'Qiskit' | ||
name: macOS-arm64-tests-Python-${{ inputs.python-version }} | ||
runs-on: macOS-14 | ||
env: | ||
QISKIT_SUPPRESS_PACKAGING_WARNINGS: Y | ||
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip | ||
QISKIT_TEST_CAPTURE_STREAMS: 1 | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Rust toolchain | ||
uses: dtolnay/rust-toolchain@1.70 | ||
if: inputs.python-version == '3.9' | ||
- name: Set up Python ${{ inputs.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
architecture: arm64 | ||
- name: Cache stestr | ||
uses: actions/cache@v4 | ||
with: | ||
key: 'stestr | "${{ runner.os }}" | "${{ inputs.python-version }}" | "${{ github.run_id }}"' | ||
restore-keys: | | ||
stestr | "${{ runner.os }}" | "${{ inputs.python-version }}" | ||
stestr | "${{ runner.os }}" | ||
stestr | ||
path: .stestr | ||
- name: "Install dependencies" | ||
run: | | ||
set -e | ||
python -m pip install --upgrade pip setuptools wheel virtualenv | ||
virtualenv test-job | ||
source test-job/bin/activate | ||
python -m pip install -U pip setuptools wheel | ||
python -m pip install -U \ | ||
-c constraints.txt \ | ||
-r requirements.txt \ | ||
-r requirements-dev.txt \ | ||
-e . | ||
# Build and install both qiskit and qiskit-terra so that any optionals | ||
# depending on `qiskit` will resolve correctly. | ||
pip check | ||
- name: "Install optionals" | ||
run: | | ||
set -e | ||
source test-job/bin/activate | ||
pip install -r requirements-optional.txt -c constraints.txt | ||
if: ${{ inputs.install-optionals }} | ||
- name: "Run tests" | ||
run: | | ||
set -e | ||
source test-job/bin/activate | ||
python tools/report_numpy_state.py | ||
export PYTHONHASHSEED=$(python -S -c "import random; print(random.randint(1, 4294967295))") | ||
echo "PYTHONHASHSEED=$PYTHONHASHSEED" | ||
stestr run | ||
env: | ||
QISKIT_PARALLEL: FALSE | ||
RUST_BACKTRACE: 1 | ||
- name: Copy and Publish images | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ failure() }} | ||
with: | ||
name: copied-images | ||
path: "**/*.png" | ||
if-no-files-found: error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- | ||
name: Test Windows | ||
on: | ||
workflow_call: | ||
inputs: | ||
python-version: | ||
description: > | ||
Python version to currently test | ||
type: string | ||
required: true | ||
|
||
install-optionals: | ||
description: > | ||
Decides whether we install optyional dependencies | ||
type: boolean | ||
default: false | ||
|
||
merge_group: | ||
|
||
jobs: | ||
test-windows: | ||
if: github.repository_owner == 'Qiskit' | ||
name: windows-latest-tests-Python-${{ inputs.python-version }} | ||
runs-on: windows-latest | ||
env: | ||
QISKIT_SUPPRESS_PACKAGING_WARNINGS: Y | ||
QISKIT_TEST_CAPTURE_STREAMS: 1 | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Rust toolchain | ||
uses: dtolnay/rust-toolchain@1.70 | ||
if: inputs.python-version == '3.9' | ||
- name: Set up Python ${{ inputs.python-version }} | ||
id: python-outputs | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
- name: Cache stestr | ||
uses: actions/cache@v4 | ||
with: | ||
key: 'stestr | "${{ runner.os }}" | "${{ inputs.python-version }}" | "${{ github.run_id }}"' | ||
restore-keys: | | ||
stestr | "${{ runner.os }}" | "${{ inputs.python-version }}" | ||
stestr | "${{ runner.os }}" | ||
stestr | ||
path: .stestr | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel virtualenv | ||
python -m virtualenv test-job | ||
.\test-job\Scripts\activate | ||
python -m pip install -U pip setuptools wheel | ||
python -m pip install -U ` | ||
-c constraints.txt ` | ||
-r requirements.txt ` | ||
-r requirements-dev.txt ` | ||
-e . | ||
# Build and install both qiskit and qiskit-terra so that any optionals | ||
# depending on `qiskit` will resolve correctly. | ||
pip check | ||
- name: Install Optional packages | ||
run: | | ||
.\test-job\Scripts\activate | ||
pip install -c constraints.txt -r requirements-optional.txt | ||
pip check | ||
if: ${{ inputs.install-optionals }} | ||
- name: Run Tests | ||
run: | | ||
chcp.com 65001 | ||
.\test-job\Scripts\activate | ||
python tools/report_numpy_state.py | ||
$Env:PYTHONHASHSEED=$(python -S -c "import random; print(random.randint(1, 1024))") | ||
echo "PYTHONHASHSEED=$PYTHONHASHSEED" | ||
stestr run | ||
env: | ||
LANG: "C.UTF-8" | ||
PYTHONIOENCODING: "utf-8:backslashreplace" | ||
QISKIT_PARALLEL: FALSE | ||
RUST_BACKTRACE: 1 | ||
- name: Copy and Publish images | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ failure() }} | ||
with: | ||
name: copied-images | ||
path: "**/*.png" | ||
if-no-files-found: error |
Oops, something went wrong.