Files
plainleaf/.github/workflows/test.yml
T

120 lines
2.5 KiB
YAML

name: Tests
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
contents: read
jobs:
test-frontend:
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-tags: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Install dependencies
run: npm ci
- name: Run build
run: npm run build
- name: Run checks
run: |
npm run check
npm test
test-go:
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.25"
- name: Build
run: |
npm ci
make build
- name: Install Playwright Chromium (with system deps)
run: npx playwright install --with-deps chromium
- name: Resolve Chromium path
id: chromium
run: |
echo "path=$(node -e 'console.log(require("@playwright/test").chromium.executablePath())')" >> "$GITHUB_OUTPUT"
- name: Run Go tests
env:
SB_CHROME_PATH: ${{ steps.chromium.outputs.path }}
run: |
go test ./server/... -v -timeout 300s
go test ./cli/... -v -timeout 300s
- name: Run Go tests with coverage
env:
SB_CHROME_PATH: ${{ steps.chromium.outputs.path }}
run: go test ./server/... ./cli/... -coverprofile=coverage.out -timeout 300s
- name: Display test coverage
run: go tool cover -func=coverage.out
test-e2e:
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.25"
- name: Install dependencies
run: npm ci
- name: Build
run: make build
- name: Install Playwright browsers
run: npx playwright install
- name: Run e2e tests
run: npx playwright test
- name: Upload test results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: test-results/
retention-days: 7