test: add more tests #5
Workflow file for this run
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, pull_request] | |
name: Build | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
fmt: | |
name: Check Code Format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Install Rust nightly | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: nightly | |
components: rustfmt | |
- name: Run Rustfmt | |
run: cargo fmt -- --check | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Install Rust nightly | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: nightly | |
components: clippy | |
- name: Cache Rust dependcies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}- | |
${{ runner.os }}-cargo- | |
- name: Build | |
run: cargo build --release --bin backend --features cli | |
- name: Run Clippy | |
run: cargo clippy --all-targets | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
path: target/release/backend | |
test: | |
name: Test and Coverage | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@master | |
- name: Install Rust nightly | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: nightly | |
components: clippy | |
- name: Cache Rust dependcies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}- | |
${{ runner.os }}-cargo- | |
- name: Run Integration Tests | |
run: | | |
python3 tests/utils/fake_cas.py & | |
cargo test | |
env: | |
CARGO_INCREMENTAL: '0' | |
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off' | |
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off' | |
TEST_DATABASE_URL: "postgres://postgres:postgres@localhost/postgres" | |
RUST_LOG: "debug,backend=trace,test_main=trace,tokio_postgres=info" | |
JWT_SECRET: "secret" | |
- name: rust-grcov | |
uses: actions-rs/[email protected] | |
- name: Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} |