The fork had a full suite and no CI that ran it. Upstream's test workflows trigger on stable/testing/unstable; this repo only has main. And Gitea does not read .github/workflows at all once .gitea/workflows exists, so those files were decoration here. 115 of the 116 test files under shater/** had never executed in CI even once, which is how TestDNSFilterRemoteBlocklistHTTPClient stayed red across two published releases without anyone noticing. The gate is a job inside release.yml that build-apk needs, because a separate workflow cannot block another one. It runs the suite under the shipped tag set, on Linux — 6 of 7 test files in transport/wireguard and 12 in shater/generate compile only there or only under those tags, and those are exactly the files covering AmneziaWG. Three guards stop it from passing by running nothing, which is the failure this whole change is about. The tag set may only ADD test files, never remove one. Every package go list says has tests must appear as "ok <pkg>" in the output, so a suite that collapses to "no test files" fails instead of passing. And the panel run counts its test files first, because node --test exits 0 with "pass 0" when the glob matches nothing. The publish step used to exit 0 having published nothing: its assertions all live inside a loop over artifacts, so an empty directory ran the body zero times and reported success. It now counts what it published and fails on zero. Verified by extracting the shipped step text and running it against stubs: empty artifacts gives exit 0 before and exit 10 after; the rolling-release readback still fires its own exit 14. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
86 lines
2.9 KiB
YAML
86 lines
2.9 KiB
YAML
# Shater — the test gate, on every push to `main`.
|
|
#
|
|
# WHY THIS FILE EXISTS (2026-07-26)
|
|
# The fork had a full suite and no CI that ran it. Upstream's
|
|
# .github/workflows/test.yml triggers on `stable`/`testing`/`unstable`; this
|
|
# repo only has `main`. And Gitea does not read .github/workflows AT ALL once
|
|
# .gitea/workflows exists — so those files are decoration here. Result: 115 of
|
|
# the 116 test files under shater/** had never once executed in CI, and
|
|
# TestDNSFilterRemoteBlocklistHTTPClient stayed red across two published
|
|
# releases.
|
|
#
|
|
# RELATIONSHIP TO release.yml
|
|
# This workflow is the FAST FEEDBACK loop on `main`. It is NOT the release
|
|
# gate: a separate workflow cannot block another one. The gate is the `test`
|
|
# JOB inside .gitea/workflows/release.yml, which build-apk `needs:` — see the
|
|
# comment there. Both run the very same scripts/run-tests.sh, so they cannot
|
|
# drift apart.
|
|
name: test
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths-ignore:
|
|
- '**.md'
|
|
- 'docs-shater/**'
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: test-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
name: go + panel tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
# go.mod has `replace github.com/sagernet/wireguard-go => ./submodules/
|
|
# wireguard-go`, so WITHOUT this every `go list`/`go test` fails before it
|
|
# starts. Same step, same reason, as in release.yml's build job.
|
|
- name: Init wireguard-go submodule (awg)
|
|
run: git submodule update --init --depth 1 submodules/wireguard-go
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: false # explicit actions/cache@v3.3.2 below
|
|
|
|
# v3.3.2 is the last release speaking the cache API act_runner implements
|
|
# (see the header of release.yml). Same key as the release build job, so
|
|
# whichever runs first warms the other.
|
|
- name: Cache Go modules + build cache
|
|
uses: actions/cache@v3.3.2
|
|
with:
|
|
path: |
|
|
~/go/pkg/mod
|
|
~/.cache/go-build
|
|
key: go-${{ hashFiles('go.sum') }}
|
|
restore-keys: |
|
|
go-
|
|
|
|
# Node 24, NOT the 20 the SPA build uses: panel's tests are TypeScript run
|
|
# through `node --test`, and type stripping only exists from 22.6. On
|
|
# node 20 `npm test` dies with a syntax error before running anything.
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '24'
|
|
|
|
- name: Cache panel node_modules
|
|
uses: actions/cache@v3.3.2
|
|
with:
|
|
path: panel/node_modules
|
|
key: npm-${{ hashFiles('panel/package-lock.json') }}
|
|
|
|
- name: Panel tests
|
|
run: bash scripts/run-panel-tests.sh
|
|
|
|
- name: Go tests (shipped tags, linux, + race)
|
|
run: bash scripts/run-tests.sh
|