Skip to content

Commit

Permalink
ci: faster test workflow (foundry-rs#1016)
Browse files Browse the repository at this point in the history
* ci: split test workflow

* build: configure cargo build

Optimizes for (in order, for release):

- Build size
- Speed

And for tests:

- Build speed
- Test speed

* ci: require that lockfile is up to date

* ci: use `--all` on fmt and clippy

* build: remove unused dep
  • Loading branch information
onbjerg authored Mar 22, 2022
1 parent 5249258 commit bf448ab
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 27 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ jobs:
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Build binaries
env:
RUSTFLAGS: -C link-args=-s
uses: actions-rs/cargo@v1
with:
command: build
Expand Down
47 changes: 43 additions & 4 deletions .github/workflows/unit-tests.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
- master
pull_request:

name: Tests
name: test

jobs:
tests-stable:
name: Tests (Stable)
unit:
name: unit tests
runs-on: ubuntu-latest
env:
ETH_RPC_URL: https://eth-mainnet.alchemyapi.io/v2/Lc7oIGYeL_QvInzI0Wiu_pOZZDEKBrdf
Expand All @@ -25,13 +25,52 @@ jobs:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
with:
cache-on-failure: true

- name: cargo test
run: cargo test --locked --workspace --all-features --lib --bins

doc:
name: doc tests
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
with:
cache-on-failure: true

- name: cargo test
run: cargo test --locked --workspace --all-features --doc

integration:
name: integration tests
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Clone testdata for fmt tests
run: make fmt-testdata
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
with:
cache-on-failure: true

- name: cargo test
run: cargo test --all --all-features
run: cargo test --locked --workspace --all-features --test '*'

lint:
runs-on: ubuntu-latest
Expand Down
16 changes: 0 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,22 @@ members = [
"fmt",
]

# Binary size optimizations
[profile.test]
# Speeds up build
debug = 0
# Speeds up tests
opt-level = 3

[profile.release]
opt-level = "z"
lto = true
# Optimize for binary size, but keep loop vectorization
opt-level = "s"
strip = true
# Performance optimizations
lto = "fat"
codegen-units = 1
panic = "abort"
debug = true
# We end up stripping away these symbols anyway
debug = 0

## Patch sputnik with more recent primitive types
# https://github.com/rust-blockchain/evm/pulls
Expand Down
1 change: 0 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ proptest = "1.0.0"
glob = "0.3.0"
semver = "1.0.5"
once_cell = "1.9.0"
locate-cargo-manifest = "0.2.2"
walkdir = "2.3.2"
solang-parser = "0.1.2"
similar = { version = "2.1.0", features = ["inline"] }
Expand Down

0 comments on commit bf448ab

Please sign in to comment.