From 0430975d4d09a4b86bed5f544bf68703a48365ff Mon Sep 17 00:00:00 2001 From: teor Date: Tue, 21 Nov 2023 09:17:23 +1000 Subject: [PATCH] Skip integration tests on external PRs --- ...i-integration-tests-gcp.patch-external.yml | 101 ++++++++++++++++++ .../ci-integration-tests-gcp.patch.yml | 8 +- .../workflows/ci-integration-tests-gcp.yml | 11 ++ .../ci-unit-tests-docker.patch-external.yml | 10 +- .../workflows/ci-unit-tests-docker.patch.yml | 2 +- .github/workflows/ci-unit-tests-docker.yml | 5 +- 6 files changed, 128 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/ci-integration-tests-gcp.patch-external.yml diff --git a/.github/workflows/ci-integration-tests-gcp.patch-external.yml b/.github/workflows/ci-integration-tests-gcp.patch-external.yml new file mode 100644 index 00000000000..5f95c4f6d41 --- /dev/null +++ b/.github/workflows/ci-integration-tests-gcp.patch-external.yml @@ -0,0 +1,101 @@ +# Workflow patches for skipping Google Cloud unit test CI on PRs from external repositories. +name: Integration Tests on GCP + +# Run on PRs from external repositories, let them pass, and then Mergify will check them. +# GitHub doesn't support filtering workflows by source branch names, so we have to do it for each +# job. +on: + pull_request: + +# IMPORTANT +# +# These job names must be kept in sync with the `.patch.yml` and `.yml` files. +jobs: + # We don't patch the testnet job, because testnet isn't required to merge (it's too unstable) + get-available-disks: + name: Check if cached state disks exist for Mainnet / Check if cached state disks exist + # Only run on PRs from external repositories. + # (github.ref is always a local branch, so this check will skip non-PRs as well.) + if: ${{ !contains(github.head_ref || github.ref, 'refs/heads/') }} + runs-on: ubuntu-latest + steps: + - run: 'echo "No build required"' + + build: + name: Build CI Docker / Build images + # This dependency allows all these jobs to depend on a single condition, making it easier to + # change. + needs: get-available-disks + runs-on: ubuntu-latest + steps: + - run: 'echo "No build required"' + + test-stateful-sync: + name: Zebra checkpoint update / Run sync-past-checkpoint test + needs: get-available-disks + runs-on: ubuntu-latest + steps: + - run: 'echo "No build required"' + + test-update-sync: + name: Zebra tip update / Run update-to-tip test + needs: get-available-disks + runs-on: ubuntu-latest + steps: + - run: 'echo "No build required"' + + checkpoints-mainnet: + name: Generate checkpoints mainnet / Run checkpoints-mainnet test + needs: get-available-disks + runs-on: ubuntu-latest + steps: + - run: 'echo "No build required"' + + lightwalletd-rpc-test: + name: Zebra tip JSON-RPC / Run fully-synced-rpc test + needs: get-available-disks + runs-on: ubuntu-latest + steps: + - run: 'echo "No build required"' + + lightwalletd-transactions-test: + name: lightwalletd tip send / Run lwd-send-transactions test + needs: get-available-disks + runs-on: ubuntu-latest + steps: + - run: 'echo "No build required"' + + get-block-template-test: + name: get block template / Run get-block-template test + needs: get-available-disks + runs-on: ubuntu-latest + steps: + - run: 'echo "No build required"' + + submit-block-test: + name: submit block / Run submit-block test + needs: get-available-disks + runs-on: ubuntu-latest + steps: + - run: 'echo "No build required"' + + lightwalletd-full-sync: + name: lightwalletd tip / Run lwd-full-sync test + needs: get-available-disks + runs-on: ubuntu-latest + steps: + - run: 'echo "No build required"' + + lightwalletd-update-sync: + name: lightwalletd tip update / Run lwd-update-sync test + needs: get-available-disks + runs-on: ubuntu-latest + steps: + - run: 'echo "No build required"' + + lightwalletd-grpc-test: + name: lightwalletd GRPC tests / Run lwd-grpc-wallet test + needs: get-available-disks + runs-on: ubuntu-latest + steps: + - run: 'echo "No build required"' diff --git a/.github/workflows/ci-integration-tests-gcp.patch.yml b/.github/workflows/ci-integration-tests-gcp.patch.yml index f671429b5bf..faef2491dde 100644 --- a/.github/workflows/ci-integration-tests-gcp.patch.yml +++ b/.github/workflows/ci-integration-tests-gcp.patch.yml @@ -1,7 +1,8 @@ +# Workflow patches for skipping Google Cloud integration test CI when Rust code or dependencies +# aren't modified in a PR. name: Integration Tests on GCP -# These jobs *don't* depend on cached Google Cloud state disks, -# so they can be skipped when the modified files make the actual workflow run. +# Run on PRs with unmodified code and dependency files. on: pull_request: paths-ignore: @@ -25,6 +26,9 @@ on: - '.github/workflows/sub-find-cached-disks.yml' - '.github/workflows/sub-build-docker-image.yml' +# IMPORTANT +# +# These job names must be kept in sync with the `.patch-external.yml` and `.yml` files. jobs: # We don't patch the testnet job, because testnet isn't required to merge (it's too unstable) get-available-disks: diff --git a/.github/workflows/ci-integration-tests-gcp.yml b/.github/workflows/ci-integration-tests-gcp.yml index 1132762c210..32556265bb5 100644 --- a/.github/workflows/ci-integration-tests-gcp.yml +++ b/.github/workflows/ci-integration-tests-gcp.yml @@ -1,3 +1,5 @@ +# Google Cloud integration tests that run when Rust code or dependencies are modified, +# but only on PRs from the ZcashFoundation/zebra repository. (External PRs are tested by mergify.) name: Integration Tests on GCP # Ensures that only one workflow task will run at a time. Previous builds, if @@ -47,6 +49,7 @@ on: default: false pull_request: + # Skip PRs where Rust code and dependencies aren't modified. paths: # code and tests - '**/*.rs' @@ -68,6 +71,7 @@ on: - '.github/workflows/sub-find-cached-disks.yml' push: + # Skip main branch updates where Rust code and dependencies aren't modified. branches: - main paths: @@ -91,6 +95,9 @@ on: - '.github/workflows/sub-find-cached-disks.yml' - '.github/workflows/sub-build-docker-image.yml' +# IMPORTANT +# +# These job names must be kept in sync with the `.patch.yml` and `.patch-external.yml` files. jobs: # to also run a job on Mergify head branches, # add `|| (github.event_name == 'push' && startsWith(github.head_ref, 'mergify/merge-queue/'))`: @@ -104,6 +111,8 @@ jobs: # The outputs for this job have the same names as the workflow outputs in sub-find-cached-disks.yml get-available-disks: name: Check if cached state disks exist for ${{ inputs.network || vars.ZCASH_NETWORK }} + # Skip PRs from external repositories, let them pass, and then Mergify will check them + if: ${{ contains(github.head_ref || github.ref, 'refs/heads/') }} uses: ./.github/workflows/sub-find-cached-disks.yml with: network: ${{ inputs.network || vars.ZCASH_NETWORK }} @@ -114,6 +123,7 @@ jobs: # Some outputs are ignored, because we don't run those jobs on testnet. get-available-disks-testnet: name: Check if cached state disks exist for testnet + if: ${{ contains(github.head_ref || github.ref, 'refs/heads/') }} uses: ./.github/workflows/sub-find-cached-disks.yml with: network: 'Testnet' @@ -125,6 +135,7 @@ jobs: # testnet when running the image. build: name: Build CI Docker + if: ${{ contains(github.head_ref || github.ref, 'refs/heads/') }} uses: ./.github/workflows/sub-build-docker-image.yml with: dockerfile_path: ./docker/Dockerfile diff --git a/.github/workflows/ci-unit-tests-docker.patch-external.yml b/.github/workflows/ci-unit-tests-docker.patch-external.yml index f314a92306c..759a484da2d 100644 --- a/.github/workflows/ci-unit-tests-docker.patch-external.yml +++ b/.github/workflows/ci-unit-tests-docker.patch-external.yml @@ -1,8 +1,9 @@ -# Workflow patches for skipping Google Cloud CI on PRs from external repositories. +# Workflow patches for skipping Google Cloud unit test CI on PRs from external repositories. name: Docker Unit Tests # Run on PRs from external repositories, let them pass, and then Mergify will check them. -# GitHub doesn't support filtering workflows by source branch names, so we have to do it for each job. +# GitHub doesn't support filtering workflows by source branch names, so we have to do it for each +# job. on: pull_request: @@ -12,7 +13,7 @@ on: jobs: build: name: Build CI Docker / Build images - # Only run on PRs from external repositories. + # Only run on PRs from external repositories. # (github.ref is always a local branch, so this check will skip non-PRs as well.) if: ${{ !contains(github.head_ref || github.ref, 'refs/heads/') }} runs-on: ubuntu-latest @@ -21,7 +22,8 @@ jobs: test-all: name: Test all - # This dependency allows all these jobs to depend on a single condition, making it easier to change. + # This dependency allows all these jobs to depend on a single condition, making it easier to + # change. needs: build runs-on: ubuntu-latest steps: diff --git a/.github/workflows/ci-unit-tests-docker.patch.yml b/.github/workflows/ci-unit-tests-docker.patch.yml index 633752485cd..a485f3155a1 100644 --- a/.github/workflows/ci-unit-tests-docker.patch.yml +++ b/.github/workflows/ci-unit-tests-docker.patch.yml @@ -1,4 +1,4 @@ -# Workflow patches for skipping CI when Rust code and dependencies aren't modified in a PR. +# Workflow patches for skipping unit test CI when Rust code or dependencies aren't modified in a PR. name: Docker Unit Tests # Run on PRs with unmodified code and dependency files. diff --git a/.github/workflows/ci-unit-tests-docker.yml b/.github/workflows/ci-unit-tests-docker.yml index 466718f6df2..309f05868d0 100644 --- a/.github/workflows/ci-unit-tests-docker.yml +++ b/.github/workflows/ci-unit-tests-docker.yml @@ -1,4 +1,5 @@ -# Google Cloud CI that runs when Rust code and dependencies are modified in a PR from the ZcashFoundation/zebra repository. +# Google Cloud unit tests that run when Rust code or dependencies are modified, +# but only on PRs from the ZcashFoundation/zebra repository. (External PRs are tested by mergify.) name: Docker Unit Tests # Ensures that only one workflow task will run at a time. Previous builds, if @@ -46,7 +47,7 @@ on: push: branches: - main - # Skip main branch merges where Rust code and dependencies aren't modified. + # Skip main branch updates where Rust code and dependencies aren't modified. paths: # code and tests - '**/*.rs'