ci: Fix coverage.yml #1190
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
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
name: generate coverage | |
jobs: | |
check: | |
name: Setup Rust project | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup rust environment | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Setup docker | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Generate keys | |
run: make keys | |
- name: Build docker container | |
run: | | |
cd ci && docker build -t test_suite:latest . | |
docker run -d --name test_suite -p 4200:4200 -p 4201:4201 -p 4202:4202 -p 4203:4203 -p 4204:4204 -p 4205:4205 -p 4206:4206 test_suite:latest | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Generate code coverage | |
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info | |
- name: Upload to codecov.io | |
uses: codecov/[email protected] | |
with: | |
token: ${{secrets.CODECOV_TOKEN}} | |
files: lcov.info | |
fail_ci_if_error: true | |
- name: Collect docker logs | |
if: always() | |
run: docker logs test_suite > my_logs.txt 2>&1 | |
- name: Upload docker logs | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: docker logs | |
path: my_logs.txt |