Skip to content

Commit

Permalink
ref(ci): Use a single CI workflow for tests (#8575)
Browse files Browse the repository at this point in the history
* ref(ci): Use a single CI workflow for tests

This is an initial implementation to solve the re-building of our Docker image, which is being built multiple times by our Github Actions.

This is meant to fix -> devops: Build CI Docker runs twice for every PR #7816

* fix(patch): use correct name reference

* chore: reduce diff with correct sentence

* Apply suggestions from code review

Co-authored-by: Marek <[email protected]>

* Apply suggestions from code review

Co-authored-by: Marek <[email protected]>

* fix(rules): revert job names, to avoid creating an extra rule

* Update .github/workflows/ci-tests.patch.yml

Co-authored-by: Marek <[email protected]>

---------

Co-authored-by: Marek <[email protected]>
  • Loading branch information
gustavovalverde and upbqdn authored Jun 10, 2024
1 parent 8437fdb commit 55c6992
Show file tree
Hide file tree
Showing 7 changed files with 325 additions and 420 deletions.
Original file line number Diff line number Diff line change
@@ -1,115 +1,139 @@
# Workflow patches for skipping Google Cloud unit test CI on PRs from external repositories.
name: Integration Tests on GCP
# Workflow patches for skipping CI tests on PRs from external repositories
name: Run 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.
on:
pull_request:

# IMPORTANT
#
# The job names in `ci-integration-tests-gcp.yml`, `ci-integration-tests-gcp.patch.yml` and
# `ci-integration-tests-gcp.patch-external.yml` must be kept in sync.
#! IMPORTANT
#!
#! The job names in `sub-ci-unit-tests-docker.yml`, `sub-ci-integration-tests-gcp.yml`,
#! `ci-tests.patch.yml` and `ci-tests.patch-external.yml` must be kept in sync.
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
build:
name: Build CI Docker / Build images
# Only run on PRs from external repositories.
if: ${{ startsWith(github.event_name, 'pull') && github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'

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
####
## The following jobs are related to sub-ci-unit-tests-docker.yml
###
test-all:
name: Test all
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'

test-fake-activation-heights:
name: Test with fake activation heights
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'

test-empty-sync:
name: Test checkpoint sync from empty state
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'

test-lightwalletd-integration:
name: Test integration with lightwalletd
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'

test-configuration-file:
name: Test CI default Docker config file / Test default-conf in Docker
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'

test-configuration-file-testnet:
name: Test CI testnet Docker config file / Test default-conf in Docker
needs: build
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'

test-zebra-conf-path:
name: Test CI custom Docker config file / Test custom-conf in Docker
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'


####
## The following jobs are related to sub-ci-integration-tests-gcp.yml
###

# 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
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'

test-stateful-sync:
name: Zebra checkpoint update / Run sync-past-checkpoint test
needs: get-available-disks
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'

test-update-sync:
name: Zebra tip update / Run update-to-tip test
needs: get-available-disks
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'

checkpoints-mainnet:
name: Generate checkpoints mainnet / Run checkpoints-mainnet test
needs: get-available-disks
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'

lightwalletd-rpc-test:
name: Zebra tip JSON-RPC / Run fully-synced-rpc test
needs: get-available-disks
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'

lightwalletd-transactions-test:
name: lightwalletd tip send / Run lwd-send-transactions test
needs: get-available-disks
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'

get-block-template-test:
name: get block template / Run get-block-template test
needs: get-available-disks
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'

submit-block-test:
name: submit block / Run submit-block test
needs: get-available-disks
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'

scan-start-where-left-test:
name: Scan starts where left / Run scan-start-where-left test
needs: get-available-disks
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

scan-task-commands:
name: scan task commands / Run scan-task-commands 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 "Skipping job on fork"'

lightwalletd-update-sync:
name: lightwalletd tip update / Run lwd-update-sync test
needs: get-available-disks
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'

lightwalletd-grpc-test:
name: lightwalletd GRPC tests / Run lwd-grpc-wallet test
needs: get-available-disks
runs-on: ubuntu-latest
steps:
- run: 'echo "Skipping job on fork"'
Original file line number Diff line number Diff line change
@@ -1,45 +1,98 @@
# Workflow patches for skipping Google Cloud integration test CI when Rust code or dependencies
# Workflow patches for skipping CI tests when Rust code or dependencies
# aren't modified in a PR.
name: Integration Tests on GCP
name: Run tests

# Run on PRs with unmodified code and dependency files.
on:
pull_request:
paths-ignore:
# code and tests
- '**/*.rs'
- "**/*.rs"
# hard-coded checkpoints and proptest regressions
- '**/*.txt'
- "**/*.txt"
# test data snapshots
- '**/*.snap'
- "**/*.snap"
# dependencies
- '**/Cargo.toml'
- '**/Cargo.lock'
- "**/Cargo.toml"
- "**/Cargo.lock"
# configuration files
- '.cargo/config.toml'
- '**/clippy.toml'
- ".cargo/config.toml"
- "**/clippy.toml"
# workflow definitions
- 'docker/**'
- '.dockerignore'
- '.github/workflows/ci-unit-tests-docker.yml'
- '.github/workflows/sub-deploy-integration-tests-gcp.yml'
- '.github/workflows/sub-find-cached-disks.yml'
- '.github/workflows/sub-build-docker-image.yml'

# IMPORTANT
#
# The job names in `ci-integration-tests-gcp.yml`, `ci-integration-tests-gcp.patch.yml` and
# `ci-integration-tests-gcp.patch-external.yml` must be kept in sync.
- "docker/**"
- ".dockerignore"
- ".github/workflows/ci-tests.yml"
- ".github/workflows/sub-ci-unit-tests-docker.yml"
- ".github/workflows/sub-ci-integration-tests-gcp.yml"
- ".github/workflows/sub-deploy-integration-tests-gcp.yml"
- ".github/workflows/sub-find-cached-disks.yml"
- ".github/workflows/sub-build-docker-image.yml"

#! IMPORTANT
#!
#! The job names in `sub-ci-unit-tests-docker.yml`, `sub-ci-integration-tests-gcp.yml`,
#! `ci-tests.patch.yml` and `ci-tests.patch-external.yml` must be kept in sync.
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
build:
name: Build CI Docker / Build images
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

build:
name: Build CI Docker / Build images
####
## The following jobs are related to sub-ci-unit-tests-docker.yml
###
test-all:
name: Test all
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

test-fake-activation-heights:
name: Test with fake activation heights
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

test-empty-sync:
name: Test checkpoint sync from empty state
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

test-lightwalletd-integration:
name: Test integration with lightwalletd
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

test-configuration-file:
name: Test CI default Docker config file / Test default-conf in Docker
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

test-configuration-file-testnet:
name: Test CI testnet Docker config file / Test default-conf in Docker
needs: build
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

test-zebra-conf-path:
name: Test CI custom Docker config file / Test custom-conf in Docker
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'


####
## The following jobs are related to sub-ci-integration-tests-gcp.yml
###

# 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
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'
Expand Down
Loading

0 comments on commit 55c6992

Please sign in to comment.