Files
skillshare/.github/workflows/test.yaml
T
Rusty ShacklefordandClaude Opus 5.5 61eedffe1e fix(oplog): keep selected global config logs in the state dir (#609)
SKILLSHARE_CONFIG can select a global config in a directory named
skillshare or .skillshare. Treating it as a project config puts logs and
a .gitignore beside the shared config and labels global logs as project logs.

Exclude selected and read-only global config paths from project routing.
Share the check with the log command so readers and writers agree.
Run the legacy config regression explicitly in Windows CI so it is exercised
without enabling unrelated tests that still need Windows fixes.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 22:55:36 +08:00

205 lines
6.3 KiB
YAML

name: Test
on:
push:
branches: [main]
paths-ignore:
- "website/**"
- "README.md"
- "CHANGELOG.md"
pull_request:
branches: [main]
paths-ignore:
- "website/**"
- "README.md"
- "CHANGELOG.md"
schedule:
- cron: "0 3 * * *"
workflow_dispatch:
workflow_call:
inputs:
ref:
description: Exact commit to verify for a release
type: string
default: ""
# A newer push to a pull request supersedes its running tests; other events keep their own run.
concurrency:
group: ${{ github.event_name == 'pull_request' && format('test-pr-{0}', github.event.pull_request.number) || format('test-{0}', github.run_id) }}
cancel-in-progress: true
jobs:
unit-test:
# Release Please tests a merged Release PR at its exact SHA (inputs.ref) before tagging,
# so the push run for that same commit is skipped. Release PR runs stay: they are required checks.
if: &not-release-duplicate "${{ !(github.event_name == 'push' && !inputs.ref && startsWith(github.event.head_commit.message, 'chore(main): release ')) }}"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.sha }}
- name: Check AI context routes
run: python3 scripts/ai-context.py check
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build
run: make build
- name: Formatting, lint and release metadata tests
run: |
make fmt-check lint
python3 -B -m unittest discover -s scripts/release -p '*_test.py'
python3 -B -m unittest discover -s scripts/design -p '*_test.py'
- name: Unit Tests
run: go test -v -race ./cmd/skillshare/... ./internal/...
integration-test:
if: *not-release-duplicate
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.sha }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build Binary
run: make build
- name: Integration Tests
run: go test -v -race ./tests/integration/...
env:
SKILLSHARE_TEST_BINARY: ${{ github.workspace }}/bin/skillshare
windows-test:
# Releases publish windows_amd64 and windows_arm64 archives, and `_windows.go` files are compiled
# only on Windows, yet every job above runs on Linux or macOS: a Windows-only regression reaches
# users at release time instead of at review.
# This job starts with the packages that already pass on windows-latest, so it is green on
# arrival. #344 lists the packages that do not pass there and the failures behind them; each fix
# adds its package back to this list.
# No -race: the race detector needs a C toolchain on Windows, and ubuntu and macOS cover it.
# -count=1 so that a cached result cannot report a pass for a package that never ran.
if: *not-release-duplicate
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.sha }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Unit Tests
shell: bash
run: |
go test -v -count=1 \
./cmd/skillshare \
./internal/audit \
./internal/backup \
./internal/check \
./internal/childproc \
./internal/config \
./internal/hub \
./internal/install \
./internal/instructions \
./internal/mcp \
./internal/memory \
./internal/projectdir \
./internal/projects \
./internal/resource \
./internal/search \
./internal/skill \
./internal/skillignore \
./internal/sync \
./internal/theme \
./internal/trash \
./internal/ui \
./internal/uidist \
./internal/utils \
./internal/validate \
./internal/version
# Run this Windows-only regression; the rest of oplog still has failures tracked in #344.
- name: Windows legacy config log regression
shell: bash
run: go test -v -count=1 ./internal/oplog -run "^TestLogDir_WindowsLegacySelectedGlobal$"
docker-sandbox-offline:
if: *not-release-duplicate
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.sha }}
- 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) && !(github.event_name == 'push' && !inputs.ref && startsWith(github.event.head_commit.message, 'chore(main): release ')) }}"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.sha }}
- name: Docker Sandbox Tests (Online)
run: ./scripts/test_docker_online.sh
redteam:
if: *not-release-duplicate
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.sha }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Red Team Test
run: make test-redteam
redteam-signal:
runs-on: ubuntu-latest
if: "${{ (github.event_name == 'push' && (inputs.ref || !startsWith(github.event.head_commit.message, 'chore(main): release '))) || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.sha }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Red Team Signal (Code Mutation)
run: make test-redteam-signal
- name: Red Team Signal (Rules Disable)
run: make test-redteam-rules-signal