Files
cultivation-world-simulator/.github/workflows/test.yml
Zihao Xu d4b9b7303d ci: add frontend tests to CI workflow (#68)
* ci: add frontend tests to CI workflow

* chore: sync package-lock.json with test dependencies

* test: skip failing overlapping names test (known bug)
2026-01-19 23:32:23 -08:00

60 lines
1.5 KiB
YAML

name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
# --- Backend Tests ---
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "requirements.txt"
- name: Install Python dependencies
run: |
uv pip install --system -r requirements.txt
uv pip install --system pytest pytest-cov
- name: Run backend tests with coverage
run: pytest -v --cov=src --cov-report=xml --cov-report=term --cov-fail-under=60
# --- Frontend Tests ---
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: web/package-lock.json
- name: Install Node dependencies
working-directory: web
run: npm ci
- name: Run frontend tests with coverage
working-directory: web
run: npm run test:coverage
# --- Upload Coverage ---
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml,./web/coverage/coverage-final.json
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}