4242 matrix :
4343 os : [ubuntu-latest, windows-latest]
4444 runs-on : ${{ matrix.os }}
45- permissions :
46- contents : read
47- pull-requests : write
45+ needs : [lint]
4846
4947 steps :
5048 - uses : actions/checkout@v5
@@ -80,28 +78,73 @@ jobs:
8078 restore-keys : |
8179 arazzo-test-files-
8280
83- - name : Run tests with coverage
81+ - name : Run tests (Ubuntu)
8482 if : matrix.os == 'ubuntu-latest'
8583 env :
8684 ARAZZO_CACHE_DIR : ${{ runner.temp }}
87- run : mise run test-coverage
85+ run : mise test
8886
8987 - name : Run tests (Windows)
9088 if : matrix.os == 'windows-latest'
9189 env :
9290 ARAZZO_CACHE_DIR : ${{ runner.temp }}
9391 run : gotestsum --format testname -- -race $(go list ./... | grep -v 'jsonschema/oas3/tests')
9492
93+ coverage :
94+ name : Coverage Report
95+ runs-on : ubuntu-latest
96+ needs : [lint]
97+ permissions :
98+ contents : read
99+ pull-requests : write
100+
101+ steps :
102+ - uses : actions/checkout@v5
103+ with :
104+ submodules : recursive
105+
106+ - name : Install mise
107+ uses : jdx/mise-action@v3
108+
109+ - name : Setup Go with caching
110+ uses : actions/setup-go@v5
111+ with :
112+ go-version-file : " go.mod"
113+ cache : true
114+
115+ # Verify Docker is available for testcontainers
116+ - name : Verify Docker availability
117+ run : |
118+ docker --version
119+ docker info
120+ echo "Docker is available for testcontainers"
121+
122+ - name : Get current date
123+ id : date
124+ run : echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
125+
126+ - name : Cache downloaded test files
127+ uses : actions/cache@v4
128+ with :
129+ path : ${{ runner.temp }}/speakeasy-api_arazzo
130+ key : arazzo-test-files-${{ steps.date.outputs.date }}
131+ restore-keys : |
132+ arazzo-test-files-
133+
134+ - name : Run tests with coverage
135+ env :
136+ ARAZZO_CACHE_DIR : ${{ runner.temp }}
137+ run : mise test-coverage
138+
95139 - name : Calculate coverage
96- if : matrix.os == 'ubuntu-latest'
97140 id : coverage
98141 run : |
99142 COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}')
100143 echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT
101144 echo "Coverage: $COVERAGE"
102145
103146 - name : Get main branch coverage
104- if : github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest'
147+ if : github.event_name == 'pull_request'
105148 id : main-coverage
106149 run : |
107150 # Store current working directory
@@ -141,7 +184,6 @@ jobs:
141184 git worktree remove --force /tmp/main-branch || rm -rf /tmp/main-branch
142185
143186 - name : Generate coverage summary
144- if : matrix.os == 'ubuntu-latest'
145187 id : coverage-summary
146188 run : |
147189 echo "## 📊 Test Coverage Report" > coverage-summary.md
@@ -187,7 +229,7 @@ jobs:
187229 echo "_Generated by GitHub Actions_" >> coverage-summary.md
188230
189231 - name : Comment PR with coverage
190- if : github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest'
232+ if : github.event_name == 'pull_request'
191233 uses : actions/github-script@v7
192234 with :
193235 script : |
@@ -201,8 +243,8 @@ jobs:
201243 repo: context.repo.repo,
202244 });
203245
204- const botComment = comments.data.find(comment =>
205- comment.user.type === 'Bot' &&
246+ const botComment = comments.data.find(comment =>
247+ comment.user.type === 'Bot' &&
206248 comment.body.includes('📊 Test Coverage Report')
207249 );
208250
@@ -225,7 +267,6 @@ jobs:
225267 }
226268
227269 - name : Upload coverage artifact
228- if : matrix.os == 'ubuntu-latest'
229270 uses : actions/upload-artifact@v4
230271 with :
231272 name : coverage-report
@@ -302,14 +343,15 @@ jobs:
302343 # This provides a single status check for branch protection
303344 test-summary :
304345 name : Test Summary
305- needs : [lint, test, cli-tests, build-ubuntu, build-windows]
346+ needs : [lint, test, coverage, cli-tests, build-ubuntu, build-windows]
306347 runs-on : ubuntu-latest
307348 if : always()
308349 steps :
309350 - name : Check test results
310351 run : |
311352 if [ "${{ needs.lint.result }}" != "success" ] || \
312353 [ "${{ needs.test.result }}" != "success" ] || \
354+ [ "${{ needs.coverage.result }}" != "success" ] || \
313355 [ "${{ needs.cli-tests.result }}" != "success" ] || \
314356 [ "${{ needs.build-ubuntu.result }}" != "success" ] || \
315357 [ "${{ needs.build-windows.result }}" != "success" ]; then
0 commit comments