mirror of
https://github.com/decompals/wibo.git
synced 2025-10-16 15:15:10 +00:00
Incorporate Docker images into main CI workflow
This commit is contained in:
parent
de63a0b394
commit
6b3cadf1fc
79
.github/workflows/ci.yml
vendored
79
.github/workflows/ci.yml
vendored
@ -8,7 +8,8 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOCKER_BUILDKIT: 1
|
DOCKER_BUILD_CHECKS_ANNOTATIONS: false
|
||||||
|
DOCKER_BUILD_SUMMARY: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@ -22,47 +23,81 @@ jobs:
|
|||||||
display: Debug
|
display: Debug
|
||||||
dockerfile: Dockerfile.ubuntu
|
dockerfile: Dockerfile.ubuntu
|
||||||
build_type: Debug
|
build_type: Debug
|
||||||
image: wibo-host-debug
|
default: false
|
||||||
|
suffix: -ubuntu-debug
|
||||||
- id: ubuntu-release
|
- id: ubuntu-release
|
||||||
display: Release
|
display: Release
|
||||||
dockerfile: Dockerfile.ubuntu
|
dockerfile: Dockerfile.ubuntu
|
||||||
build_type: Release
|
build_type: Release
|
||||||
image: wibo-host-release
|
default: false
|
||||||
|
suffix: -ubuntu
|
||||||
- id: static-debug
|
- id: static-debug
|
||||||
display: Static, Debug
|
display: Static, Debug
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
build_type: Debug
|
build_type: Debug
|
||||||
image: wibo-static-debug
|
default: false
|
||||||
|
suffix: -alpine-debug
|
||||||
- id: static-release
|
- id: static-release
|
||||||
display: Static, Release
|
display: Static, Release
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
build_type: Release
|
build_type: Release
|
||||||
image: wibo-static-release
|
default: true
|
||||||
|
suffix: -alpine
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Build
|
- name: Docker meta
|
||||||
run: >-
|
id: meta
|
||||||
docker build
|
uses: docker/metadata-action@v5
|
||||||
-f ${{ matrix.dockerfile }}
|
with:
|
||||||
--build-arg BUILD_TYPE=${{ matrix.build_type }}
|
images: ghcr.io/decompals/wibo
|
||||||
--target build
|
tags: |
|
||||||
-t ${{ matrix.image }}
|
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
|
- 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
|
- name: Export binary
|
||||||
run: |
|
uses: docker/build-push-action@v6
|
||||||
rm -rf dist
|
with:
|
||||||
docker build \
|
file: ${{ matrix.dockerfile }}
|
||||||
-f ${{ matrix.dockerfile }} \
|
build-args: |
|
||||||
--build-arg BUILD_TYPE=${{ matrix.build_type }} \
|
BUILD_TYPE=${{ matrix.build_type }}
|
||||||
--target export \
|
target: export
|
||||||
--output dist \
|
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
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
62
.github/workflows/docker.yaml
vendored
62
.github/workflows/docker.yaml
vendored
@ -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 }}
|
|
Loading…
x
Reference in New Issue
Block a user