Skip to content

Commit fd08695

Browse files
authored
Run tests in go versions 1.20 and 1.21(#337)
1 parent a356b59 commit fd08695

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

.github/workflows/go.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,22 @@ on:
1616

1717
jobs:
1818
MIGRATION-Unit-Testing:
19-
name: Migration Unit Testing🛠
19+
name: Migration Unit Testing (v${{ matrix.go-version }})🛠
2020
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
go-version: ['1.21', '1.20']
2124

2225
steps:
2326
- name: Checkout code into go module directory
2427
uses: actions/checkout@v4
2528
with:
2629
fetch-depth: 0
2730

28-
- name: Set up Go 1.21
31+
- name: Set up Go ${{ matrix.go-version }}
2932
uses: actions/setup-go@v4
3033
with:
31-
go-version: 1.21
34+
go-version: ${{ matrix.go-version }}
3235
id: Go
3336

3437
- name: Get dependencies
@@ -43,14 +46,19 @@ jobs:
4346
go tool cover -func profile.cov
4447
4548
- name: Upload Test Coverage
49+
if: ${{ matrix.go-version == '1.21'}}
4650
uses: actions/upload-artifact@v3
4751
with:
4852
name: MIGRATION-Coverage-Report
4953
path: profile.cov
5054

5155
Example-Unit-Testing:
52-
name: Example Unit Testing🛠
56+
name: Example Unit Testing (v${{ matrix.go-version }})🛠
5357
runs-on: ubuntu-latest
58+
strategy:
59+
matrix:
60+
go-version: ['1.21', '1.20']
61+
5462
services:
5563
zookeeper:
5664
image: wurstmeister/zookeeper
@@ -90,10 +98,10 @@ jobs:
9098
with:
9199
fetch-depth: 0
92100

93-
- name: Set up Go 1.21
101+
- name: Set up Go ${{ matrix.go-version }}
94102
uses: actions/setup-go@v4
95103
with:
96-
go-version: 1.21
104+
go-version: ${{ matrix.go-version }}
97105
id: Go
98106

99107
- name: Get dependencies
@@ -116,25 +124,29 @@ jobs:
116124
go tool cover -func profile.cov
117125
118126
- name: Upload Test Coverage
127+
if: ${{ matrix.go-version == '1.21'}}
119128
uses: actions/upload-artifact@v3
120129
with:
121130
name: Example-Test-Report
122131
path: profile.cov
123132

124133
PKG-Unit-Testing:
125-
name: PKG Unit Testing🛠
134+
name: PKG Unit Testing (v${{ matrix.go-version }})🛠
126135
runs-on: ubuntu-latest
136+
strategy:
137+
matrix:
138+
go-version: ['1.21', '1.20']
127139

128140
steps:
129141
- name: Checkout code into go module directory
130142
uses: actions/checkout@v4
131143
with:
132144
fetch-depth: 0
133145

134-
- name: Set up Go 1.21
146+
- name: Set up Go ${{ matrix.go-version }}
135147
uses: actions/setup-go@v4
136148
with:
137-
go-version: 1.21
149+
go-version: ${{ matrix.go-version }}
138150
id: Go
139151

140152
- name: Get dependencies
@@ -149,6 +161,7 @@ jobs:
149161
go tool cover -func profile.cov
150162
151163
- name: Upload Test Coverage
164+
if: ${{ matrix.go-version == '1.21'}}
152165
uses: actions/upload-artifact@v3
153166
with:
154167
name: PKG-Coverage-Report
@@ -157,7 +170,7 @@ jobs:
157170
parse_coverage:
158171
name: Code Coverage
159172
runs-on: ubuntu-latest
160-
needs: [Example-Unit-Testing,PKG-Unit-Testing,MIGRATION-Unit-Testing]
173+
needs: [ Example-Unit-Testing,PKG-Unit-Testing,MIGRATION-Unit-Testing ]
161174
steps:
162175
- name: Check out code into the Go module directory
163176
uses: actions/checkout@v4
@@ -167,6 +180,7 @@ jobs:
167180
with:
168181
path: artifacts
169182

183+
170184
- name: Merge Coverage Files
171185
working-directory: artifacts
172186
run: |
@@ -191,7 +205,7 @@ jobs:
191205
name: Upload Coverage📊
192206
runs-on: ubuntu-latest
193207
needs: [Example-Unit-Testing,PKG-Unit-Testing,MIGRATION-Unit-Testing]
194-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/development' }}
208+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/development'}}
195209
steps:
196210
- name: Check out code into the Go module directory
197211
uses: actions/checkout@v4

0 commit comments

Comments
 (0)