-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
55 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
--- | ||
name: Task - Rust Tests & Coverage | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request_target: | ||
branches: | ||
- main | ||
types: [opened, synchronize, reopened] | ||
push: | ||
branches-ignore: | ||
- main | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
coverage: | ||
# sadly, for now we have to "rebuild" for the coverage | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
|
@@ -26,23 +31,61 @@ jobs: | |
- 27017:27017 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/checkout@v3 | ||
|
||
# selecting a toolchain either by action or manual `rustup` calls should happen | ||
# before the plugin, as the cache uses the current rustc version as its cache key | ||
- run: rustup show | ||
- name: Cache Rust dependencies | ||
uses: actions/cache@v3 | ||
id: cache | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
target | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo- | ||
- uses: taiki-e/install-action@cargo-llvm-cov | ||
- uses: taiki-e/install-action@nextest | ||
- name: Check cache status | ||
run: | | ||
if ${{ steps.cache.outputs.cache-hit == 'true' }}; then | ||
echo "Cache hit! Using cached dependencies." | ||
else | ||
echo "Cache miss. Building dependencies from scratch." | ||
fi | ||
- name: Rust Cache | ||
uses: Swatinem/[email protected] | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Install cargo-llvm-cov and nextest | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cargo-llvm-cov,nextest | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
|
||
- name: Check Anvil Installation | ||
run: | | ||
if command -v anvil &> /dev/null | ||
then | ||
echo "Anvil is installed. Version information:" | ||
anvil --version | ||
else | ||
echo "Anvil is not installed or not in PATH" | ||
exit 1 | ||
fi | ||
- name: Clean workspace | ||
run: | | ||
cargo llvm-cov clean --workspace | ||
- name: Run llvm-cov | ||
env: | ||
ETHEREUM_BLAST_RPC_URL: ${{ secrets.ETHEREUM_BLAST_RPC_URL }} | ||
run: | | ||
cargo llvm-cov nextest --release --lcov --output-path lcov.info --test-threads=1 | ||
|
@@ -53,4 +96,4 @@ jobs: | |
debug: true | ||
|
||
- uses: colpal/actions-clean@v1 | ||
if: ${{ always() }} # To ensure this step runs even when earlier steps fail | ||
if: ${{ always() }} |