Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
196 changes: 196 additions & 0 deletions .github/workflows/branch-protection.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
---

# This is the shared configuration that defines all the jobs we include in branch protection. This
# needs to be run both by PRs and by the merge queue.
#
# All required branch-protection rules should be in here, and everything in here should listed in
# the branch-protection rules (in the `finalize` job).

name: Branch Protection

on:
merge_group:
pull_request:
branches: ["main", "stable/*"]

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

jobs:
# Shared configuration values. It's also possible to specify these in the GitHub web interface,
# but that separates them from the rest of the configuration logic and means that the changes to
# the configuration do not appear in the git history.
config:
name: Configure
runs-on: 'ubuntu-latest'
steps:
- run: ':'
outputs:
python-old: '3.10'
python-new: '3.13'
runner-linux-x86_64: 'ubuntu-latest'
runner-linux-arm64: 'ubuntu-24.04-arm'
runner-macos-arm64: 'macos-15'
runner-windows-x86_64: 'windows-latest'
Comment on lines +29 to +35
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess maybe for a follow up something we could add is a user input trigger on this to enable manually running a job with different options if we wanted. But definitely not in scope for this PR and probably not even in this rule. But the comment about the web interface made met think about it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh that's an interesting idea. I'll have to think about it, but there might be a way. The next step after this one is probably to move this "job" into its own file so other files can depend on it too, and maybe part of that will make it easier.


# This 'finalize' job is a no-op; its sole purpose is to depend on all the other jobs and provide
# a single in-code determination of whether the branch-protection rules have been passed. The
# branch-protection rules in the GitHub web interface can then depend only on this job.
finalize:
name: Finalize
runs-on: 'ubuntu-latest'
steps:
- run: ':'
# This list should contain every other job in this file.
needs:
- docs
- lint
- test-linux
- test-macos
- test-windows
- test-rust
- test-c
- test-images
- miri
- qpy
- neko

docs:
name: Documentation
needs: config
uses: ./.github/workflows/docs.yml
with:
python-version: ${{ needs.config.outputs.python-new }}
runner: ${{ needs.config.outputs.runner-linux-x86_64 }}
secrets: inherit

lint:
name: Lint
needs: config
uses: ./.github/workflows/lint.yml
with:
python-version: ${{ needs.config.outputs.python-old }}
runner: ${{ needs.config.outputs.runner-linux-x86_64 }}

test-linux:
name: Unit Python / Linux / ${{ matrix.config.id }} - ${{ matrix.runner }}
needs: config
uses: ./.github/workflows/test-linux.yml
with:
runner: ${{ matrix.runner }}
python-version: ${{ matrix.config.python }}
install-optionals: ${{ matrix.config.install-optionals }}
install-from-sdist: ${{ matrix.config.install-from-sdist }}
qiskit-pycache: ${{ matrix.config.qiskit-pycache }}
strategy:
fail-fast: false
matrix:
runner:
- ${{ needs.config.outputs.runner-linux-x86_64 }}
- ${{ needs.config.outputs.runner-linux-arm64 }}
config:
- id: "Python oldest"
python: ${{ needs.config.outputs.python-old }}
install-optionals: true
install-from-sdist: false
qiskit-pycache: false
- id: "Python newest"
python: ${{ needs.config.outputs.python-new }}
install-optionals: false
install-from-sdist: true
qiskit-pycache: true

test-macos:
name: Unit Python / macOS / ${{ matrix.config.id }}
needs: config
uses: ./.github/workflows/test-mac.yml
with:
runner: ${{ needs.config.outputs.runner-macos-arm64 }}
python-version: ${{ matrix.config.python }}
install-optionals: ${{ matrix.config.install-optionals }}
strategy:
fail-fast: false
matrix:
config:
- id: "Python oldest"
python: ${{ needs.config.outputs.python-old }}
install-optionals: true
- id: "Python newest"
python: ${{ needs.config.outputs.python-new }}
install-optionals: false

test-windows:
name: Unit Python / Windows / ${{ matrix.config.id }}
needs: config
uses: ./.github/workflows/test-windows.yml
with:
runner: ${{ needs.config.outputs.runner-windows-x86_64 }}
python-version: ${{ matrix.config.python }}
install-optionals: ${{ matrix.config.install-optionals }}
strategy:
fail-fast: false
matrix:
config:
- id: "Python oldest"
python: ${{ needs.config.outputs.python-old }}
install-optionals: true
- id: "Python newest"
python: ${{ needs.config.outputs.python-new }}
install-optionals: false

test-rust:
name: Unit Rust
needs: config
uses: ./.github/workflows/rust-tests.yml
with:
python-version: ${{ needs.config.outputs.python-old }}
runner: ${{ needs.config.outputs.runner-linux-x86_64 }}

miri:
name: Miri
needs: config
uses: ./.github/workflows/miri.yml
with:
runner: ${{ needs.config.outputs.runner-linux-x86_64 }}

test-c:
name: Unit C / ${{ matrix.runner }}
needs: config
uses: ./.github/workflows/ctests.yml
with:
python-version: ${{ needs.config.outputs.python-new }}
runner: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
runner:
- ${{ needs.config.outputs.runner-linux-x86_64 }}
- ${{ needs.config.outputs.runner-linux-arm64 }}
- ${{ needs.config.outputs.runner-macos-arm64 }}
- ${{ needs.config.outputs.runner-windows-x86_64 }}

test-images:
name: Image
needs: config
uses: ./.github/workflows/image-tests.yml
with:
python-version: ${{ needs.config.outputs.python-old }}
runner: ${{ needs.config.outputs.runner-linux-x86_64 }}

qpy:
name: QPY
needs: config
uses: ./.github/workflows/qpy.yml
with:
python-version: ${{ needs.config.outputs.python-old }}
runner: ${{ needs.config.outputs.runner-linux-x86_64 }}

neko:
name: Integration Neko
needs: config
runs-on: ${{ needs.config.outputs.runner-linux-x86_64 }}
steps:
- uses: Qiskit/qiskit-neko@main
with:
test_selection: "terra"
Comment on lines +190 to +196
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you didn't feel like this needed it's own file anymore since it's just calling a single action?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, it already is its own file, it's just that the file is in a different repo haha. The old neko.yml file had one extra code line, and if that was necessary I'd have left it in its own file, but it was just an awkward trick left over from the Qiskit 0.x -> 1.0 transition.

26 changes: 12 additions & 14 deletions .github/workflows/ctests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,24 @@
name: C API Tests
on:
workflow_call:
inputs:
python-version:
description: Python version to test.
type: string
required: true
runner:
description: Runner image to use.
type: string
required: true

jobs:
tests:
if: github.repository_owner == 'Qiskit'
name: tests-c-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
# Used for the ARM builds.
- macos-14
- ubuntu-24.04-arm
- windows-latest
name: ${{ inputs.runner }}
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.13"

python-version: ${{ inputs.python-version }}
- name: Run tests
run: make ctest
43 changes: 43 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Docs
on:
workflow_call:
inputs:
python-version:
description: Python version to test.
type: string
required: true
runner:
description: Runner image to use. Expects an Ubuntu image.
type: string
required: true

jobs:
docs:
name: Docs
runs-on: ${{ inputs.runner }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
with:
# We need to fetch the whole history so 'reno' can do its job and we can inspect tags.
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
- name: Install ubuntu docs dependencies
run: tools/install_ubuntu_docs_dependencies.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run docs
run: tox -e docs
- name: Clean up docs detritus
run: rm -rf docs/_build/html/{.doctrees,.buildinfo}
- name: Store built documentation artifact
uses: actions/upload-artifact@v7
with:
name: qiskit-docs
path: |
./docs/_build/html/*
if-no-files-found: error
35 changes: 35 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Lint
on:
workflow_call:
inputs:
python-version:
description: Python version to test.
type: string
required: true
runner:
description: Runner image to use.
type: string
required: true

jobs:
lint:
name: Lint
runs-on: ${{ inputs.runner }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
with:
# We need to fetch the whole history so 'reno' can do its job and we can inspect tags.
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
- name: Install dependencies
run: python -m pip install --upgrade tox
- name: Run lint
run: |
set -e
make cformat
tox -e lint
62 changes: 0 additions & 62 deletions .github/workflows/lint_docs.yml

This file was deleted.

Loading