-
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
26 additions
and
45 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,59 +1,40 @@ | ||
--- | ||
name: Task - Rust Tests and Coverage | ||
name: Rust Cache and Test | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
coverage: | ||
# sadly, for now we have to "rebuild" for the coverage | ||
test: | ||
name: Cache and Test | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
localstack: | ||
image: localstack/localstack | ||
env: | ||
SERVICES: s3, sqs | ||
DEFAULT_REGION: us-east-1 | ||
AWS_ACCESS_KEY_ID: "AWS_ACCESS_KEY_ID" | ||
AWS_SECRET_ACCESS_KEY: "AWS_SECRET_ACCESS_KEY" | ||
ports: | ||
- 4566:4566 | ||
mongodb: | ||
image: mongo:latest | ||
ports: | ||
- 27017:27017 | ||
|
||
steps: | ||
- 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 | ||
|
||
- uses: taiki-e/install-action@cargo-llvm-cov | ||
- uses: taiki-e/install-action@nextest | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Rust Cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: Run llvm-cov | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Install cargo-llvm-cov | ||
uses: taiki-e/install-action@cargo-llvm-cov | ||
|
||
- name: Install nextest | ||
uses: taiki-e/install-action@nextest | ||
|
||
- name: Clean workspace | ||
run: | | ||
cargo llvm-cov nextest --release --lcov --output-path lcov.info --test-threads=1 | ||
cargo clean --doc | ||
- name: Upload coverage to codecov.io | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: lcov.info | ||
fail_ci_if_error: false | ||
- name: Run tests | ||
run: cargo llvm-cov nextest --release --lcov --output-path lcov.info --test-threads=1 | ||
|
||
# - uses: colpal/actions-clean@v1 | ||
# if: ${{ always() }} # To ensure this step runs even when earlier steps fail | ||
- name: Upload coverage | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: code-coverage-report | ||
path: lcov.info |