Skip to content

fix: canbench can run in dependabot PRs (part 2) #1203

fix: canbench can run in dependabot PRs (part 2)

fix: canbench can run in dependabot PRs (part 2) #1203

Workflow file for this run

name: CI Checks
env:
RUST_VERSION: 1.76.0
DFX_VERSION: 0.16.0
on:
push:
branches:
- main
pull_request:
jobs:
cargo-build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04, macos-12 ]
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install Rust
run: |
rustup update $RUST_VERSION --no-self-update
rustup default $RUST_VERSION
rustup target add wasm32-unknown-unknown
- name: Build
shell: bash
run: |
cargo build --release --all-targets
cd bootstrap/main-state-builder
cargo build --release --all-targets
env:
RUST_BACKTRACE: 1
cargo-tests:
runs-on: ${{ matrix.os }}
needs: cargo-build
strategy:
matrix:
os: [ ubuntu-20.04, macos-12 ]
steps:
- uses: actions/checkout@v3
with:
lfs: true
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install Rust
run: |
rustup update $RUST_VERSION --no-self-update
rustup default $RUST_VERSION
rustup target add wasm32-unknown-unknown
- name: Run Tests
shell: bash
run: |
cargo test --release --all-targets --workspace --exclude benchmarks
env:
RUST_BACKTRACE: 1
cargo-clippy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install Rust + Clippy
run: |
rustup update $RUST_VERSION --no-self-update
rustup default $RUST_VERSION
rustup target add wasm32-unknown-unknown
rustup component add clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets -- -D warnings
rustfmt:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install Rust + Clippy
run: |
rustup update $RUST_VERSION --no-self-update
rustup default $RUST_VERSION
- name: Install Rust + Rustfmt
run: |
rustup update $RUST_VERSION --no-self-update
rustup default $RUST_VERSION
rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
shell-checks:
name: ShellCheck
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -e SC1090 -e SC2119 -e SC1091
e2e-scenario-1:
runs-on: ubuntu-20.04
needs: cargo-build
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install Rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
rustup target add wasm32-unknown-unknown
- name: Install dfx
uses: dfinity/setup-dfx@main
with:
dfx-version: $DFX_VERSION
- name: Run scenario 1
run: |
bash e2e-tests/scenario-1.sh
e2e-scenario-2:
runs-on: ubuntu-20.04
needs: cargo-build
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install Rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
rustup target add wasm32-unknown-unknown
- name: Install dfx
uses: dfinity/setup-dfx@main
with:
dfx-version: $DFX_VERSION
- name: Run scenario 2
run: |
bash e2e-tests/scenario-2.sh
e2e-scenario-3:
runs-on: ubuntu-20.04
needs: cargo-build
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install Rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
rustup target add wasm32-unknown-unknown
- name: Install dfx
uses: dfinity/setup-dfx@main
with:
dfx-version: $DFX_VERSION
- name: Run scenario 3
run: |
bash e2e-tests/scenario-3.sh
e2e-disable-api-if-not-fully-synced-flag:
runs-on: ubuntu-20.04
needs: cargo-build
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install Rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
rustup target add wasm32-unknown-unknown
- name: Install dfx
uses: dfinity/setup-dfx@main
with:
dfx-version: $DFX_VERSION
- name: Run disable api if not fully synced flag
run: |
bash e2e-tests/disable-api-if-not-fully-synced-flag.sh
charge-cycles-on-reject:
runs-on: ubuntu-20.04
needs: cargo-build
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install Rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
rustup target add wasm32-unknown-unknown
- name: Install dfx
uses: dfinity/setup-dfx@main
with:
dfx-version: $DFX_VERSION
- name: Run charge cycles on reject
run: |
bash e2e-tests/charge-cycles-on-reject.sh
upgradability:
runs-on: ubuntu-20.04
needs: cargo-build
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install Rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
rustup target add wasm32-unknown-unknown
- name: Install dfx
uses: dfinity/setup-dfx@main
with:
dfx-version: $DFX_VERSION
- name: Run upgradability test
run: |
bash e2e-tests/upgradability.sh
set_config:
runs-on: ubuntu-20.04
needs: cargo-build
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install Rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
rustup target add wasm32-unknown-unknown
- name: Install dfx
uses: dfinity/setup-dfx@main
with:
dfx-version: $DFX_VERSION
- name: Run set_config test
run: |
bash e2e-tests/set_config.sh
cycles_burn:
runs-on: ubuntu-20.04
needs: cargo-build
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install Rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
rustup target add wasm32-unknown-unknown
- name: Install dfx
uses: dfinity/setup-dfx@main
with:
dfx-version: $DFX_VERSION
- name: Run cycles_burn test
run: bash e2e-tests/cycles_burn.sh
benchmark:
runs-on: ubuntu-latest
needs: cargo-build
env:
PROJECT_DIR: .
steps:
- name: Checkout current PR
uses: actions/checkout@v4
- name: Checkout master branch
uses: actions/checkout@v4
with:
ref: master
path: _canbench_main_branch
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install Rust
run: |
rustup update $RUST_VERSION --no-self-update
rustup default $RUST_VERSION
rustup target add wasm32-unknown-unknown
- name: Benchmark
run: |
bash ./scripts/canbench_ci_run_benchmark.sh $PROJECT_DIR ${{ github.job }}
- uses: actions/upload-artifact@v4
with:
name: canbench_result_${{github.job}}
path: /tmp/canbench_result_${{ github.job }}
- name: Save PR number
run: |
echo ${{ github.event.number }} > /tmp/pr_number
- uses: actions/upload-artifact@v4
with:
name: pr_number
path: /tmp/pr_number
- name: Pass or fail
run: |
bash ./scripts/canbench_ci_post_run_benchmark.sh
watchdog_health_status:
runs-on: ubuntu-20.04
needs: cargo-build
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install Rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
rustup target add wasm32-unknown-unknown
- name: Install dfx
uses: dfinity/setup-dfx@main
with:
dfx-version: $DFX_VERSION
- name: Run health_status test
run: |
bash watchdog/e2e-tests/health_status.sh
watchdog_get_config:
runs-on: ubuntu-20.04
needs: cargo-build
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install Rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
rustup target add wasm32-unknown-unknown
- name: Install dfx
uses: dfinity/setup-dfx@main
with:
dfx-version: $DFX_VERSION
- name: Run get_config test
run: |
bash watchdog/e2e-tests/get_config.sh
watchdog_metrics:
runs-on: ubuntu-20.04
needs: cargo-build
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install Rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
rustup target add wasm32-unknown-unknown
- name: Install dfx
uses: dfinity/setup-dfx@main
with:
dfx-version: $DFX_VERSION
- name: Run metrics test
run: |
bash watchdog/e2e-tests/metrics.sh
watchdog_upgradability:
runs-on: ubuntu-20.04
needs: cargo-build
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install Rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
rustup target add wasm32-unknown-unknown
- name: Install dfx
uses: dfinity/setup-dfx@main
with:
dfx-version: $DFX_VERSION
- name: Run upgradability test
run: |
bash watchdog/e2e-tests/upgradability.sh
canister-build-reproducibility:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Verify Reproducibility
run: |
./e2e-tests/reproducibility.sh Dockerfile
checks-pass:
# Always run this job!
if: always()
needs: [cargo-tests, shell-checks, cargo-clippy, rustfmt, e2e-disable-api-if-not-fully-synced-flag, e2e-scenario-1, e2e-scenario-2,
e2e-scenario-3, charge-cycles-on-reject, upgradability, set_config, cycles_burn, benchmark, watchdog_health_status,
watchdog_get_config, watchdog_metrics, watchdog_upgradability, canister-build-reproducibility]
runs-on: ubuntu-20.04
steps:
- name: check cargo-tests result
if: ${{ needs.cargo-tests.result != 'success' }}
run: exit 1
- name: check shell-checks result
if: ${{ needs.shell-checks.result != 'success' }}
run: exit 1
- name: check cargo-clippy result
if: ${{ needs.cargo-clippy.result != 'success' }}
run: exit 1
- name: check rustfmt result
if: ${{ needs.rustfmt.result != 'success' }}
run: exit 1
- name: check e2e-disable-api-if-not-fully-synced-flag result
if: ${{ needs.e2e-disable-api-if-not-fully-synced-flag.result != 'success' }}
run: exit 1
- name: check e2e-scenario-1 result
if: ${{ needs.e2e-scenario-1.result != 'success' }}
run: exit 1
- name: check e2e-scenario-2 result
if: ${{ needs.e2e-scenario-2.result != 'success' }}
run: exit 1
- name: check e2e-scenario-3 result
if: ${{ needs.e2e-scenario-3.result != 'success' }}
run: exit 1
- name: check charge-cycles-on-reject result
if: ${{ needs.charge-cycles-on-reject.result != 'success' }}
run: exit 1
- name: check upgradability result
if: ${{ needs.upgradability.result != 'success' }}
run: exit 1
- name: check set_config result
if: ${{ needs.set_config.result != 'success' }}
run: exit 1
- name: check cycles_burn result
if: ${{ needs.cycles_burn.result != 'success' }}
run: exit 1
- name: check benchmark result
if: ${{ needs.benchmark.result != 'success' }}
run: exit 1
- name: check watchdog_health_status result
if: ${{ needs.watchdog_health_status.result != 'success' }}
run: exit 1
- name: check watchdog_get_config result
if: ${{ needs.watchdog_get_config.result != 'success' }}
run: exit 1
- name: check watchdog_metrics result
if: ${{ needs.watchdog_metrics.result != 'success' }}
run: exit 1
- name: check watchdog_upgradability result
if: ${{ needs.watchdog_upgradability.result != 'success' }}
run: exit 1
- name: check canister-build-reproducibility result
if: ${{ needs.canister-build-reproducibility.result != 'success' }}
run: exit 1