88 workflow_dispatch :
99
1010jobs :
11- test :
12- name : Test
11+ lint :
12+ name : Lint
1313 runs-on : ubuntu-latest
14- strategy :
15- matrix :
16- go-version : ['1.24', '1.25']
1714
1815 steps :
1916 - name : Generate GitHub App token
@@ -32,36 +29,19 @@ jobs:
3229 - name : Set up Go
3330 uses : actions/setup-go@v5
3431 with :
35- go-version : ${{ matrix.go-version }}
36-
37- - name : Download dependencies
38- run : go mod download
32+ go-version : ' 1.25'
33+ cache : true
3934
4035 - name : Verify dependencies
4136 run : go mod verify
4237
43- - name : Install shells for PTY tests
44- run : |
45- sudo apt-get update
46- sudo apt-get install -y bash zsh
47- # Fix zsh permissions to avoid compinit security warnings
48- sudo chmod -R 755 /usr/share/zsh
49- sudo chown -R root:root /usr/share/zsh
50-
51- - name : Run tests
52- run : go test -v -race -coverprofile=coverage.out ./...
53-
54- - name : Upload coverage to Codecov
55- if : matrix.go-version == '1.25'
56- uses : codecov/codecov-action@v5
38+ - name : Run golangci-lint
39+ uses : golangci/golangci-lint-action@v4
5740 with :
58- token : ${{ secrets.CODECOV_TOKEN }}
59- slug : timvw/wt
60- files : ./coverage.out
61- fail_ci_if_error : false
41+ version : latest
6242
63- build :
64- name : Build
43+ test :
44+ name : Unit Tests
6545 runs-on : ubuntu-latest
6646
6747 steps :
@@ -82,51 +62,23 @@ jobs:
8262 uses : actions/setup-go@v5
8363 with :
8464 go-version : ' 1.25'
65+ cache : true
8566
86- - name : Build
87- run : go build -v ./...
88-
89- - name : Build binary
90- run : |
91- mkdir -p bin
92- go build -o bin/wt .
93-
94- - name : Verify binary
95- run : |
96- ./bin/wt --help
97- file bin/wt
98-
99- lint :
100- name : Lint
101- runs-on : ubuntu-latest
102-
103- steps :
104- - name : Generate GitHub App token
105- id : generate-token
106- continue-on-error : true
107- uses : actions/create-github-app-token@v1
108- with :
109- app-id : ${{ secrets.BOT_APP_ID }}
110- private-key : ${{ secrets.BOT_PRIVATE_KEY }}
111-
112- - name : Checkout code
113- uses : actions/checkout@v4
114- with :
115- token : ${{ steps.generate-token.outputs.token || github.token }}
67+ - name : Run unit tests
68+ run : go test -short -v -race -coverprofile=coverage.out ./...
11669
117- - name : Set up Go
118- uses : actions/setup-go@v5
119- with :
120- go-version : ' 1.25'
121-
122- - name : Run golangci-lint
123- uses : golangci/golangci-lint-action@v4
70+ - name : Upload coverage to Codecov
71+ uses : codecov/codecov-action@v5
12472 with :
125- version : latest
73+ token : ${{ secrets.CODECOV_TOKEN }}
74+ slug : timvw/wt
75+ files : ./coverage.out
76+ fail_ci_if_error : false
12677
127- cross-compile :
128- name : Cross Compile
78+ build :
79+ name : Build and Cross- Compile
12980 runs-on : ubuntu-latest
81+ needs : [lint, test]
13082
13183 steps :
13284 - name : Generate GitHub App token
@@ -146,23 +98,51 @@ jobs:
14698 uses : actions/setup-go@v5
14799 with :
148100 go-version : ' 1.25'
101+ cache : true
149102
150- - name : Cross compile
103+ - name : Build for all platforms
151104 run : |
152105 mkdir -p bin
106+ # Native build
107+ go build -o bin/wt .
108+ # Cross-compile for all supported platforms
153109 GOOS=linux GOARCH=amd64 go build -o bin/wt-linux-amd64 .
110+ GOOS=linux GOARCH=arm64 go build -o bin/wt-linux-arm64 .
154111 GOOS=darwin GOARCH=amd64 go build -o bin/wt-darwin-amd64 .
155112 GOOS=darwin GOARCH=arm64 go build -o bin/wt-darwin-arm64 .
156113 GOOS=windows GOARCH=amd64 go build -o bin/wt-windows-amd64.exe .
157114
158115 - name : Verify binaries
159116 run : |
117+ ./bin/wt --help
160118 ls -lh bin/
161119 file bin/*
162120
121+ - name : Upload Linux binary
122+ uses : actions/upload-artifact@v4
123+ with :
124+ name : wt-linux-amd64
125+ path : bin/wt-linux-amd64
126+ retention-days : 1
127+
128+ - name : Upload macOS ARM64 binary
129+ uses : actions/upload-artifact@v4
130+ with :
131+ name : wt-darwin-arm64
132+ path : bin/wt-darwin-arm64
133+ retention-days : 1
134+
135+ - name : Upload Windows binary
136+ uses : actions/upload-artifact@v4
137+ with :
138+ name : wt-windows-amd64
139+ path : bin/wt-windows-amd64.exe
140+ retention-days : 1
141+
163142 e2e-macos :
164143 name : E2E Tests (macOS)
165144 runs-on : macos-latest
145+ needs : build
166146 strategy :
167147 matrix :
168148 shell : ['bash', 'zsh']
@@ -185,17 +165,18 @@ jobs:
185165 uses : actions/setup-go@v5
186166 with :
187167 go-version : ' 1.25'
168+ cache : true
188169
189- - name : Download dependencies
190- run : go mod download
191-
192- - name : Build wt binary
193- run : |
194- mkdir -p bin
195- go build -o bin/wt .
170+ - name : Download macOS binary
171+ uses : actions/download-artifact@v4
172+ with :
173+ name : wt-darwin-arm64
174+ path : bin
196175
197- - name : Verify binary
176+ - name : Prepare binary
198177 run : |
178+ mv bin/wt-darwin-arm64 bin/wt
179+ chmod +x bin/wt
199180 ./bin/wt --help
200181 file bin/wt
201182
@@ -366,6 +347,7 @@ jobs:
366347 e2e-linux :
367348 name : E2E Tests (Linux)
368349 runs-on : ubuntu-latest
350+ needs : build
369351 strategy :
370352 fail-fast : false
371353 matrix :
@@ -390,23 +372,24 @@ jobs:
390372 uses : actions/setup-go@v5
391373 with :
392374 go-version : ' 1.25'
375+ cache : true
393376
394377 - name : Install zsh
395378 if : matrix.shell == 'zsh'
396379 run : |
397380 sudo apt-get update
398381 sudo apt-get install -y zsh
399382
400- - name : Download dependencies
401- run : go mod download
402-
403- - name : Build wt binary
404- run : |
405- mkdir -p bin
406- go build -o bin/wt .
383+ - name : Download Linux binary
384+ uses : actions/download-artifact@v4
385+ with :
386+ name : wt-linux-amd64
387+ path : bin
407388
408- - name : Verify binary
389+ - name : Prepare binary
409390 run : |
391+ mv bin/wt-linux-amd64 bin/wt
392+ chmod +x bin/wt
410393 ./bin/wt --help
411394 file bin/wt
412395
@@ -562,6 +545,7 @@ jobs:
562545 e2e-windows :
563546 name : E2E Tests (Windows)
564547 runs-on : windows-latest
548+ needs : build
565549 strategy :
566550 matrix :
567551 shell : ['powershell', 'pwsh']
@@ -584,17 +568,17 @@ jobs:
584568 uses : actions/setup-go@v5
585569 with :
586570 go-version : ' 1.25'
571+ cache : true
587572
588- - name : Download dependencies
589- run : go mod download
590-
591- - name : Build wt binary
592- run : |
593- mkdir -p bin
594- go build -o bin/wt.exe .
573+ - name : Download Windows binary
574+ uses : actions/download-artifact@v4
575+ with :
576+ name : wt-windows-amd64
577+ path : bin
595578
596- - name : Verify binary
579+ - name : Prepare binary
597580 run : |
581+ mv bin/wt-windows-amd64.exe bin/wt.exe
598582 ./bin/wt.exe --help
599583 file bin/wt.exe
600584
0 commit comments