1+ name : main
2+
3+ on :
4+ push :
5+ branches : [main]
6+
7+ concurrency :
8+ group : main-${{ github.ref }}
9+ cancel-in-progress : true
10+
11+ env :
12+ GO_VERSION : ' 1.26.x'
13+ BINARY_NAME : linkctl
14+
15+ jobs :
16+ format-and-lint :
17+ runs-on : macos-latest
18+ steps :
19+ - name : Checkout code
20+ uses : actions/checkout@v4
21+
22+ - name : Set up Go
23+ uses : actions/setup-go@v5
24+ with :
25+ go-version : ${{ env.GO_VERSION }}
26+ cache : true
27+
28+ - name : Install mise & tools
29+ uses : jdx/mise-action@v2
30+
31+ - name : Cache Go tools
32+ id : go-tools-cache
33+ uses : actions/cache@v4
34+ with :
35+ path : ~/go/bin
36+ key : ${{ runner.os }}-go-tools-${{ hashFiles('.mise.toml') }}
37+
38+ - name : Install tooling
39+ if : steps.go-tools-cache.outputs.cache-hit != 'true'
40+ run : make tools
41+
42+ - name : Check formatting
43+ run : |
44+ export PATH="$(go env GOPATH)/bin:$PATH"
45+ make format-check
46+
47+ - name : Run lint
48+ run : |
49+ export PATH="$(go env GOPATH)/bin:$PATH"
50+ make lint
51+
52+ test :
53+ runs-on : macos-latest
54+ steps :
55+ - name : Checkout code
56+ uses : actions/checkout@v4
57+
58+ - name : Set up Go
59+ uses : actions/setup-go@v5
60+ with :
61+ go-version : ${{ env.GO_VERSION }}
62+ cache : true
63+
64+ - name : Run all tests
65+ run : make test
66+
67+ build :
68+ runs-on : macos-latest
69+ needs : [format-and-lint, test]
70+ steps :
71+ - name : Checkout code
72+ uses : actions/checkout@v4
73+ with :
74+ fetch-depth : 0
75+
76+ - name : Set up Go
77+ uses : actions/setup-go@v5
78+ with :
79+ go-version : ${{ env.GO_VERSION }}
80+ cache : true
81+
82+ - name : Build — macOS (arm64 / amd64)
83+ run : |
84+ mkdir -p build
85+ GOOS=darwin GOARCH=arm64 go build -o build/${{ env.BINARY_NAME }}_dev_darwin_arm64 ./cmd
86+ GOOS=darwin GOARCH=amd64 go build -o build/${{ env.BINARY_NAME }}_dev_darwin_amd64 ./cmd
87+
88+ - name : Build — Linux (arm64 / amd64)
89+ run : |
90+ GOOS=linux GOARCH=arm64 go build -o build/${{ env.BINARY_NAME }}_dev_linux_arm64 ./cmd
91+ GOOS=linux GOARCH=amd64 go build -o build/${{ env.BINARY_NAME }}_dev_linux_amd64 ./cmd
92+
93+ - name : Build — Windows (amd64)
94+ run : |
95+ GOOS=windows GOARCH=amd64 go build -o build/${{ env.BINARY_NAME }}_dev_windows_amd64.exe ./cmd
96+
97+ - name : Create checksums
98+ run : |
99+ cd build
100+ shasum -a 256 * > ${{ env.BINARY_NAME }}_dev_checksums.txt
101+ cat ${{ env.BINARY_NAME }}_dev_checksums.txt
102+
103+ - name : Upload artifacts
104+ uses : actions/upload-artifact@v4
105+ with :
106+ name : main-builds
107+ path : build/
108+ retention-days : 7
0 commit comments