Skip to content

Commit f40062b

Browse files
authored
chore(ci): use built docker image for tests without the need of uploading to dockerhub (#8769)
1 parent 326810a commit f40062b

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/drivers-tests.yml

Lines changed: 25 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,18 @@ 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 -o image.tar $IMAGE_TAG
178+
gzip image.tar
179+
continue-on-error: true
180+
- name: Upload Docker image artifact
181+
uses: actions/upload-artifact@v4
182+
with:
183+
name: docker-image
184+
path: image.tar.gz
171185

172186
tests:
173187
runs-on: ubuntu-20.04
@@ -261,6 +275,16 @@ jobs:
261275
cd packages/cubejs-testing-drivers
262276
yarn tsc
263277
278+
- name: Download Docker image artifact
279+
uses: actions/download-artifact@v4
280+
with:
281+
name: docker-image
282+
283+
- name: Load Docker image into Docker Daemon
284+
run: |
285+
gunzip image.tar.gz
286+
docker load -i image.tar
287+
264288
- name: Run tests
265289
uses: nick-fields/retry@v3
266290
# 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)