11name : go-getter
22
3- on : [push]
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
48
59env :
610 TEST_RESULTS_PATH : /tmp/test-results
711
812jobs :
913
10- linux-tests :
14+ # Basic validation that runs on both PRs and pushes (safe operations)
15+ basic-validation :
1116 runs-on : ubuntu-latest
1217 strategy :
1318 matrix :
1419 go-version :
15- - 1.18
16- - 1.19
17- permissions :
18- id-token : write
19- contents : read
20+ - " 1.24"
21+ - " 1.25"
2022 steps :
2123 - name : Setup go
2224 uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
@@ -26,23 +28,17 @@ jobs:
2628 - name : Checkout code
2729 uses : actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.0.0
2830
29- - name : Create test directory
30- run : |
31- mkdir -p ${{ env.TEST_RESULTS_PATH }}
32-
3331 - name : Setup cache for go modules
3432 uses : actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
3533 with :
3634 path : |
3735 ~/.cache/go-build
3836 ~/go/pkg/mod
39- key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
37+ key : ${{ runner.os }}-go${{ matrix.go-version }} -${{ hashFiles('**/go.sum') }}
4038 restore-keys : |
39+ ${{ runner.os }}-go${{ matrix.go-version }}-
4140 ${{ runner.os }}-go-
4241
43- - name : Download go modules
44- run : go mod download
45-
4642 # Check go fmt output because it does not report non-zero when there are fmt changes
4743 - name : Run gofmt
4844 run : |
5450 exit 1
5551 fi
5652
53+ - name : Build all packages
54+ run : go build ./...
55+
56+ - name : Run unit tests (without cloud integration)
57+ run : go test -short -v ./...
58+
59+ # Linter runs on both PRs and pushes (safe operation)
60+ linter :
61+ runs-on : ubuntu-latest
62+ steps :
63+ - name : Checkout code
64+ uses : actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.0.0
65+
66+ - name : Setup go
67+ uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
68+ with :
69+ go-version : " 1.25" # Use latest for linting
70+
71+ - name : Setup cache for go modules
72+ uses : actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
73+ with :
74+ path : |
75+ ~/.cache/go-build
76+ ~/go/pkg/mod
77+ ~/.cache/golangci-lint
78+ key : ${{ runner.os }}-lint-${{ hashFiles('**/go.sum') }}
79+ restore-keys : |
80+ ${{ runner.os }}-lint-
81+
82+ - name : Lint code
83+ uses : golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
84+
85+ # Full integration tests with cloud resources (only on push to protected branches)
86+ linux-integration-tests :
87+ runs-on : ubuntu-latest
88+ if : github.event_name == 'push'
89+ strategy :
90+ matrix :
91+ go-version :
92+ - " 1.24"
93+ - " 1.25"
94+ permissions :
95+ id-token : write
96+ contents : read
97+ steps :
98+ - name : Setup go
99+ uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
100+ with :
101+ go-version : ${{ matrix.go-version }}
102+
103+ - name : Checkout code
104+ uses : actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.0.0
105+
106+ - name : Create test directory
107+ run : |
108+ mkdir -p ${{ env.TEST_RESULTS_PATH }}
109+
110+ - name : Setup cache for go modules
111+ uses : actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
112+ with :
113+ path : |
114+ ~/.cache/go-build
115+ ~/go/pkg/mod
116+ key : ${{ runner.os }}-go${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
117+ restore-keys : |
118+ ${{ runner.os }}-go${{ matrix.go-version }}-
119+ ${{ runner.os }}-go-
120+
57121 - name : Install gotestsum
58122 run : go install gotest.tools/gotestsum@v1.8.2
59123
@@ -86,13 +150,14 @@ jobs:
86150 name : linux-test-results-${{ matrix.go-version }}
87151 path : linux_cov.part
88152
89- windows-tests :
153+ windows-integration- tests :
90154 runs-on : windows-latest
155+ if : github.event_name == 'push'
91156 strategy :
92157 matrix :
93158 go-version :
94- - 1.18
95- - 1.19
159+ - " 1.24 "
160+ - " 1.25 "
96161 permissions :
97162 id-token : write
98163 contents : read
@@ -114,13 +179,11 @@ jobs:
114179 path : |
115180 ~\AppData\Local\go-build
116181 ~\go\pkg\mod
117- key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
182+ key : ${{ runner.os }}-go${{ matrix.go-version }} -${{ hashFiles('**/go.sum') }}
118183 restore-keys : |
184+ ${{ runner.os }}-go${{ matrix.go-version }}-
119185 ${{ runner.os }}-go-
120186
121- - name : Download go modules
122- run : go mod download
123-
124187 - name : Install gotestsum
125188 shell : bash
126189 run : go install gotest.tools/gotestsum@v1.8.2
@@ -154,11 +217,3 @@ jobs:
154217 with :
155218 name : windows-test-results-${{ matrix.go-version }}
156219 path : win_cov.part
157-
158- linter :
159- runs-on : ubuntu-latest
160- steps :
161- - name : Checkout code
162- uses : actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.0.0
163- - name : Lint code
164- uses : golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
0 commit comments