mirror of
https://github.com/encounter/wibo.git
synced 2026-03-30 11:42:31 -07:00
158 lines
4.6 KiB
YAML
158 lines
4.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- '*.md'
|
|
- 'LICENSE'
|
|
pull_request:
|
|
|
|
env:
|
|
DOCKER_BUILD_CHECKS_ANNOTATIONS: false
|
|
DOCKER_BUILD_SUMMARY: false
|
|
|
|
jobs:
|
|
build:
|
|
name: Build (${{ matrix.display }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- id: ubuntu-debug
|
|
display: Debug
|
|
dockerfile: Dockerfile.ubuntu
|
|
build_type: Debug
|
|
default: false
|
|
suffix: -ubuntu-debug
|
|
- id: ubuntu-release
|
|
display: Release
|
|
dockerfile: Dockerfile.ubuntu
|
|
build_type: Release
|
|
default: false
|
|
suffix: -ubuntu
|
|
- id: static-debug
|
|
display: Static, Debug
|
|
dockerfile: Dockerfile
|
|
build_type: Debug
|
|
default: false
|
|
suffix: -alpine-debug
|
|
- id: static-release
|
|
display: Static, Release
|
|
dockerfile: Dockerfile
|
|
build_type: Release
|
|
default: true
|
|
suffix: -alpine
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- 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: Compute version
|
|
id: version
|
|
run: echo "wibo_version=$(git describe --tags --always)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Build Docker image
|
|
id: docker-build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
file: ${{ matrix.dockerfile }}
|
|
build-args: |
|
|
BUILD_TYPE=${{ matrix.build_type }}
|
|
WIBO_VERSION=${{ steps.version.outputs.wibo_version }}
|
|
target: build
|
|
|
|
- name: Tests
|
|
run: >
|
|
docker run --rm ${{ steps.docker-build.outputs.imageid }}
|
|
ctest --test-dir /wibo/build --output-on-failure
|
|
|
|
- name: Export binary
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
file: ${{ matrix.dockerfile }}
|
|
build-args: |
|
|
BUILD_TYPE=${{ matrix.build_type }}
|
|
WIBO_VERSION=${{ steps.version.outputs.wibo_version }}
|
|
target: export
|
|
outputs: |
|
|
type=local,dest=dist
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Push Docker image
|
|
if: github.event_name != 'pull_request' && github.repository == 'decompals/wibo'
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
file: ${{ matrix.dockerfile }}
|
|
build-args: |
|
|
BUILD_TYPE=${{ matrix.build_type }}
|
|
WIBO_VERSION=${{ steps.version.outputs.wibo_version }}
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.id }}
|
|
path: dist/wibo
|
|
|
|
release:
|
|
name: Publish Release
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Download static debug
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: static-debug
|
|
path: artifacts/static-debug
|
|
|
|
- name: Download static release
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: static-release
|
|
path: artifacts/static-release
|
|
|
|
- name: Prepare assets
|
|
run: |
|
|
mkdir -p artifacts/out
|
|
cp artifacts/static-debug/wibo artifacts/out/wibo_debug
|
|
cp artifacts/static-release/wibo artifacts/out/wibo
|
|
|
|
- name: Publish release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: |
|
|
artifacts/out/wibo
|
|
artifacts/out/wibo_debug
|
|
draft: true
|
|
generate_release_notes: true
|