Skip to content

Commit 69ac003

Browse files
committed
Run example Hurl tests from CI image build
1 parent 0d19624 commit 69ac003

2 files changed

Lines changed: 116 additions & 43 deletions

File tree

.github/workflows/ci.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ jobs:
135135
# DuckDB ODBC is not available for armv7
136136
- platform: linux/arm/v7
137137
variant: duckdb
138+
# This build is shared with the Hurl example jobs.
139+
- platform: linux/amd64
140+
variant: minimal
138141
steps:
139142
- name: Checkout
140143
uses: actions/checkout@v6
@@ -194,10 +197,123 @@ jobs:
194197
if-no-files-found: error
195198
retention-days: 1
196199

200+
docker_build_amd64_minimal:
201+
name: docker_build (linux/amd64, minimal)
202+
runs-on: ubuntu-latest
203+
steps:
204+
- name: Checkout
205+
uses: actions/checkout@v6
206+
- name: Docker meta
207+
id: meta
208+
uses: docker/metadata-action@v6
209+
with:
210+
images: ${{ env.REGISTRY_IMAGE }}
211+
flavor: suffix=-linux-amd64
212+
- name: Set up Docker Buildx
213+
uses: docker/setup-buildx-action@v4
214+
- name: Login to Docker Hub
215+
if: github.event_name != 'pull_request'
216+
uses: docker/login-action@v4
217+
with:
218+
username: ${{ env.REGISTRY_USERNAME }}
219+
password: ${{ secrets.DOCKERHUB_TOKEN }}
220+
- name: Build image for Hurl examples
221+
uses: docker/build-push-action@v7
222+
with:
223+
context: .
224+
platforms: linux/amd64
225+
target: minimal
226+
labels: ${{ steps.meta.outputs.labels }}
227+
tags: |
228+
${{ steps.meta.outputs.tags }}
229+
${{ env.REGISTRY_IMAGE }}:main
230+
outputs: type=docker,dest=${{ runner.temp }}/sqlpage.tar
231+
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:main-linux-amd64
232+
- name: Upload SQLPage image
233+
uses: actions/upload-artifact@v7
234+
with:
235+
name: sqlpage-linux-amd64-minimal-image
236+
path: ${{ runner.temp }}/sqlpage.tar
237+
if-no-files-found: error
238+
retention-days: 1
239+
- name: Build and push by digest
240+
id: build
241+
if: github.event_name != 'pull_request'
242+
uses: docker/build-push-action@v7
243+
with:
244+
context: .
245+
platforms: linux/amd64
246+
target: minimal
247+
labels: ${{ steps.meta.outputs.labels }}
248+
push: true
249+
tags: ${{ steps.meta.outputs.tags }}
250+
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:main-linux-amd64
251+
cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:main-linux-amd64,compression=zstd,mode=max
252+
- name: Export digest
253+
if: github.event_name != 'pull_request'
254+
run: |
255+
mkdir -p /tmp/digests
256+
digest="${{ steps.build.outputs.digest }}"
257+
touch "/tmp/digests/${digest#sha256:}"
258+
- name: Upload digest
259+
uses: actions/upload-artifact@v7
260+
if: github.event_name != 'pull_request'
261+
with:
262+
name: digests-minimal-linux-amd64
263+
path: /tmp/digests/*
264+
if-no-files-found: error
265+
retention-days: 1
266+
267+
hurl_examples:
268+
runs-on: ubuntu-latest
269+
outputs:
270+
examples: ${{ steps.examples.outputs.examples }}
271+
steps:
272+
- uses: actions/checkout@v6
273+
- id: examples
274+
run: |
275+
examples="$(find examples -mindepth 2 -maxdepth 2 -name test.hurl -print | sed 's#/test.hurl$##' | sort | jq -R -s -c 'split("\n")[:-1]')"
276+
echo "examples=$examples" >> "$GITHUB_OUTPUT"
277+
278+
hurl:
279+
name: hurl (${{ matrix.example }})
280+
runs-on: ubuntu-latest
281+
timeout-minutes: 15
282+
needs:
283+
- docker_build_amd64_minimal
284+
- hurl_examples
285+
strategy:
286+
fail-fast: false
287+
matrix:
288+
example: ${{ fromJSON(needs.hurl_examples.outputs.examples) }}
289+
steps:
290+
- uses: actions/checkout@v6
291+
- name: Install Hurl
292+
env:
293+
GH_TOKEN: ${{ github.token }}
294+
run: |
295+
version=8.0.0
296+
archive="hurl-${version}-x86_64-unknown-linux-gnu.tar.gz"
297+
gh release download "$version" --repo Orange-OpenSource/hurl --pattern "$archive" --dir /tmp
298+
tar xzf "/tmp/$archive" -C /tmp
299+
echo "/tmp/hurl-${version}-x86_64-unknown-linux-gnu/bin" >> "$GITHUB_PATH"
300+
- name: Download SQLPage image
301+
uses: actions/download-artifact@v8
302+
with:
303+
name: sqlpage-linux-amd64-minimal-image
304+
path: ${{ runner.temp }}/sqlpage-image
305+
- name: Load SQLPage image
306+
run: |
307+
docker load --input "${{ runner.temp }}/sqlpage-image/sqlpage.tar"
308+
docker tag "${{ env.REGISTRY_IMAGE }}:main" "${{ env.REGISTRY_IMAGE }}:latest"
309+
- name: Run example Hurl test
310+
run: scripts/test-examples-hurl.sh "${{ matrix.example }}"
311+
197312
docker_push:
198313
runs-on: ubuntu-latest
199314
if: github.event_name != 'pull_request'
200315
needs:
316+
- docker_build_amd64_minimal
201317
- docker_build
202318
strategy:
203319
matrix:

.github/workflows/examples-hurl.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)