Metrics-based bad token detector #12497
Workflow file for this run
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: pull request | |
on: | |
pull_request: | |
# We require PRs to be up to date before merging so technically it is not needed run the rust job | |
# on main. However for the cache to be usable in PRs we do need the job on main. | |
push: | |
branches: [ main ] | |
jobs: | |
lint: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- run: rustup toolchain install stable --profile minimal | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly | |
components: rustfmt | |
- run: | | |
rustup --version | |
rustup show | |
cargo --version | |
cargo +nightly fmt --version | |
cargo clippy --version | |
- run: cargo +nightly fmt --all -- --check | |
- run: cargo clippy --locked --workspace --all-features --all-targets -- -D warnings | |
nitpicker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: ethanis/nitpicker@v1 | |
with: | |
nitpicks: ".github/nitpicks.yml" | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
doc-tests: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- run: rustup toolchain install stable --profile minimal | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo test --doc | |
unit-tests: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
env: | |
# Shrink artifact size by not including debug info. Makes build faster and shrinks cache. | |
CARGO_PROFILE_DEV_DEBUG: 0 | |
CARGO_PROFILE_TEST_DEBUG: 0 | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- run: rustup toolchain install stable --profile minimal | |
- uses: Swatinem/rust-cache@v2 | |
- uses: taiki-e/install-action@nextest | |
- run: cargo build --tests | |
- run: cargo nextest run | |
test-db: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
env: | |
# Shrink artifact size by not including debug info. Makes build faster and shrinks cache. | |
CARGO_PROFILE_DEV_DEBUG: 0 | |
CARGO_PROFILE_TEST_DEBUG: 0 | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- run: rustup toolchain install stable --profile minimal | |
- uses: Swatinem/rust-cache@v2 | |
# Start the build process in the background. The following cargo test command will automatically | |
# wait for the build process to be done before proceeding. | |
- run: cargo build -p orderbook -p database -p autopilot --tests & | |
- uses: taiki-e/install-action@nextest | |
- uses: yu-ichiro/spin-up-docker-compose-action@v1 | |
with: | |
file: docker-compose.yaml | |
up-opts: -d db migrations | |
- run: cargo nextest run postgres -p orderbook -p database -p autopilot --test-threads 1 --run-ignored ignored-only | |
test-local-node: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
env: | |
# Shrink artifact size by not including debug info. Makes build faster and shrinks cache. | |
CARGO_PROFILE_DEV_DEBUG: 0 | |
CARGO_PROFILE_TEST_DEBUG: 0 | |
CARGO_TERM_COLOR: always | |
TOML_TRACE_ERROR: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- run: rustup toolchain install stable --profile minimal | |
- uses: foundry-rs/foundry-toolchain@v1 | |
- uses: Swatinem/rust-cache@v2 | |
# Start the build process in the background. The following cargo test command will automatically | |
# wait for the build process to be done before proceeding. | |
- run: cargo build -p e2e --tests & | |
- uses: taiki-e/install-action@nextest | |
- uses: yu-ichiro/spin-up-docker-compose-action@v1 | |
with: | |
file: docker-compose.yaml | |
up-opts: -d db migrations | |
- run: cargo nextest run -p e2e local_node --test-threads 1 --failure-output final --run-ignored ignored-only | |
test-forked-node: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
env: | |
# Shrink artifact size by not including debug info. Makes build faster and shrinks cache. | |
CARGO_PROFILE_DEV_DEBUG: 0 | |
CARGO_PROFILE_TEST_DEBUG: 0 | |
CARGO_TERM_COLOR: always | |
FORK_URL_MAINNET: ${{ secrets.FORK_URL_MAINNET }} | |
FORK_URL_GNOSIS: ${{ secrets.FORK_URL_GNOSIS }} | |
TOML_TRACE_ERROR: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- run: rustup toolchain install stable --profile minimal | |
- uses: foundry-rs/foundry-toolchain@v1 | |
- uses: Swatinem/rust-cache@v2 | |
# Start the build process in the background. The following cargo test command will automatically | |
# wait for the build process to be done before proceeding. | |
- run: cargo build -p e2e --tests & | |
- uses: taiki-e/install-action@nextest | |
- uses: yu-ichiro/spin-up-docker-compose-action@v1 | |
with: | |
file: docker-compose.yaml | |
up-opts: -d db migrations | |
- run: cargo nextest run -p e2e forked_node --test-threads 1 --run-ignored ignored-only --failure-output final | |
test-driver: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
env: | |
# Shrink artifact size by not including debug info. Makes build faster and shrinks cache. | |
CARGO_PROFILE_DEV_DEBUG: 0 | |
CARGO_PROFILE_TEST_DEBUG: 0 | |
CARGO_TERM_COLOR: always | |
TOML_TRACE_ERROR: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- run: rustup toolchain install stable --profile minimal | |
- uses: foundry-rs/foundry-toolchain@v1 | |
- uses: Swatinem/rust-cache@v2 | |
- uses: taiki-e/install-action@nextest | |
# Build the driver's tests. | |
- run: cargo build -p driver --tests | |
# Don't spawn any docker containers. The driver's tests will spawn anvil itself. | |
- run: cargo nextest run -p driver --run-ignored ignored-only | |
openapi: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- run: npm install @apidevtools/swagger-cli @stoplight/spectral-cli | |
- run: node_modules/.bin/swagger-cli validate crates/orderbook/openapi.yml | |
- run: node_modules/.bin/swagger-cli validate crates/driver/openapi.yml | |
- run: node_modules/.bin/swagger-cli validate crates/solvers/openapi.yml | |
- run: node_modules/.bin/spectral lint crates/orderbook/openapi.yml | |
- run: node_modules/.bin/spectral lint crates/driver/openapi.yml | |
- run: node_modules/.bin/spectral lint crates/solvers/openapi.yml | |
run-flaky-test: | |
# to debug a flaky test set `if` to true and configure the flaky test in the `run` step | |
if: ${{ false }} | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
env: | |
# Shrink artifact size by not including debug info. Makes build faster and shrinks cache. | |
CARGO_PROFILE_DEV_DEBUG: 0 | |
CARGO_PROFILE_TEST_DEBUG: 0 | |
CARGO_TERM_COLOR: always | |
TOML_TRACE_ERROR: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- run: rustup toolchain install stable --profile minimal | |
- uses: foundry-rs/foundry-toolchain@v1 | |
- uses: Swatinem/rust-cache@v2 | |
# Start the build process in the background. The following cargo test command will automatically | |
# wait for the build process to be done before proceeding. | |
- run: cargo build -p e2e --tests & | |
- uses: taiki-e/install-action@nextest | |
- uses: yu-ichiro/spin-up-docker-compose-action@v1 | |
with: | |
file: docker-compose.yaml | |
up-opts: -d db migrations | |
- name: Run test in a loop | |
run: | | |
attempt=1 | |
while true; do | |
echo "Running test attempt #$attempt" | |
if ! cargo nextest run -p e2e local_node --test-threads 1 --failure-output final --run-ignored ignored-only; then | |
exit 1 | |
fi | |
attempt=$((attempt+1)) | |
done |