Skip to content

Commit fb2b971

Browse files
feat: isolate testcontainers dependency to separate test module (#38)
1 parent 99fe9ef commit fb2b971

File tree

6 files changed

+341
-229
lines changed

6 files changed

+341
-229
lines changed

.github/workflows/ci.yaml

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ jobs:
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

go.mod

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -7,69 +7,21 @@ require (
77
github.com/speakeasy-api/jsonpath v0.6.2
88
github.com/spf13/cobra v1.9.1
99
github.com/stretchr/testify v1.11.1
10-
github.com/testcontainers/testcontainers-go v0.38.0
1110
github.com/vmware-labs/yaml-jsonpath v0.3.2
1211
golang.org/x/sync v0.16.0
1312
golang.org/x/text v0.28.0
1413
gopkg.in/yaml.v3 v3.0.1
1514
)
1615

1716
require (
18-
dario.cat/mergo v1.0.1 // indirect
19-
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
20-
github.com/Microsoft/go-winio v0.6.2 // indirect
21-
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
22-
github.com/containerd/errdefs v1.0.0 // indirect
23-
github.com/containerd/errdefs/pkg v0.3.0 // indirect
24-
github.com/containerd/log v0.1.0 // indirect
25-
github.com/containerd/platforms v0.2.1 // indirect
26-
github.com/cpuguy83/dockercfg v0.3.2 // indirect
2717
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
28-
github.com/distribution/reference v0.6.0 // indirect
29-
github.com/docker/docker v28.2.2+incompatible // indirect
30-
github.com/docker/go-connections v0.5.0 // indirect
31-
github.com/docker/go-units v0.5.0 // indirect
3218
github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960 // indirect
33-
github.com/ebitengine/purego v0.8.4 // indirect
34-
github.com/felixge/httpsnoop v1.0.4 // indirect
35-
github.com/go-logr/logr v1.4.3 // indirect
36-
github.com/go-logr/stdr v1.2.2 // indirect
37-
github.com/go-ole/go-ole v1.2.6 // indirect
38-
github.com/gogo/protobuf v1.3.2 // indirect
39-
github.com/google/uuid v1.6.0 // indirect
4019
github.com/inconshreveable/mousetrap v1.1.0 // indirect
41-
github.com/klauspost/compress v1.18.0 // indirect
42-
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
43-
github.com/magiconair/properties v1.8.10 // indirect
44-
github.com/moby/docker-image-spec v1.3.1 // indirect
45-
github.com/moby/go-archive v0.1.0 // indirect
46-
github.com/moby/patternmatcher v0.6.0 // indirect
47-
github.com/moby/sys/sequential v0.6.0 // indirect
48-
github.com/moby/sys/user v0.4.0 // indirect
49-
github.com/moby/sys/userns v0.1.0 // indirect
50-
github.com/moby/term v0.5.0 // indirect
51-
github.com/morikuni/aec v1.0.0 // indirect
52-
github.com/opencontainers/go-digest v1.0.0 // indirect
53-
github.com/opencontainers/image-spec v1.1.1 // indirect
54-
github.com/pkg/errors v0.9.1 // indirect
20+
github.com/kr/pretty v0.3.1 // indirect
5521
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
56-
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
57-
github.com/shirou/gopsutil/v4 v4.25.5 // indirect
58-
github.com/sirupsen/logrus v1.9.3 // indirect
22+
github.com/rogpeppe/go-internal v1.13.1 // indirect
5923
github.com/spf13/pflag v1.0.6 // indirect
60-
github.com/tklauser/go-sysconf v0.3.12 // indirect
61-
github.com/tklauser/numcpus v0.6.1 // indirect
62-
github.com/yusufpapurcu/wmi v1.2.4 // indirect
63-
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
64-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
65-
go.opentelemetry.io/otel v1.37.0 // indirect
66-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect
67-
go.opentelemetry.io/otel/metric v1.37.0 // indirect
68-
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
69-
go.opentelemetry.io/otel/trace v1.37.0 // indirect
70-
go.opentelemetry.io/proto/otlp v1.7.1 // indirect
71-
golang.org/x/crypto v0.40.0 // indirect
7224
golang.org/x/net v0.42.0 // indirect
7325
golang.org/x/sys v0.34.0 // indirect
74-
google.golang.org/protobuf v1.36.6 // indirect
26+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
7527
)

0 commit comments

Comments
 (0)