@@ -16,24 +16,11 @@ jobs:
1616 - name : Install mise
1717 uses : jdx/mise-action@v2
1818
19- - name : Get Go cache paths
20- id : go-cache-paths
21- shell : bash
22- run : |
23- echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
24- echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
25-
26- - name : Cache Go Build Cache
27- uses : actions/cache@v4
28- with :
29- path : ${{ steps.go-cache-paths.outputs.go-build }}
30- key : ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
31-
32- - name : Cache Go Mod Cache
33- uses : actions/cache@v4
19+ - name : Setup Go with caching
20+ uses : actions/setup-go@v5
3421 with :
35- path : ${{ steps. go-cache-paths.outputs.go- mod }}
36- key : ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
22+ go-version-file : " go. mod"
23+ cache : true
3724
3825 - name : Check code formatting
3926 run : mise run fmt-check
4936
5037 test :
5138 name : Test
52- needs : lint
5339 strategy :
5440 matrix :
5541 os : [ubuntu-latest, windows-latest]
@@ -64,32 +50,19 @@ jobs:
6450 - name : Install mise
6551 uses : jdx/mise-action@v2
6652
67- - name : Get Go cache paths
68- id : go-cache-paths
69- shell : bash
70- run : |
71- echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
72- echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
73-
74- - name : Cache Go Build Cache
75- uses : actions/cache@v4
76- with :
77- path : ${{ steps.go-cache-paths.outputs.go-build }}
78- key : ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
79-
80- - name : Cache Go Mod Cache
81- uses : actions/cache@v4
53+ - name : Setup Go with caching
54+ uses : actions/setup-go@v5
8255 with :
83- path : ${{ steps. go-cache-paths.outputs.go- mod }}
84- key : ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
56+ go-version-file : " go. mod"
57+ cache : true
8558
8659 - name : Cache downloaded test files
8760 uses : actions/cache@v4
8861 with :
8962 path : |
9063 ~/tmp/speakeasy-api_arazzo
9164 ${{ runner.temp }}/speakeasy-api_arazzo
92- key : arazzo-test-files-${{ hashFiles('arazzo/arazzo_test .go') }}
65+ key : arazzo-test-files-${{ hashFiles('arazzo/**/* .go') }}
9366 restore-keys : |
9467 arazzo-test-files-
9568
9972
10073 - name : Run tests (Windows)
10174 if : matrix.os == 'windows-latest'
102- run : gotestsum --format testname -- -race ./...
75+ run : mise run test
76+ env :
77+ GOOS : windows
78+ GOARCH : amd64
10379
10480 - name : Calculate coverage
10581 if : matrix.os == 'ubuntu-latest'
@@ -116,15 +92,15 @@ jobs:
11692 # Store current working directory
11793 CURRENT_DIR=$(pwd)
11894
119- # Fetch main branch
120- git fetch origin main:main
95+ # Fetch main branch with shallow clone for speed
96+ git fetch --depth=1 origin main:main
12197
12298 # Checkout main branch in a temporary directory
12399 git worktree add /tmp/main-branch main
124100
125- # Run tests on main branch to get coverage
101+ # Run tests on main branch to get coverage (with timeout)
126102 cd /tmp/main-branch
127- go test -coverprofile=main-coverage.out -covermode=atomic ./... > /dev/null 2>&1 || echo "Main branch tests failed"
103+ timeout 300 go test -coverprofile=main-coverage.out -covermode=atomic ./... > /dev/null 2>&1 || echo "Main branch tests failed or timed out "
128104
129105 if [ -f main-coverage.out ]; then
130106 MAIN_COVERAGE=$(go tool cover -func=main-coverage.out | grep total | awk '{print $3}' || echo "0.0%")
@@ -243,7 +219,7 @@ jobs:
243219
244220 - name : Build (Windows)
245221 if : matrix.os == 'windows-latest'
246- run : go build -v ./...
222+ run : mise run build
247223
248224 # Summary job that depends on all matrix jobs
249225 # This provides a single status check for branch protection
@@ -255,16 +231,8 @@ jobs:
255231 steps :
256232 - name : Check test results
257233 run : |
258- if [ "${{ needs.test.result }}" != "success" ]; then
259- echo "Tests failed or were cancelled"
234+ if [ "${{ needs.lint.result }}" != "success" ] || [ "${{ needs. test.result }}" != "success" ]; then
235+ echo "Lint or tests failed or were cancelled"
260236 exit 1
261237 fi
262- echo "All tests passed successfully"
263-
264- # Add this temporary job to satisfy the phantom check TODO: remove when test-and-build check is no longer required
265- test-and-build :
266- name : Legacy Status Check (Temporary)
267- runs-on : ubuntu-latest
268- steps :
269- - name : Satisfy phantom check
270- run : echo "This job exists only to satisfy the phantom test-and-build status check. It will be removed once GitHub stops expecting it."
238+ echo "All checks passed successfully"
0 commit comments