96 lines
2.3 KiB
YAML
96 lines
2.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches-ignore:
|
|
- main
|
|
tags-ignore:
|
|
- '**'
|
|
pull_request:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: latest
|
|
|
|
- uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: '1.95.0'
|
|
|
|
- name: Cache Cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
backend/target
|
|
key: cargo-${{ hashFiles('backend/Cargo.lock') }}
|
|
restore-keys: cargo-
|
|
|
|
- name: Cache pnpm store
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.local/share/pnpm/store
|
|
key: pnpm-${{ hashFiles('frontend/pnpm-lock.yaml') }}
|
|
restore-keys: pnpm-
|
|
|
|
- name: Install frontend deps
|
|
run: pnpm --dir frontend install --frozen-lockfile
|
|
|
|
- name: Generate SvelteKit types
|
|
run: pnpm --dir frontend exec svelte-kit sync
|
|
|
|
- name: Install Playwright browsers
|
|
run: pnpm --dir frontend exec playwright install --with-deps chromium
|
|
|
|
- name: Type check (backend)
|
|
run: cargo check --manifest-path backend/Cargo.toml
|
|
|
|
- name: Type check (frontend)
|
|
run: pnpm --dir frontend exec tsgo --version && pnpm --dir frontend check
|
|
|
|
- name: Unit tests (backend)
|
|
run: cargo test --manifest-path backend/Cargo.toml
|
|
|
|
- name: Build frontend
|
|
run: pnpm --dir frontend build
|
|
|
|
- name: E2E tests
|
|
env:
|
|
TT_TEST_PORT_RANDOM: '1'
|
|
run: |
|
|
make test-up
|
|
pnpm --dir frontend test:e2e
|
|
|
|
- name: Stop test backend
|
|
if: always()
|
|
run: make test-down || true
|
|
|
|
- name: Upload test results
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-results
|
|
path: |
|
|
frontend/test-results/
|
|
frontend/playwright-report/
|
|
retention-days: 7
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Docker build (no push)
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
push: false
|
|
tags: tutortool:ci
|