Repository navigation
93 lines (78 loc) · 2.36 KB
/
Copy pathci.yml
File metadata and controls
93 lines (78 loc) · 2.36 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
name: CI
on:
push:
branches: [master, main]
pull_request:
workflow_dispatch:
permissions:
contents: read
env:
GO_VERSION: "1.26"
jobs:
# Every project must be gofmt'd, compile, and pass vet -- skeletons included.
# This is the gate that java2ts lacked, which let broken configs and
# non-compiling reference answers sit in the repo unnoticed.
build:
name: Format, build & vet
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- run: scripts/check.sh fmt
- run: scripts/check.sh build
- run: scripts/check.sh vet
- run: scripts/check.sh docs
- run: scripts/check.sh test-sync
# Only the reference answers are required to be green. Exercise packages ship
# with failing tests on purpose: those tests are the learner's acceptance
# criteria, so enforcing them would make the repo red by design.
test-solutions:
name: Test reference solutions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- run: scripts/check.sh solutions
- run: scripts/check.sh coverage
# golangci-lint runs per-module, so the lint job needs one entry per workspace
# module. Deriving the list from go.work keeps the workflow from drifting as
# projects are added.
discover:
name: Discover modules
runs-on: ubuntu-latest
outputs:
modules: ${{ steps.list.outputs.modules }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- id: list
run: echo "modules=$(scripts/check.sh modules-json)" >> "$GITHUB_OUTPUT"
lint:
name: golangci-lint
needs: discover
runs-on: ubuntu-latest
env:
GOWORK: off
strategy:
fail-fast: false
matrix:
module: ${{ fromJSON(needs.discover.outputs.modules) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- uses: golangci/golangci-lint-action@v6
with:
version: latest
working-directory: ${{ matrix.module }}
args: --timeout=5m