shorten 'Over de Kiesraad' in our README #120
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: Codecov | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
backend: | |
name: Backend | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: backend | |
env: | |
CARGO_TERM_COLOR: always | |
SQLX_OFFLINE: "true" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Branch coverage requires Rust nightly: https://github.com/taiki-e/cargo-llvm-cov/issues/8 | |
- name: Setup Rust Nightly | |
shell: bash | |
run: > | |
rustup update nightly && | |
rustup default nightly && | |
echo RUST_VERSION=$(rustc --version | awk -F '[( ]' '{print $4}') >> $GITHUB_ENV | |
- name: Install Binstall | |
uses: cargo-bins/cargo-binstall@main | |
- name: Install cargo-llvm-cov | |
run: cargo binstall cargo-llvm-cov | |
- name: Install Nextest | |
run: cargo binstall cargo-nextest | |
- name: Cargo cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/.crates.toml | |
~/.cargo/.crates2.json | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
./backend/target/ | |
key: ${{ runner.os }}-cargo-${{ env.RUST_VERSION }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo-${{ env.RUST_VERSION }}- | |
- name: Run tests with coverage | |
run: cargo llvm-cov --branch nextest --profile ci | |
- name: Upload test results to Codecov | |
if: ${{ !cancelled() }} | |
uses: codecov/test-results-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: backend/target/nextest/ci/junit.xml | |
disable_search: true | |
fail_ci_if_error: true | |
- name: Create code coverage report | |
run: cargo llvm-cov report --cobertura --output-path ./target/llvm-cov-target/codecov.json | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: backend/target/llvm-cov-target/codecov.json | |
disable_search: true | |
fail_ci_if_error: true | |
frontend: | |
name: Frontend | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: frontend | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Install dependencies | |
run: npm ci | |
- name: Run Vite build to report bundle size | |
run: npx vite build --config vite.config.ts | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Run tests with coverage | |
run: npx vitest run --coverage --reporter=junit --outputFile=test-report.junit.xml | |
- name: Upload test results to Codecov | |
if: ${{ !cancelled() }} | |
uses: codecov/test-results-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: frontend/test-report.junit.xml | |
disable_search: true | |
fail_ci_if_error: true | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: frontend/coverage/coverage-final.json | |
disable_search: true | |
fail_ci_if_error: true |