Skip to content

Commit abec04f

Browse files
committed
chore(ci): run core tests on Testcontainers Cloud
1 parent a1d9ba0 commit abec04f

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

.github/workflows/ci-test-go.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ on:
1818
type: string
1919
default: "."
2020
description: "The directory where the Go project is located."
21+
testcontainers-cloud:
22+
required: false
23+
type: boolean
24+
default: false
25+
description: "Run the tests on Testcontainers Cloud"
2126
rootless-docker:
2227
required: false
2328
type: boolean
@@ -81,6 +86,13 @@ jobs:
8186
echo "No dependencies script found at $SCRIPT_PATH - skipping installation"
8287
fi
8388
89+
# Setup Testcontainers Cloud Client right before your Testcontainers tests
90+
- name: Setup Docker Cloud Client
91+
if: ${{ inputs.testcontainers-cloud }}
92+
uses: atomicjar/testcontainers-cloud-setup-action@c335bdbb570ec7c48f72c7d450c077f0a002293e # v1.3
93+
with:
94+
token: ${{ secrets.TCC_TOKEN }}
95+
8496
- name: go test
8597
working-directory: ./${{ inputs.project-directory }}
8698
timeout-minutes: 30
@@ -90,6 +102,13 @@ jobs:
90102
run: |
91103
./scripts/check_environment.sh
92104
105+
# (Optionally) When you don't need Testcontainers Cloud anymore, you could terminate sessions eagerly
106+
- name: Terminate Testcontainers Cloud Client active sessions
107+
if: ${{ inputs.testcontainers-cloud }}
108+
uses: atomicjar/testcontainers-cloud-setup-action@c335bdbb570ec7c48f72c7d450c077f0a002293e # v1.3
109+
with:
110+
action: terminate
111+
93112
- name: Test Summary
94113
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4
95114
with:

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,31 @@ jobs:
7171
go-version: ${{ matrix.go-version }}
7272
platforms: ${{ matrix.module == 'modulegen' && '["ubuntu-latest", "macos-latest", "windows-latest"]' || '["ubuntu-latest"]' }}
7373
project-directory: "${{ matrix.module }}"
74+
testcontainers-cloud: false
7475
rootless-docker: false
7576
ryuk-disabled: false
7677
secrets: inherit
7778

79+
# The job below is a copy of the job above, but using Docker Cloud.
80+
test-testcontainers-cloud:
81+
# the core module is identified by the empty string (the root path)
82+
if: ${{ contains(fromJSON(needs.detect-modules.outputs.modules), '') }}
83+
needs:
84+
- detect-modules
85+
- lint
86+
name: "Test using Docker Cloud"
87+
strategy:
88+
matrix:
89+
go-version: [1.23.x, 1.24.x]
90+
uses: ./.github/workflows/ci-test-go.yml
91+
with:
92+
go-version: ${{ matrix.go-version }}
93+
platforms: '["ubuntu-latest"]'
94+
project-directory: "."
95+
testcontainers-cloud: true
96+
rootless-docker: false
97+
ryuk-disabled: false
98+
7899
# The job below is a copy of the job above, but with ryuk disabled.
79100
# It's executed in the first stage to avoid concurrency issues.
80101
test-reaper-off:
@@ -92,6 +113,7 @@ jobs:
92113
go-version: ${{ matrix.go-version }}
93114
platforms: '["ubuntu-latest"]'
94115
project-directory: "."
116+
testcontainers-cloud: false
95117
rootless-docker: false
96118
ryuk-disabled: true
97119

@@ -112,6 +134,7 @@ jobs:
112134
go-version: ${{ matrix.go-version }}
113135
platforms: '["ubuntu-latest"]'
114136
project-directory: "."
137+
testcontainers-cloud: false
115138
rootless-docker: true
116139
ryuk-disabled: false
117140

0 commit comments

Comments
 (0)