Skip to content

Move environment parsing tests out of the unit test suite (#1438) #2224

Move environment parsing tests out of the unit test suite (#1438)

Move environment parsing tests out of the unit test suite (#1438) #2224

Workflow file for this run

name: Server CI
on:
push:
branches:
- main
paths:
- 'server/**'
- '.github/workflows/server-ci.yml'
pull_request:
paths:
- 'server/**'
- '.github/workflows/server-ci.yml'
# When pushing to a PR, cancel any jobs still running for the previous head commit of the PR
concurrency:
# head_ref is only defined for pull requests, run_id is always unique and defined so if this
# workflow was not triggered by a pull request, nothing gets cancelled.
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
check-fmt:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: rustfmt
run: cargo fmt -- --check
working-directory: server
test-versions:
name: Server CI
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable, beta]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: "server -> target"
# only save the cache on the main branch
# cf https://github.com/Swatinem/rust-cache/issues/95
save-if: ${{ github.ref == 'refs/heads/main' }}
# include relevant information in the cache name
prefix-key: "server-${{ matrix.rust }}"
- uses: taiki-e/install-action@nextest
- name: Build
run: cargo test --all-features --no-run --locked
working-directory: server
- name: Install dependencies
run: sudo apt-get install -y jq
- name: Check for uncommited OpenAPI changes
working-directory: ./server
run: ./generate-openapi.sh --check
- name: Start dependencies
run: docker compose -f "server/testing-docker-compose.yml" up -d
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
working-directory: server
- name: Run migrations
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/postgres"
SVIX_REDIS_DSN: "redis://localhost:6379"
SVIX_QUEUE_TYPE: "redis"
SVIX_JWT_SECRET: "test value"
SVIX_CACHE_TYPE: "memory"
run: cargo run -- --wait-for 15 migrate
working-directory: server
- name: Run tests
working-directory: ./server
run: ./run-tests.sh
- name: Stop dependencies
run: docker compose -f "server/testing-docker-compose.yml" down
# deny-check:
# name: cargo-deny check
# runs-on: ubuntu-latest
# continue-on-error: ${{ matrix.checks == 'advisories' }}
# strategy:
# matrix:
# checks:
# - advisories
# - bans licenses sources
# steps:
# - uses: actions/checkout@v4
# - uses: EmbarkStudios/cargo-deny-action@v1
# with:
# command: check ${{ matrix.checks }}
# arguments: --all-features --manifest-path axum/Cargo.toml