Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 19 additions & 83 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,16 @@ jobs:
retention-days: 30

docker_build:
name: docker_build (${{ matrix.platform }}, ${{ matrix.variant }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
variant: minimal
tag_suffix: -linux-amd64
export: true
- platform: linux/arm/v7
variant: minimal
tag_suffix: -linux-arm-v7
Expand All @@ -261,6 +266,7 @@ jobs:

recipe_hash="${{ hashFiles('Dockerfile', '.cargo/**', 'Cargo.toml', 'Cargo.lock', 'build.rs', 'scripts/**', 'sqlpage/**', 'frontend/src/**', 'package.json', 'package-lock.json') }}"
{
echo "artifact=sqlpage-${ref_scope}${{ matrix.tag_suffix }}-hurl-${recipe_hash}"
echo "current=sqlpage-${ref_scope}${{ matrix.tag_suffix }}-${recipe_hash}"
echo "main=sqlpage-main${{ matrix.tag_suffix }}-${recipe_hash}"
} >> "$GITHUB_OUTPUT"
Expand All @@ -273,6 +279,7 @@ jobs:
labels: |
org.opencontainers.image.created=1970-01-01T00:00:00Z
- name: Set up QEMU
if: matrix.platform != 'linux/amd64'
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
Expand All @@ -282,85 +289,16 @@ jobs:
with:
username: ${{ env.REGISTRY_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push by digest
id: build
# The Hurl examples run against a real image, so the one platform they use
# is also exported as a tarball instead of only being pushed by digest.
- name: Build image for Hurl examples
if: matrix.export
uses: docker/build-push-action@v7
with:
# Use BuildKit's Git context instead of the mutable runner workspace.
# The dependency cache should be keyed by committed source, not by a
# per-job local context stream.
context: "{{defaultContext}}"
platforms: ${{ matrix.platform }}
target: ${{ matrix.variant }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: |
type=gha,scope=${{ steps.cache-scope.outputs.current }}
type=gha,scope=${{ steps.cache-scope.outputs.main }}
type=registry,ref=${{ env.REGISTRY_IMAGE }}:main${{ matrix.tag_suffix }}
cache-to: type=gha,scope=${{ steps.cache-scope.outputs.current }},mode=max
- name: Export digest
if: github.event_name != 'pull_request'
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v7
if: github.event_name != 'pull_request'
with:
name: digests-${{ matrix.variant }}${{ matrix.tag_suffix }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

docker_build_amd64_minimal:
name: docker_build (linux/amd64, minimal)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY_IMAGE }}
flavor: suffix=-linux-amd64
labels: |
org.opencontainers.image.created=1970-01-01T00:00:00Z
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- id: cache-scope
name: Docker cache scope
run: |
ref_scope="main"
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
ref_scope="pr-${{ github.event.pull_request.number }}"
fi

recipe_hash="${{ hashFiles('Dockerfile', '.cargo/**', 'Cargo.toml', 'Cargo.lock', 'build.rs', 'scripts/**', 'sqlpage/**', 'frontend/src/**', 'package.json', 'package-lock.json') }}"
{
echo "artifact=sqlpage-${ref_scope}-linux-amd64-hurl-${recipe_hash}"
echo "current=sqlpage-${ref_scope}-linux-amd64-${recipe_hash}"
echo "main=sqlpage-main-linux-amd64-${recipe_hash}"
} >> "$GITHUB_OUTPUT"
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v4
with:
username: ${{ env.REGISTRY_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build image for Hurl examples
uses: docker/build-push-action@v7
with:
# Use BuildKit's Git context instead of the mutable runner workspace.
# The dependency cache should be keyed by committed source, not by a
# per-job local context stream.
context: "{{defaultContext}}"
platforms: linux/amd64
target: minimal
labels: ${{ steps.meta.outputs.labels }}
tags: |
${{ steps.meta.outputs.tags }}
${{ env.REGISTRY_IMAGE }}:main
Expand All @@ -369,9 +307,10 @@ jobs:
type=gha,scope=${{ steps.cache-scope.outputs.artifact }}
type=gha,scope=${{ steps.cache-scope.outputs.current }}
type=gha,scope=${{ steps.cache-scope.outputs.main }}
type=registry,ref=${{ env.REGISTRY_IMAGE }}:main-linux-amd64
type=registry,ref=${{ env.REGISTRY_IMAGE }}:main${{ matrix.tag_suffix }}
cache-to: type=gha,scope=${{ steps.cache-scope.outputs.artifact }},mode=max
- name: Upload SQLPage image
if: matrix.export
uses: actions/upload-artifact@v7
with:
name: sqlpage-linux-amd64-minimal-image
Expand All @@ -380,22 +319,22 @@ jobs:
retention-days: 1
- name: Build and push by digest
id: build
if: github.event_name != 'pull_request'
if: github.event_name != 'pull_request' || !matrix.export
uses: docker/build-push-action@v7
with:
# Use BuildKit's Git context instead of the mutable runner workspace.
# The dependency cache should be keyed by committed source, not by a
# per-job local context stream.
context: "{{defaultContext}}"
platforms: linux/amd64
target: minimal
platforms: ${{ matrix.platform }}
target: ${{ matrix.variant }}
labels: ${{ steps.meta.outputs.labels }}
push: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: |
type=gha,scope=${{ steps.cache-scope.outputs.current }}
type=gha,scope=${{ steps.cache-scope.outputs.main }}
type=registry,ref=${{ env.REGISTRY_IMAGE }}:main-linux-amd64
type=registry,ref=${{ env.REGISTRY_IMAGE }}:main${{ matrix.tag_suffix }}
cache-to: type=gha,scope=${{ steps.cache-scope.outputs.current }},mode=max
- name: Export digest
if: github.event_name != 'pull_request'
Expand All @@ -407,11 +346,10 @@ jobs:
uses: actions/upload-artifact@v7
if: github.event_name != 'pull_request'
with:
name: digests-minimal-linux-amd64
name: digests-${{ matrix.variant }}${{ matrix.tag_suffix }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

hurl_examples:
runs-on: ubuntu-latest
outputs:
Expand Down Expand Up @@ -456,7 +394,6 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 15
needs:
- docker_build_amd64_minimal
- hurl_examples
strategy:
fail-fast: false
Expand Down Expand Up @@ -497,7 +434,6 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
needs:
- docker_build_amd64_minimal
- docker_build
strategy:
matrix:
Expand Down
Loading