c62b6d7893
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6 to 7. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
127 lines
3.3 KiB
YAML
127 lines
3.3 KiB
YAML
name: Test
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
# Minimal permissions for security
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
# =============================================================================
|
|
# Detect which paths changed to skip unnecessary jobs
|
|
# =============================================================================
|
|
changes:
|
|
name: Detect Changes
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
outputs:
|
|
backend: ${{ steps.filter.outputs.backend }}
|
|
frontend: ${{ steps.filter.outputs.frontend }}
|
|
steps:
|
|
- uses: dorny/paths-filter@v3
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
backend:
|
|
- 'backend/**'
|
|
- 'biome.json'
|
|
- '.github/workflows/test.yml'
|
|
frontend:
|
|
- 'frontend/**'
|
|
- 'biome.json'
|
|
- '.github/workflows/test.yml'
|
|
|
|
# =============================================================================
|
|
# Backend Tests (skipped if no backend-related files changed)
|
|
# =============================================================================
|
|
backend-test:
|
|
name: Backend Tests
|
|
needs: changes
|
|
if: needs.changes.outputs.backend == 'true'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
defaults:
|
|
run:
|
|
working-directory: backend
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: '22'
|
|
cache: 'npm'
|
|
cache-dependency-path: backend/package-lock.json
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Lint
|
|
run: npm run lint
|
|
|
|
- name: TypeScript type check
|
|
run: npx tsc --noEmit
|
|
|
|
- name: Run tests with coverage
|
|
run: npm run test:coverage
|
|
|
|
- name: Upload coverage report
|
|
uses: actions/upload-artifact@v7
|
|
if: always()
|
|
with:
|
|
name: backend-coverage
|
|
path: backend/coverage/
|
|
retention-days: 7
|
|
|
|
# =============================================================================
|
|
# Frontend Tests & Build (skipped if no frontend-related files changed)
|
|
# =============================================================================
|
|
frontend-build:
|
|
name: Frontend Build
|
|
needs: changes
|
|
if: needs.changes.outputs.frontend == 'true'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
defaults:
|
|
run:
|
|
working-directory: frontend
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: '22'
|
|
cache: 'npm'
|
|
cache-dependency-path: frontend/package-lock.json
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Lint
|
|
run: npm run lint
|
|
|
|
- name: Run tests with coverage
|
|
run: npm run test:coverage
|
|
|
|
- name: TypeScript type check & build
|
|
run: npm run build
|
|
|
|
- name: Upload coverage report
|
|
uses: actions/upload-artifact@v7
|
|
if: always()
|
|
with:
|
|
name: frontend-coverage
|
|
path: frontend/coverage/
|
|
retention-days: 7
|