feat(ci): add Gitea Actions test workflow
This commit is contained in:
80
.gitea/workflows/test.yml
Normal file
80
.gitea/workflows/test.yml
Normal file
@@ -0,0 +1,80 @@
|
||||
name: Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- 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: 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
|
||||
Reference in New Issue
Block a user