From 4d623f107f5f7d8320524bec57e0ecf3481e54cc Mon Sep 17 00:00:00 2001 From: Chan Chan Man <75779966+AbdullahKazi500@users.noreply.github.com> Date: Fri, 12 Sep 2025 14:12:08 +0530 Subject: [PATCH 1/7] Create ci.yml --- .github/workflows/ci.yml | 124 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..1ce3883f0a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,124 @@ +name: CI + +on: + pull_request: + branches: [ main, 'stable/*' ] + merge_group: + branches: [ main ] + schedule: + - cron: "0 4 * * *" + workflow_dispatch: + +concurrency: + group: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }} + cancel-in-progress: true + +jobs: + tests: + if: github.repository_owner == 'Qiskit-Community' + name: tests-python${{ matrix.python-version }}-${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: [3.9, "3.13"] + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + steps: + - name: Print Concurrency Group + env: + CONCURRENCY_GROUP: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }} + run: | + echo -e "\033[31;1;4mConcurrency Group\033[0m" + echo -e "$CONCURRENCY_GROUP\n" + shell: bash + - uses: actions/checkout@v5 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + - name: Set up uv + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + cache-dependency-glob: | + **/tox.ini + **/pyproject.toml + cache-suffix: tests + - name: Stestr cache + uses: actions/cache@v4 + with: + path: .stestr + key: stestr-${{ runner.os }}-${{ matrix.python-version }} + restore-keys: | + stestr-${{ runner.os }}- + stestr- + - name: Install and Run Tests + run: | + if [[ "${{ github.event_name }}" == "schedule" ]]; then + uvx --with tox-uv tox -e qiskit-main + else + uvx --with tox-uv tox --override testenv.package=external run -e py + fi + - name: Clean up stestr cache + if: ${{ github.event_name != 'schedule' }} + run: uvx --with tox-uv tox exec -epy -- stestr history remove all + + lint: + if: github.repository_owner == 'Qiskit-Community' && github.event_name != 'schedule' + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - name: Set up Python 3.13 + uses: actions/setup-python@v6 + with: + python-version: '3.13' + - name: Set up uv + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + cache-dependency-glob: | + **/tox.ini + **/pyproject.toml + cache-suffix: lint + - name: Run lint + run: uvx --with tox-uv tox run -elint + + docs: + if: github.repository_owner == 'Qiskit-Community' + name: docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + - name: Set up Python ${{ github.event_name == 'schedule' && '3.12' || '3.13' }} + uses: actions/setup-python@v6 + with: + python-version: ${{ github.event_name == 'schedule' && '3.12' || '3.13' }} + - name: Set up uv + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + cache-dependency-glob: | + **/tox.ini + **/pyproject.toml + cache-suffix: docs + - name: Install Deps + run: | + sudo apt-get install -y pandoc graphviz + - name: Build Docs + run: | + if [[ "${{ github.event_name }}" == "schedule" ]]; then + uvx --with tox-uv tox -edocs-qiskit-main + else + uvx --with tox-uv tox run -edocs-parallel + fi + - name: Compress Artifacts + run: | + mkdir artifacts + tar -Jcvf html_docs.tar.xz docs/_build/html + mv html_docs.tar.xz artifacts/. + - uses: actions/upload-artifact@v4 + with: + name: html_docs + path: artifacts From 5ac6241a979f07e708732d525b3baa9e5f78d7ba Mon Sep 17 00:00:00 2001 From: Chan Chan Man <75779966+AbdullahKazi500@users.noreply.github.com> Date: Fri, 12 Sep 2025 21:22:51 +0530 Subject: [PATCH 2/7] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ce3883f0a..2ab098d2dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,10 +91,10 @@ jobs: - uses: actions/checkout@v5 with: fetch-depth: 0 - - name: Set up Python ${{ github.event_name == 'schedule' && '3.12' || '3.13' }} + - name: Set up Python 3.13 uses: actions/setup-python@v6 with: - python-version: ${{ github.event_name == 'schedule' && '3.12' || '3.13' }} + python-version: '3.13' - name: Set up uv uses: astral-sh/setup-uv@v6 with: From e11eed341438679b6b83d23c612663baeffe94d9 Mon Sep 17 00:00:00 2001 From: Chan Chan Man <75779966+AbdullahKazi500@users.noreply.github.com> Date: Fri, 12 Sep 2025 21:27:04 +0530 Subject: [PATCH 3/7] Update ci.yml --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ab098d2dc..e3f0472e77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,17 +53,17 @@ jobs: stestr- - name: Install and Run Tests run: | - if [[ "${{ github.event_name }}" == "schedule" ]]; then + if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then uvx --with tox-uv tox -e qiskit-main else uvx --with tox-uv tox --override testenv.package=external run -e py fi - name: Clean up stestr cache - if: ${{ github.event_name != 'schedule' }} + if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' }} run: uvx --with tox-uv tox exec -epy -- stestr history remove all lint: - if: github.repository_owner == 'Qiskit-Community' && github.event_name != 'schedule' + if: github.repository_owner == 'Qiskit-Community' && github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' name: lint runs-on: ubuntu-latest steps: @@ -108,7 +108,7 @@ jobs: sudo apt-get install -y pandoc graphviz - name: Build Docs run: | - if [[ "${{ github.event_name }}" == "schedule" ]]; then + if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then uvx --with tox-uv tox -edocs-qiskit-main else uvx --with tox-uv tox run -edocs-parallel From 8725da302ecc32d6b23ec9cdf5f750a0e8bbefd4 Mon Sep 17 00:00:00 2001 From: Chan Chan Man <75779966+AbdullahKazi500@users.noreply.github.com> Date: Sat, 20 Sep 2025 18:51:50 +0530 Subject: [PATCH 4/7] Delete .github/workflows/main.yml --- .github/workflows/main.yml | 108 ------------------------------------- 1 file changed, 108 deletions(-) delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 7b805f3391..0000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Tests -on: - push: - branches: [ 'stable/*' ] - pull_request: - branches: [ main, 'stable/*' ] - merge_group: - branches: [ main ] -concurrency: - group: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }} - cancel-in-progress: true -jobs: - tests: - if: github.repository_owner == 'Qiskit-Community' - name: tests-python${{ matrix.python-version }}-${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - python-version: [3.9, "3.13"] - os: ["ubuntu-latest", "macos-latest", "windows-latest"] - steps: - - name: Print Concurrency Group - env: - CONCURRENCY_GROUP: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }} - run: | - echo -e "\033[31;1;4mConcurrency Group\033[0m" - echo -e "$CONCURRENCY_GROUP\n" - shell: bash - - uses: actions/checkout@v5 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - - name: Set up uv - uses: astral-sh/setup-uv@v6 - with: - enable-cache: true - cache-dependency-glob: | - **/tox.ini - **/pyproject.toml - cache-suffix: tests - - name: Stestr cache - uses: actions/cache@v4 - with: - path: .stestr - key: stestr-${{ runner.os }}-${{ matrix.python-version }} - restore-keys: | - stestr-${{ runner.os }}- - stestr- - - name: Install and Run Tests - run: uvx --with tox-uv tox --override testenv.package=external run -e py - - name: Clean up stestr cache - run: uvx --with tox-uv tox exec -epy -- stestr history remove all - - lint: - if: github.repository_owner == 'Qiskit-Community' - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - - name: Set up Python 3.13 - uses: actions/setup-python@v6 - with: - python-version: '3.13' - - name: Set up uv - uses: astral-sh/setup-uv@v6 - with: - enable-cache: true - cache-dependency-glob: | - **/tox.ini - **/pyproject.toml - cache-suffix: lint - - name: Run lint - run: uvx --with tox-uv tox run -elint - docs: - if: github.repository_owner == 'Qiskit-Community' - name: docs - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - name: Set up Python 3.13 - uses: actions/setup-python@v6 - with: - python-version: '3.13' - - name: Set up uv - uses: astral-sh/setup-uv@v6 - with: - enable-cache: true - cache-dependency-glob: | - **/tox.ini - **/pyproject.toml - cache-suffix: docstest - - name: Install Deps - run: | - sudo apt-get install -y pandoc graphviz - - name: Build Docs - run: uvx --with tox-uv tox run -edocs-parallel - - name: Compress Artifacts - run: | - mkdir artifacts - tar -Jcvf html_docs.tar.xz docs/_build/html - mv html_docs.tar.xz artifacts/. - - uses: actions/upload-artifact@v4 - with: - name: html_docs - path: artifacts From b9bb1bb9e00d9797be3f0bdb9d1421ef6ce67039 Mon Sep 17 00:00:00 2001 From: Chan Chan Man <75779966+AbdullahKazi500@users.noreply.github.com> Date: Sat, 27 Sep 2025 01:59:56 +0530 Subject: [PATCH 5/7] Delete .github/workflows/cron-staging.yml --- .github/workflows/cron-staging.yml | 72 ------------------------------ 1 file changed, 72 deletions(-) delete mode 100644 .github/workflows/cron-staging.yml diff --git a/.github/workflows/cron-staging.yml b/.github/workflows/cron-staging.yml deleted file mode 100644 index d24d1657be..0000000000 --- a/.github/workflows/cron-staging.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Cron-staging -on: - schedule: - - cron: "0 4 * * *" - workflow_dispatch: - -jobs: - qiskit-main-tests: - if: github.repository_owner == 'Qiskit-Community' - name: tests-python${{ matrix.python-version }}-${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - python-version: [3.9, "3.12"] - os: ["ubuntu-latest", "macos-latest", "windows-latest"] - steps: - - name: Print Concurrency Group - env: - CONCURRENCY_GROUP: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }} - run: | - echo -e "\033[31;1;4mConcurrency Group\033[0m" - echo -e "$CONCURRENCY_GROUP\n" - shell: bash - - uses: actions/checkout@v5 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - - name: Set up uv - uses: astral-sh/setup-uv@v6 - with: - enable-cache: true - cache-dependency-glob: | - **/tox.ini - **/pyproject.toml - cache-suffix: testsqiskitmain - - name: Install and Run Tests - run: uvx --with tox-uv tox -e qiskit-main - docs: - if: github.repository_owner == 'Qiskit-Community' - name: docs - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - name: Set up Python 3.12 - uses: actions/setup-python@v6 - with: - python-version: 3.12 - - name: Set up uv - uses: astral-sh/setup-uv@v6 - with: - enable-cache: true - cache-dependency-glob: | - **/tox.ini - **/pyproject.toml - cache-suffix: docsqiskitmain - - name: Install Deps - run: | - sudo apt-get install -y pandoc graphviz - - name: Build Docs - run: uvx --with tox-uv tox -edocs-qiskit-main - - name: Compress Artifacts - run: | - mkdir artifacts - tar -Jcvf html_docs.tar.xz docs/_build/html - mv html_docs.tar.xz artifacts/. - - uses: actions/upload-artifact@v4 - with: - name: html_docs - path: artifacts From 6b5f72d9908dfd4f9235218a8848ba6f0e901833 Mon Sep 17 00:00:00 2001 From: Abdullah K <75779966+AbdullahKazi500@users.noreply.github.com> Date: Sun, 28 Sep 2025 18:17:04 +0530 Subject: [PATCH 6/7] Update ci.yml --- .github/workflows/ci.yml | 54 ++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3f0472e77..9c804a9f66 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,9 @@ concurrency: group: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }} cancel-in-progress: true +env: + qiskitmain: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} + jobs: tests: if: github.repository_owner == 'Qiskit-Community' @@ -30,11 +33,14 @@ jobs: echo -e "\033[31;1;4mConcurrency Group\033[0m" echo -e "$CONCURRENCY_GROUP\n" shell: bash + - uses: actions/checkout@v5 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} + - name: Set up uv uses: astral-sh/setup-uv@v6 with: @@ -42,7 +48,8 @@ jobs: cache-dependency-glob: | **/tox.ini **/pyproject.toml - cache-suffix: tests + cache-suffix: tests${{ env.qiskitmain == 'true' && '-qiskitmain' || '' }} + - name: Stestr cache uses: actions/cache@v4 with: @@ -51,15 +58,18 @@ jobs: restore-keys: | stestr-${{ runner.os }}- stestr- - - name: Install and Run Tests - run: | - if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then - uvx --with tox-uv tox -e qiskit-main - else - uvx --with tox-uv tox --override testenv.package=external run -e py - fi + + # Separate steps instead of a single bash conditional + - name: Install and Run Tests (Qiskit main run) + if: env.qiskitmain == 'true' + run: uvx --with tox-uv tox -e qiskit-main + + - name: Install and Run Tests (normal PR run) + if: env.qiskitmain != 'true' + run: uvx --with tox-uv tox --override testenv.package=external run -e py + - name: Clean up stestr cache - if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' }} + if: env.qiskitmain != 'true' run: uvx --with tox-uv tox exec -epy -- stestr history remove all lint: @@ -91,10 +101,12 @@ jobs: - uses: actions/checkout@v5 with: fetch-depth: 0 + - name: Set up Python 3.13 uses: actions/setup-python@v6 with: python-version: '3.13' + - name: Set up uv uses: astral-sh/setup-uv@v6 with: @@ -102,22 +114,26 @@ jobs: cache-dependency-glob: | **/tox.ini **/pyproject.toml - cache-suffix: docs + cache-suffix: docs${{ env.qiskitmain == 'true' && '-qiskitmain' || '' }} + - name: Install Deps - run: | - sudo apt-get install -y pandoc graphviz - - name: Build Docs - run: | - if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then - uvx --with tox-uv tox -edocs-qiskit-main - else - uvx --with tox-uv tox run -edocs-parallel - fi + run: sudo apt-get install -y pandoc graphviz + + # Split into separate steps instead of conditional script + - name: Build Docs (Qiskit main run) + if: env.qiskitmain == 'true' + run: uvx --with tox-uv tox -edocs-qiskit-main + + - name: Build Docs (normal PR run) + if: env.qiskitmain != 'true' + run: uvx --with tox-uv tox run -edocs-parallel + - name: Compress Artifacts run: | mkdir artifacts tar -Jcvf html_docs.tar.xz docs/_build/html mv html_docs.tar.xz artifacts/. + - uses: actions/upload-artifact@v4 with: name: html_docs From ff087cd4660b2fbccdeda484260c13aa4c1a5a2f Mon Sep 17 00:00:00 2001 From: Abdullah K <75779966+AbdullahKazi500@users.noreply.github.com> Date: Tue, 30 Sep 2025 00:30:34 +0530 Subject: [PATCH 7/7] Update ci.yml --- .github/workflows/ci.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c804a9f66..79926a2276 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,8 +50,10 @@ jobs: **/pyproject.toml cache-suffix: tests${{ env.qiskitmain == 'true' && '-qiskitmain' || '' }} - - name: Stestr cache - uses: actions/cache@v4 + # Restore stestr cache (shared between Qiskit main and PR runs) + - name: Restore stestr cache + id: stestr-restore + uses: actions/cache/restore@v4 with: path: .stestr key: stestr-${{ runner.os }}-${{ matrix.python-version }} @@ -59,7 +61,6 @@ jobs: stestr-${{ runner.os }}- stestr- - # Separate steps instead of a single bash conditional - name: Install and Run Tests (Qiskit main run) if: env.qiskitmain == 'true' run: uvx --with tox-uv tox -e qiskit-main @@ -68,10 +69,18 @@ jobs: if: env.qiskitmain != 'true' run: uvx --with tox-uv tox --override testenv.package=external run -e py - - name: Clean up stestr cache - if: env.qiskitmain != 'true' + # Always prune history (avoid unbounded growth) + - name: Prune stestr history run: uvx --with tox-uv tox exec -epy -- stestr history remove all + # Only save cache on normal PR runs (avoid growing Qiskit main cache) + - name: Save stestr cache + if: env.qiskitmain != 'true' + uses: actions/cache/save@v4 + with: + path: .stestr + key: ${{ steps.stestr-restore.outputs.cache-primary-key }} + lint: if: github.repository_owner == 'Qiskit-Community' && github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' name: lint @@ -119,7 +128,6 @@ jobs: - name: Install Deps run: sudo apt-get install -y pandoc graphviz - # Split into separate steps instead of conditional script - name: Build Docs (Qiskit main run) if: env.qiskitmain == 'true' run: uvx --with tox-uv tox -edocs-qiskit-main