feat(ci): cancel old CI jobs on PR updates #1831
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Papyrus-CI | |
on: | |
push: | |
branches: [main] | |
paths: | |
- '.github/workflows/papyrus_ci.yml' | |
- 'Dockerfile' | |
- 'papyrus_utilities.Dockerfile' | |
- 'Cargo.toml' | |
- 'Cargo.lock' | |
- 'crates/papyrus**/**' | |
- 'crates/sequencing/**' | |
- 'crates/starknet_client/**' | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- auto_merge_enabled | |
- edited # for when the PR title is edited | |
paths: | |
- '.github/workflows/papyrus_ci.yml' | |
- 'Dockerfile' | |
- 'papyrus_utilities.Dockerfile' | |
- 'Cargo.toml' | |
- 'Cargo.lock' | |
- 'crates/papyrus**/**' | |
- 'crates/sequencing/**' | |
- 'crates/starknet_client/**' | |
merge_group: | |
types: [checks_requested] | |
# On PR events, cancel existing CI runs on this same PR for this workflow. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.event.name == 'pull_request' }} | |
env: | |
PROTOC_VERSION: v25.1 | |
jobs: | |
executable-run: | |
runs-on: starkware-ubuntu-latest-medium | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/install_rust | |
- uses: Swatinem/rust-cache@v2 | |
- uses: Noelware/[email protected] | |
with: | |
version: ${{env.PROTOC_VERSION}} | |
- name: Build node | |
run: | | |
mkdir data | |
cargo build -r -p papyrus_node | |
- name: Run executable | |
run: > | |
target/release/papyrus_node --base_layer.node_url ${{ secrets.CI_BASE_LAYER_NODE_URL }} | |
& sleep 30 ; kill $! | |
executable-run-no-rpc: | |
runs-on: starkware-ubuntu-latest-medium | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/install_rust | |
- uses: Swatinem/rust-cache@v2 | |
- uses: Noelware/[email protected] | |
with: | |
version: ${{env.PROTOC_VERSION}} | |
- name: Build node | |
run: | | |
mkdir data | |
cargo build -r -p papyrus_node --no-default-features | |
- name: Run executable | |
run: > | |
target/release/papyrus_node --base_layer.node_url ${{ secrets.CI_BASE_LAYER_NODE_URL }} | |
& sleep 30 ; kill $! | |
integration-test: | |
runs-on: starkware-ubuntu-latest-medium | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/install_rust | |
- uses: Swatinem/rust-cache@v2 | |
- uses: Noelware/[email protected] | |
with: | |
version: ${{env.PROTOC_VERSION}} | |
- run: > | |
cargo test -r | |
--test latency_histogram | |
--test gateway_integration_test | |
--test feeder_gateway_integration_test | |
-- --include-ignored --skip test_gw_integration_testnet; | |
cargo run -r -p papyrus_node --bin central_source_integration_test --features="futures-util tokio-stream" | |
test-no-rpc: | |
runs-on: starkware-ubuntu-latest-medium | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/install_rust | |
- uses: Swatinem/rust-cache@v2 | |
- uses: Noelware/[email protected] | |
- run: | | |
cargo test -p papyrus_node --no-default-features | |
env: | |
SEED: 0 | |
check-starknet_api-dependency: | |
runs-on: starkware-ubuntu-latest-small | |
if: github.base_ref == 'main' # this step is only run if the pr is to the main branch | |
steps: | |
- uses: actions/checkout@v4 | |
- run: sudo apt-get install jq | |
- run: ./check_starknet_api_version_dependency.sh # this script checks that if the starknet_api dependency is by git rev then this rev (commit) is on main | |
build-papyrus-utilities-image: | |
runs-on: starkware-ubuntu-latest-medium | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Papyrus utilites docker image | |
uses: docker/[email protected] | |
continue-on-error: true # ignore the failure of a step and avoid terminating the job. | |
with: | |
push: false | |
context: . | |
file: papyrus_utilities.Dockerfile | |
cache-from: type=gha,scope=buildkit-ci | |
cache-to: type=gha,mode=max,scope=buildkit-ci | |
random-table-test: | |
runs-on: starkware-ubuntu-latest-medium | |
steps: | |
- uses: actions/checkout@v4 | |
# run this job only if the path 'crates/papyrus_storage/src/db/**' is changed, because it takes around 2 minutes. | |
- uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
# The 'base' and 'ref' parameters are set to be able to run the job in a 'merge_group' event. in a 'pull_request' event | |
# those parameters are ignored. | |
base: ${{ github.event.merge_group.base_ref}} | |
ref: ${{ github.event.merge_group.head_ref }} | |
filters: | | |
target_directory: | |
- 'crates/papyrus_storage/src/db/**' | |
- uses: ./.github/actions/install_rust | |
- uses: Swatinem/rust-cache@v2 | |
# repeat this job 32 times. this is a random test for part of the code that may cause a corrupted database. | |
- run: for run in {1..32}; do cargo test -r -p papyrus_storage -- --include-ignored common_prefix_compare_with_simple_table_random; done | |
if: steps.changes.outputs.target_directory == 'true' |