captains-log/.forgejo/workflows/ci.yml
Drew Galbraith f529bf4552
All checks were successful
Check / Backend (pull_request) Successful in 7m9s
Check / Frontend (pull_request) Successful in 2m1s
Create Project APIs.
2025-10-27 20:48:53 -07:00

91 lines
2.1 KiB
YAML

name: Check
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
# Should speed up builds.
CARGO_INCREMENTAL: 0
# Should reduce the size of ./target to improve cache load/store.
CARGO_PROFILE_TEST_DEBUG: 0
jobs:
check-backend:
name: Backend
runs-on: docker
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install Rust
uses: https://codeberg.org/wackbyte/rust-toolchain@trunk
with:
toolchain: stable
components: rustfmt, clippy
- name: Cache
uses: https://github.com/Swatinem/rust-cache@v2
with:
# Don't cache ~/.cargo/bin since we restore the cache after we install things there
cache-bin: "false"
workspaces: "backend"
- name: "Check Format"
run: cargo fmt --check
working-directory: backend
- name: "Build"
run: |
# hurl needs libxml needs libclang
apt update && apt install -y clang
cargo build --tests --locked
working-directory: backend
- name: "Lint"
run: |
rustup component add clippy
cargo clippy --locked
working-directory: backend
- name: "Unit Tests"
run: |
cargo test --locked -- --skip api
working-directory: backend
- name: "Integration Tests"
run: |
mkdir -p reports/store
cargo test --locked --test api
working-directory: backend
check-frontend:
name: Frontend
runs-on: docker
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
cache: "npm"
cache-dependency-path: 'frontend/package-lock.json'
node-version: '20'
- name: Install dependencies
run: npm ci
working-directory: frontend
- name: Check Format
run: "npm run format:check"
working-directory: frontend
- name: Lint
run: npm run lint
working-directory: frontend
- name: Typecheck
run: npm run typecheck
working-directory: frontend
- name: Test
run: npm run test
working-directory: frontend