-
Notifications
You must be signed in to change notification settings - Fork 108
135 lines (112 loc) · 3.05 KB
/
Copy pathci.yml
File metadata and controls
135 lines (112 loc) · 3.05 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
132
133
134
135
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
go_ci: ${{ steps.filter.outputs.go_ci }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Detect changed paths
id: filter
uses: dorny/paths-filter@v4
with:
filters: |
go_ci:
- '**/*.go'
- 'go.mod'
- 'go.sum'
- '.golangci.yml'
- '.github/workflows/**'
- '.github/scripts/**'
go:
needs: changes
if: needs.changes.outputs.go_ci == 'true'
runs-on: ubuntu-latest
container: golang:1.25-alpine
env:
CGO_ENABLED: 1
GOFLAGS: -buildvcs=false
GOMODCACHE: /go/pkg/mod
GOCACHE: /root/.cache/go-build
defaults:
run:
shell: bash
steps:
- name: Install system dependencies
shell: sh
run: |
apk add --no-cache bash ca-certificates gcc git libc-dev libpcap-dev linux-headers tar
- name: Checkout repository
uses: actions/checkout@v6
- name: Cache Go modules and build outputs
uses: actions/cache@v5
with:
path: |
/go/pkg/mod
/root/.cache/go-build
key: ${{ runner.os }}-go-1.25-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-1.25-
- name: Check Go formatting
run: test -z "$(gofmt -l .)"
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.12
args: --verbose
- name: Run Go tests
run: go test ./... -v -cover
- name: Run Go build
run: go build -ldflags "-w -s"
go-macos:
needs: changes
if: needs.changes.outputs.go_ci == 'true'
name: go (macOS ${{ matrix.goarch }})
runs-on: ${{ matrix.runner }}
env:
CGO_ENABLED: 1
GOARCH: ${{ matrix.goarch }}
GOFLAGS: -buildvcs=false
strategy:
fail-fast: false
matrix:
include:
- runner: macos-26-intel
goarch: amd64
- runner: macos-26
goarch: arm64
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- name: Run Go tests
run: go test ./... -v -cover
- name: Run Go build
run: go build -ldflags "-w -s" -o "${RUNNER_TEMP}/sx"
release-helper:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Run release helper tests
run: python3 -m unittest discover -s .github/scripts/tests -t .github/scripts