Skip to content

Make cargo bench part of CI to ensure we don’t accidentally introduce performance regressions #1042

Make cargo bench part of CI to ensure we don’t accidentally introduce performance regressions

Make cargo bench part of CI to ensure we don’t accidentally introduce performance regressions #1042

Workflow file for this run

name: CI Checks
env:
RUST_VERSION: 1.68.0
DFX_VERSION: 0.13.1
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
run: |
wget --output-document install-dfx.sh "https://internetcomputer.org/install.sh"
bash install-dfx.sh < <(yes Y)
rm install-dfx.sh
dfx cache install
echo "$HOME/bin" >> $GITHUB_PATH
- 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
run: |
wget --output-document install-dfx.sh "https://internetcomputer.org/install.sh"
bash install-dfx.sh < <(yes Y)
rm install-dfx.sh
dfx cache install
echo "$HOME/bin" >> $GITHUB_PATH
- 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
run: |
wget --output-document install-dfx.sh "https://internetcomputer.org/install.sh"
bash install-dfx.sh < <(yes Y)
rm install-dfx.sh
dfx cache install
echo "$HOME/bin" >> $GITHUB_PATH
- 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
run: |
wget --output-document install-dfx.sh "https://internetcomputer.org/install.sh"
bash install-dfx.sh < <(yes Y)
rm install-dfx.sh
dfx cache install
echo "$HOME/bin" >> $GITHUB_PATH
- 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
run: |
wget --output-document install-dfx.sh "https://internetcomputer.org/install.sh"
bash install-dfx.sh < <(yes Y)
rm install-dfx.sh
dfx cache install
echo "$HOME/bin" >> $GITHUB_PATH
- 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
run: |
wget --output-document install-dfx.sh "https://internetcomputer.org/install.sh"
bash install-dfx.sh < <(yes Y)
rm install-dfx.sh
dfx cache install
echo "$HOME/bin" >> $GITHUB_PATH
- 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
run: |
wget --output-document install-dfx.sh "https://internetcomputer.org/install.sh"
bash install-dfx.sh < <(yes Y)
rm install-dfx.sh
dfx cache install
echo "$HOME/bin" >> $GITHUB_PATH
- name: Run set_config test
run: |
bash e2e-tests/set_config.sh
benchmark:
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
run: |
wget --output-document install-dfx.sh "https://internetcomputer.org/install.sh"
bash install-dfx.sh < <(yes Y)
rm install-dfx.sh
dfx cache install
echo "$HOME/bin" >> $GITHUB_PATH
- name: Run set_config test
run: |
bash e2e-tests/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
run: |
wget --output-document install-dfx.sh "https://internetcomputer.org/install.sh"
bash install-dfx.sh < <(yes Y)
rm install-dfx.sh
dfx cache install
echo "$HOME/bin" >> $GITHUB_PATH
- 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
run: |
wget --output-document install-dfx.sh "https://internetcomputer.org/install.sh"
bash install-dfx.sh < <(yes Y)
rm install-dfx.sh
dfx cache install
echo "$HOME/bin" >> $GITHUB_PATH
- 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
run: |
wget --output-document install-dfx.sh "https://internetcomputer.org/install.sh"
bash install-dfx.sh < <(yes Y)
rm install-dfx.sh
dfx cache install
echo "$HOME/bin" >> $GITHUB_PATH
- 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
run: |
wget --output-document install-dfx.sh "https://internetcomputer.org/install.sh"
bash install-dfx.sh < <(yes Y)
rm install-dfx.sh
dfx cache install
echo "$HOME/bin" >> $GITHUB_PATH
- 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:
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
- benchmark
- watchdog_health_status
- watchdog_get_config
- watchdog_metrics
- watchdog_upgradability
- canister-build-reproducibility
runs-on: ubuntu-20.04
steps:
- name: Checks workflow passes
run: echo OK