Files
skillshare/.github/workflows/test.yaml
T
Willie 5df04bdc36 chore: gitignore internal/server/dist/ and auto-create placeholder on build
Build artifacts (favicon, logos, index.html) were tracked in git to
satisfy go:embed, causing noisy diffs after `make ui-build`. Now the
entire dist/ is gitignored and `make build` auto-creates a minimal
placeholder index.html when dist is missing, so fresh clones still
compile without a frontend build step.

CI workflows updated to use `make build` instead of bare `go build`
to pick up the placeholder logic.
2026-02-08 16:12:43 +08:00

106 lines
2.4 KiB
YAML

name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_call:
jobs:
ui-embed-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"
cache-dependency-path: ui/pnpm-lock.yaml
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Build UI assets
run: make ui-build
- name: Verify embedded dist assets exist
run: |
test -f internal/server/dist/index.html
test -n "$(find internal/server/dist/assets -maxdepth 1 -type f | head -n 1)"
- name: Build binary with embedded UI
run: |
mkdir -p bin
go build -o bin/skillshare ./cmd/skillshare
unit-test:
runs-on: ubuntu-latest
needs: ui-embed-check
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Build
run: make build
- name: Unit Tests
run: go test -v -race ./internal/...
integration-test:
runs-on: ${{ matrix.os }}
needs: ui-embed-check
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Build Binary
run: make build
- name: Integration Tests
run: go test -v -race ./tests/integration/...
env:
SKILLSHARE_TEST_BINARY: ${{ github.workspace }}/bin/skillshare
docker-sandbox-offline:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker Sandbox Tests (Offline)
run: ./scripts/test_docker.sh
docker-sandbox-online:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker Sandbox Tests (Online)
run: ./scripts/test_docker_online.sh