Skip to content

Commit

Permalink
Move determine_runner job to interface-unit-test workflow (have it ru…
Browse files Browse the repository at this point in the history
…n once vs many times)
  • Loading branch information
rashidnhm committed Sep 16, 2024
1 parent 8125f8b commit b030d4a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/determine-workflow-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
id: runner_group
env:
# We are not able to use \d to check numeric values as bash does not allow them (not POSIX compliant)
RC_BRANCH_FORMAT_REGEX: v[0-9]+\.[0-9]+\.[0-9]+_rc[0-9]?
RC_BRANCH_FORMAT_REGEX: v[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]?
REPO_FULL_NAME: PennyLaneAI/pennylane
run: |
if [[ '${{ contains(github.event.pull_request.labels.*.name, 'urgent') }}' == 'true' || ('${{ github.event.pull_request.head.repo.full_name }}' == "$REPO_FULL_NAME" && '${{ github.event.pull_request.head.ref }}' =~ $RC_BRANCH_FORMAT_REGEX) ]]; then
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/interface-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ on:
default: false

jobs:
determine_runner:
if: github.event.pull_request.draft == false
name: Determine runner type to use
uses: ./.github/workflows/determine-workflow-runner.yml
with:
default_runner: ubuntu-latest

setup-ci-load:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -140,6 +147,7 @@ jobs:
torch-tests:
needs:
- setup-ci-load
- determine_runner
strategy:
max-parallel: >-
${{
Expand All @@ -156,6 +164,7 @@ jobs:
uses: ./.github/workflows/unit-test.yml
with:
job_name: torch-tests (${{ matrix.python-version }})
job_runner_name: ${{ needs.determine_runner.outputs.runner_group }}
branch: ${{ inputs.branch }}
coverage_artifact_name: core-interfaces-coverage-torch-${{ matrix.python-version }}
python_version: ${{ matrix.python-version }}
Expand All @@ -173,6 +182,7 @@ jobs:
autograd-tests:
needs:
- setup-ci-load
- determine_runner
strategy:
max-parallel: >-
${{
Expand All @@ -189,6 +199,7 @@ jobs:
uses: ./.github/workflows/unit-test.yml
with:
job_name: autograd-tests (${{ matrix.python-version }})
job_runner_name: ${{ needs.determine_runner.outputs.runner_group }}
branch: ${{ inputs.branch }}
coverage_artifact_name: core-interfaces-coverage-autograd-${{ matrix.python-version }}
python_version: ${{ matrix.python-version }}
Expand All @@ -205,6 +216,7 @@ jobs:
tf-tests:
needs:
- setup-ci-load
- determine_runner
strategy:
max-parallel: >-
${{
Expand All @@ -222,6 +234,7 @@ jobs:
uses: ./.github/workflows/unit-test.yml
with:
job_name: tf-tests (${{ matrix.group }}, ${{ matrix.python-version }})
job_runner_name: ${{ needs.determine_runner.outputs.runner_group }}
branch: ${{ inputs.branch }}
coverage_artifact_name: core-interfaces-coverage-tf-${{ matrix.python-version }}-${{ matrix.group }}
python_version: ${{ matrix.python-version }}
Expand All @@ -243,6 +256,7 @@ jobs:
jax-tests:
needs:
- setup-ci-load
- determine_runner
strategy:
max-parallel: >-
${{
Expand All @@ -260,6 +274,7 @@ jobs:
uses: ./.github/workflows/unit-test.yml
with:
job_name: jax-tests (${{ matrix.group }}, ${{ matrix.python-version }})
job_runner_name: ${{ needs.determine_runner.outputs.runner_group }}
branch: ${{ inputs.branch }}
coverage_artifact_name: core-interfaces-coverage-jax-${{ matrix.python-version }}-${{ matrix.group }}
python_version: ${{ matrix.python-version }}
Expand All @@ -281,6 +296,7 @@ jobs:
core-tests:
needs:
- setup-ci-load
- determine_runner
strategy:
max-parallel: >-
${{
Expand All @@ -298,6 +314,7 @@ jobs:
uses: ./.github/workflows/unit-test.yml
with:
job_name: core-tests (${{ matrix.group }}, ${{ matrix.python-version }})
job_runner_name: ${{ needs.determine_runner.outputs.runner_group }}
branch: ${{ inputs.branch }}
coverage_artifact_name: core-interfaces-coverage-core-${{ matrix.python-version }}-${{ matrix.group }}
python_version: ${{ matrix.python-version }}
Expand All @@ -319,6 +336,7 @@ jobs:
all-interfaces-tests:
needs:
- setup-ci-load
- determine_runner
strategy:
max-parallel: >-
${{
Expand All @@ -335,6 +353,7 @@ jobs:
uses: ./.github/workflows/unit-test.yml
with:
job_name: all-interfaces-tests (${{ matrix.python-version }})
job_runner_name: ${{ needs.determine_runner.outputs.runner_group }}
branch: ${{ inputs.branch }}
coverage_artifact_name: all-interfaces-coverage
python_version: ${{ matrix.python-version }}
Expand All @@ -352,6 +371,7 @@ jobs:
external-libraries-tests:
needs:
- setup-ci-load
- determine_runner
strategy:
max-parallel: >-
${{
Expand All @@ -368,6 +388,7 @@ jobs:
uses: ./.github/workflows/unit-test.yml
with:
job_name: external-libraries-tests (${{ matrix.python-version }})
job_runner_name: ${{ needs.determine_runner.outputs.runner_group }}
branch: ${{ inputs.branch }}
coverage_artifact_name: external-libraries-tests-coverage
python_version: ${{ matrix.python-version }}
Expand All @@ -391,6 +412,7 @@ jobs:
qcut-tests:
needs:
- setup-ci-load
- determine_runner
strategy:
max-parallel: >-
${{
Expand All @@ -407,6 +429,7 @@ jobs:
uses: ./.github/workflows/unit-test.yml
with:
job_name: qcut-tests (${{ matrix.python-version }})
job_runner_name: ${{ needs.determine_runner.outputs.runner_group }}
branch: ${{ inputs.branch }}
coverage_artifact_name: qcut-coverage
python_version: ${{ matrix.python-version }}
Expand All @@ -424,6 +447,7 @@ jobs:
qchem-tests:
needs:
- setup-ci-load
- determine_runner
strategy:
max-parallel: >-
${{
Expand All @@ -440,6 +464,7 @@ jobs:
uses: ./.github/workflows/unit-test.yml
with:
job_name: qchem-tests (${{ matrix.python-version }})
job_runner_name: ${{ needs.determine_runner.outputs.runner_group }}
branch: ${{ inputs.branch }}
coverage_artifact_name: qchem-coverage
python_version: ${{ matrix.python-version }}
Expand All @@ -456,6 +481,7 @@ jobs:
gradients-tests:
needs:
- setup-ci-load
- determine_runner
strategy:
max-parallel: >-
${{
Expand All @@ -475,6 +501,7 @@ jobs:
uses: ./.github/workflows/unit-test.yml
with:
job_name: gradients-tests (${{ matrix.config.suite }}, ${{ matrix.python-version }})
job_runner_name: ${{ needs.determine_runner.outputs.runner_group }}
branch: ${{ inputs.branch }}
coverage_artifact_name: gradients-${{ matrix.config.suite }}-coverage
python_version: ${{ matrix.python-version }}
Expand All @@ -491,6 +518,7 @@ jobs:
data-tests:
needs:
- setup-ci-load
- determine_runner
strategy:
max-parallel: >-
${{
Expand All @@ -507,6 +535,7 @@ jobs:
uses: ./.github/workflows/unit-test.yml
with:
job_name: data-tests (${{ matrix.python-version }})
job_runner_name: ${{ needs.determine_runner.outputs.runner_group }}
branch: ${{ inputs.branch }}
coverage_artifact_name: data-coverage-${{ matrix.python-version }}
python_version: ${{ matrix.python-version }}
Expand All @@ -524,6 +553,7 @@ jobs:
device-tests:
needs:
- setup-ci-load
- determine_runner
strategy:
max-parallel: >-
${{
Expand All @@ -547,6 +577,7 @@ jobs:
uses: ./.github/workflows/unit-test.yml
with:
job_name: device-tests (${{ matrix.config.device }}, ${{ matrix.config.shots }}, ${{ matrix.python-version }})
job_runner_name: ${{ needs.determine_runner.outputs.runner_group }}
branch: ${{ inputs.branch }}
coverage_artifact_name: devices-coverage-${{ matrix.config.device }}-${{ matrix.config.shots }}
python_version: ${{ matrix.python-version }}
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ on:
description: Name of the artifact file that will contain the coverage file for codevoc
required: true
type: string
job_runner_name:
description: The name of the runner to use for the job
required: false
type: string
default: 'ubuntu-latest'
checkout_fetch_depth:
description: How many commits to checkout from HEAD of branch passed
required: false
Expand Down Expand Up @@ -116,17 +121,9 @@ on:
default: "False"

jobs:
determine_runner:
if: github.event.pull_request.draft == false
name: Determine runner type to use
uses: ./.github/workflows/determine-workflow-runner.yml
with:
default_runner: ubuntu-latest

test:
name: ${{ inputs.job_name }}
needs: [determine_runner]
runs-on: ${{ needs.determine_runner.outputs.runner }}
runs-on: ${{ inputs.job_runner_name }}

steps:
- name: Checkout
Expand Down

0 comments on commit b030d4a

Please sign in to comment.