Skip to content

Commit 6348647

Browse files
committed
feat(ci): use built docker image for tests without the need of uploading to dockerhub
1 parent 779eacd commit 6348647

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

.github/workflows/drivers-tests.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ jobs:
144144
if: (needs['latest-tag-sha'].outputs.sha != github.sha)
145145
runs-on: ubuntu-20.04
146146
timeout-minutes: 30
147+
env:
148+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
147149
steps:
148150
- name: Check out the repo
149151
uses: actions/checkout@v4
@@ -154,6 +156,7 @@ jobs:
154156
with:
155157
username: ${{ secrets.DOCKERHUB_USERNAME }}
156158
password: ${{ secrets.DOCKERHUB_TOKEN }}
159+
if: (env.DOCKERHUB_USERNAME != '')
157160
- name: Set up QEMU
158161
uses: docker/setup-qemu-action@v3
159162
- name: Download native build
@@ -167,7 +170,17 @@ jobs:
167170
context: .
168171
file: ./packages/cubejs-docker/testing-drivers.Dockerfile
169172
tags: cubejs/cube:testing-drivers
170-
push: true
173+
push: ${{ (env.DOCKERHUB_USERNAME != '') }}
174+
- name: Save Docker image as artifact
175+
run: |
176+
IMAGE_TAG=cubejs/cube:testing-drivers
177+
docker save $IMAGE_TAG | gzip > image.tar.gz
178+
continue-on-error: true
179+
- name: Upload Docker image artifact
180+
uses: actions/upload-artifact@v4
181+
with:
182+
name: docker-image
183+
path: image.tar.gz
171184

172185
tests:
173186
runs-on: ubuntu-20.04
@@ -261,6 +274,15 @@ jobs:
261274
cd packages/cubejs-testing-drivers
262275
yarn tsc
263276
277+
- name: Download Docker image artifact
278+
uses: actions/download-artifact@v4
279+
with:
280+
name: docker-image
281+
282+
- name: Load Docker image into Docker Daemon
283+
run: |
284+
gunzip -c image.tar.gz | docker load
285+
264286
- name: Run tests
265287
uses: nick-fields/retry@v3
266288
# It's enough to test for any one secret because they are set all at once or not set all

0 commit comments

Comments
 (0)