From 6b3cadf1fcacccd8019b57a86b71b1eba294bd77 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Tue, 7 Oct 2025 15:42:53 -0600 Subject: [PATCH] Incorporate Docker images into main CI workflow --- .github/workflows/ci.yml | 79 +++++++++++++++++++++++++---------- .github/workflows/docker.yaml | 62 --------------------------- 2 files changed, 57 insertions(+), 84 deletions(-) delete mode 100644 .github/workflows/docker.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c68046..4d2ec26 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,8 @@ on: pull_request: env: - DOCKER_BUILDKIT: 1 + DOCKER_BUILD_CHECKS_ANNOTATIONS: false + DOCKER_BUILD_SUMMARY: false jobs: build: @@ -22,47 +23,81 @@ jobs: display: Debug dockerfile: Dockerfile.ubuntu build_type: Debug - image: wibo-host-debug + default: false + suffix: -ubuntu-debug - id: ubuntu-release display: Release dockerfile: Dockerfile.ubuntu build_type: Release - image: wibo-host-release + default: false + suffix: -ubuntu - id: static-debug display: Static, Debug dockerfile: Dockerfile build_type: Debug - image: wibo-static-debug + default: false + suffix: -alpine-debug - id: static-release display: Static, Release dockerfile: Dockerfile build_type: Release - image: wibo-static-release + default: true + suffix: -alpine steps: - name: Checkout uses: actions/checkout@v4 - - name: Build - run: >- - docker build - -f ${{ matrix.dockerfile }} - --build-arg BUILD_TYPE=${{ matrix.build_type }} - --target build - -t ${{ matrix.image }} - . + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/decompals/wibo + tags: | + type=raw,value=latest,enable=${{ matrix.default && github.ref_type == 'tag' }} + type=raw,value=latest${{ matrix.suffix }},enable=${{ github.ref_type == 'tag' }} + type=ref,event=tag,enable=${{ matrix.default }} + type=ref,event=tag,suffix=${{ matrix.suffix }} + type=ref,event=branch,enable=${{ matrix.default }} + type=ref,event=branch,suffix=${{ matrix.suffix }} + type=sha,enable=${{ matrix.default }} + type=sha,suffix=${{ matrix.suffix }} + flavor: | + latest=false + + - name: Build Docker image + id: docker-build + uses: docker/build-push-action@v6 + with: + file: ${{ matrix.dockerfile }} + build-args: | + BUILD_TYPE=${{ matrix.build_type }} + target: build - name: Tests - run: docker run --rm ${{ matrix.image }} ctest --test-dir /wibo/build --output-on-failure + run: > + docker run --rm ${{ steps.docker-build.outputs.imageid }} + ctest --test-dir /wibo/build --output-on-failure - name: Export binary - run: | - rm -rf dist - docker build \ - -f ${{ matrix.dockerfile }} \ - --build-arg BUILD_TYPE=${{ matrix.build_type }} \ - --target export \ - --output dist \ - . + uses: docker/build-push-action@v6 + with: + file: ${{ matrix.dockerfile }} + build-args: | + BUILD_TYPE=${{ matrix.build_type }} + target: export + outputs: | + type=local,dest=dist + + - name: Push Docker image + if: github.event_name != 'pull_request' + uses: docker/build-push-action@v6 + with: + file: ${{ matrix.dockerfile }} + build-args: | + BUILD_TYPE=${{ matrix.build_type }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml deleted file mode 100644 index 0f49d6e..0000000 --- a/.github/workflows/docker.yaml +++ /dev/null @@ -1,62 +0,0 @@ -name: Create and push Docker build image -on: - push: - branches: [ main ] - tags: [ '*.*.*' ] - pull_request: - -jobs: - publish_docker_image: - name: Publish Docker image to Github Registry (${{ matrix.display }}) - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - strategy: - fail-fast: false - matrix: - include: - - id: alpine - display: Alpine - dockerfile: Dockerfile - default: true - - id: ubuntu - display: Ubuntu - dockerfile: Dockerfile.ubuntu - default: false - steps: - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: ghcr.io/decompals/wibo - tags: | - type=raw,value=latest,enable=${{ matrix.default && github.ref_type == 'tag' }} - type=raw,value=latest-${{ matrix.id }},enable=${{ github.ref_type == 'tag' }} - type=ref,event=tag,enable=${{ matrix.default }} - type=ref,event=tag,suffix=-${{ matrix.id }} - type=ref,event=branch,enable=${{ matrix.default }} - type=ref,event=branch,suffix=-${{ matrix.id }} - type=sha,enable=${{ matrix.default }} - type=sha,suffix=-${{ matrix.id }} - flavor: | - latest=false - - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Log in to GitHub Docker Registry - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push to Github registry - uses: docker/build-push-action@v4 - with: - file: ${{ matrix.dockerfile }} - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }}