-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (125 loc) · 5.09 KB
/
Copy pathboatstack-lab.yml
File metadata and controls
131 lines (125 loc) · 5.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Verify Boatstack lab
on:
pull_request:
paths:
- "labs/12-product-engineering-loop/**"
- ".github/workflows/boatstack-lab.yml"
- ".github/scripts/ci_shard.py"
push:
branches: [main]
paths:
- "labs/12-product-engineering-loop/**"
- ".github/workflows/boatstack-lab.yml"
- ".github/scripts/ci_shard.py"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: boatstack-lab-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Unix runners run the full suite serially — fast enough (~1-2 min) and the
# unsharded correctness reference. Windows is handled by `runtime-windows`.
runtime:
name: Runtime (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: labs/12-product-engineering-loop/product-engineering-loop
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/go-setup
with:
go-version-file: labs/12-product-engineering-loop/product-engineering-loop/go.mod
cache-dependency-path: labs/12-product-engineering-loop/product-engineering-loop/go.sum
- name: Show toolchain
run: go version
- name: Test runtime
run: go test ./...
- name: Build helper
run: go build ./cmd/boatstack-helper
- name: Validate Bash installer
shell: bash
run: bash -n ../boatstack-distribution/install.sh.template
# Windows `go test` is dominated by per-process spawn latency (each test spawns
# several `git` processes; the suite is ~330 tests run serially), so the full
# suite takes ~15 min on Windows vs ~1 min on Unix. In-process t.Parallel() is
# unsafe here (the package swaps ~14 global function-seams), so we shard across
# processes instead: N runners, each running a disjoint, balanced subset. Shard
# assignment is an LPT makespan-minimization controller — see
# .github/scripts/ci_shard.py. Target: slowest shard < 5 min.
runtime-windows:
name: Runtime (windows-latest, shard ${{ matrix.shard }})
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5]
runs-on: windows-latest
defaults:
run:
working-directory: labs/12-product-engineering-loop/product-engineering-loop
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/go-setup
with:
go-version-file: labs/12-product-engineering-loop/product-engineering-loop/go.mod
cache-dependency-path: labs/12-product-engineering-loop/product-engineering-loop/go.sum
- name: Show toolchain
run: go version
# Enumerate tests, pick this shard's balanced subset, and run only those.
# `go test -list` and `go test -run` share the warm GOCACHE, so the second
# compile is a cache hit. An empty shard (fewer tests than shards) is a
# clean skip — never `go test -run ''`, which would run the whole suite.
- name: Test shard ${{ matrix.shard }}
shell: bash
run: |
regex=$(go test -list '^Test' ./... | python "${{ github.workspace }}/.github/scripts/ci_shard.py" --total 6 --index ${{ matrix.shard }})
if [ -z "$regex" ]; then
echo "Shard ${{ matrix.shard }} is empty; nothing to run."
exit 0
fi
echo "Shard ${{ matrix.shard }} selects $(( $(grep -o '|' <<<"$regex" | wc -l) + 1 )) tests"
go test -run "$regex" ./...
# Windows-only, non-test validation runs once (on shard 0), not per shard.
- name: Build helper
if: matrix.shard == '0'
run: go build ./cmd/boatstack-helper
- name: Validate PowerShell installer
if: matrix.shard == '0'
shell: pwsh
run: |
$tokens = $null
$errors = $null
$path = Resolve-Path ../boatstack-distribution/install.ps1.template
[System.Management.Automation.Language.Parser]::ParseFile($path, [ref]$tokens, [ref]$errors) > $null
if ($errors.Count -gt 0) {
$errors | ForEach-Object { Write-Error $_ }
exit 1
}
projection:
name: Generated distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: ./.github/actions/go-setup
with:
go-version-file: labs/12-product-engineering-loop/product-engineering-loop/go.mod
cache-dependency-path: labs/12-product-engineering-loop/product-engineering-loop/go.sum
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Require an append-only release message
if: github.event_name == 'pull_request'
run: >-
python labs/12-product-engineering-loop/scripts/release_notes.py check-policy
--repo .
--base "${{ github.event.pull_request.base.sha }}"
--head "${{ github.event.pull_request.head.sha }}"
- name: Verify projection and public surface
run: python -m unittest discover -s labs/12-product-engineering-loop/tests -p 'test_*.py'