mirror of
https://github.com/decompals/wibo.git
synced 2025-10-16 07:05:11 +00:00
Rework CI into a build matrix; update Dockerfiles
This commit is contained in:
parent
8cac50e50e
commit
fd47411fff
125
.github/workflows/ci.yml
vendored
125
.github/workflows/ci.yml
vendored
@ -11,65 +11,94 @@ env:
|
|||||||
DOCKER_BUILDKIT: 1
|
DOCKER_BUILDKIT: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_test:
|
build:
|
||||||
name: Build and test
|
name: Build (${{ matrix.display }})
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- id: ubuntu-debug
|
||||||
|
display: Debug
|
||||||
|
dockerfile: Dockerfile.ubuntu
|
||||||
|
build_type: Debug
|
||||||
|
image: wibo-host-debug
|
||||||
|
- id: ubuntu-release
|
||||||
|
display: Release
|
||||||
|
dockerfile: Dockerfile.ubuntu
|
||||||
|
build_type: Release
|
||||||
|
image: wibo-host-release
|
||||||
|
- id: static-debug
|
||||||
|
display: Static, Debug
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
build_type: Debug
|
||||||
|
image: wibo-static-debug
|
||||||
|
- id: static-release
|
||||||
|
display: Static, Release
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
build_type: Release
|
||||||
|
image: wibo-static-release
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Build
|
||||||
|
run: >-
|
||||||
|
docker build
|
||||||
|
-f ${{ matrix.dockerfile }}
|
||||||
|
--build-arg build_type=${{ matrix.build_type }}
|
||||||
|
--target build
|
||||||
|
-t ${{ matrix.image }}
|
||||||
|
.
|
||||||
|
|
||||||
|
- name: Tests
|
||||||
|
run: docker run --rm ${{ matrix.image }} ctest --test-dir /wibo/build --output-on-failure
|
||||||
|
|
||||||
|
- name: Export binary
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
rm -rf dist
|
||||||
sudo apt-get install -y \
|
docker build \
|
||||||
file \
|
-f ${{ matrix.dockerfile }} \
|
||||||
unzip \
|
--build-arg build_type=${{ matrix.build_type }} \
|
||||||
wget \
|
--target export \
|
||||||
cmake \
|
--output dist \
|
||||||
ninja-build \
|
.
|
||||||
g++-multilib \
|
|
||||||
gcc-mingw-w64-i686 \
|
|
||||||
binutils-mingw-w64-i686
|
|
||||||
|
|
||||||
- name: Build debug
|
- name: Upload artifact
|
||||||
run: docker build --build-arg build_type=Debug --target export --output build_debug .
|
|
||||||
|
|
||||||
- name: Build release
|
|
||||||
run: docker build --build-arg build_type=Release --target export --output build .
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
mv build_debug/wibo build/wibo_debug
|
|
||||||
wget -q https://files.decomp.dev/compilers_latest.zip
|
|
||||||
unzip -q compilers_latest.zip
|
|
||||||
set -x
|
|
||||||
build/wibo_debug Wii/1.7/mwcceppc.exe -nodefaults -c test/test.c -Itest -o test_debug.o
|
|
||||||
file test_debug.o
|
|
||||||
build/wibo Wii/1.7/mwcceppc.exe -nodefaults -c test/test.c -Itest -o test.o
|
|
||||||
file test.o
|
|
||||||
|
|
||||||
- name: Fixture tests
|
|
||||||
run: |
|
|
||||||
cmake -S . -B build_ctest -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DWIBO_ENABLE_FIXTURE_TESTS=ON
|
|
||||||
cmake --build build_ctest
|
|
||||||
ctest --test-dir build_ctest --output-on-failure
|
|
||||||
|
|
||||||
- name: Upload release
|
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: wibo
|
name: ${{ matrix.id }}
|
||||||
path: build/wibo
|
path: dist/wibo
|
||||||
|
|
||||||
- name: Upload debug
|
release:
|
||||||
uses: actions/upload-artifact@v4
|
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:
|
with:
|
||||||
name: wibo_debug
|
name: static-debug
|
||||||
path: build/wibo_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
|
- name: Publish release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
build/wibo
|
artifacts/out/wibo
|
||||||
build/wibo_debug
|
artifacts/out/wibo_debug
|
||||||
|
17
Dockerfile
17
Dockerfile
@ -2,16 +2,29 @@
|
|||||||
FROM --platform=linux/i386 alpine:latest AS build
|
FROM --platform=linux/i386 alpine:latest AS build
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN apk add --no-cache cmake ninja g++ linux-headers binutils
|
RUN apk add --no-cache \
|
||||||
|
bash \
|
||||||
|
cmake \
|
||||||
|
ninja \
|
||||||
|
g++ \
|
||||||
|
linux-headers \
|
||||||
|
binutils \
|
||||||
|
mingw-w64-binutils \
|
||||||
|
mingw-w64-gcc
|
||||||
|
|
||||||
# Copy source files
|
# Copy source files
|
||||||
|
WORKDIR /wibo
|
||||||
COPY . /wibo
|
COPY . /wibo
|
||||||
|
|
||||||
# Build type (Release, Debug, RelWithDebInfo, MinSizeRel)
|
# Build type (Release, Debug, RelWithDebInfo, MinSizeRel)
|
||||||
ARG build_type=Release
|
ARG build_type=Release
|
||||||
|
|
||||||
# Build static binary
|
# Build static binary
|
||||||
RUN cmake -S /wibo -B /wibo/build -G Ninja -DCMAKE_BUILD_TYPE="$build_type" -DCMAKE_CXX_FLAGS="-static" \
|
RUN cmake -S /wibo -B /wibo/build -G Ninja \
|
||||||
|
-DCMAKE_BUILD_TYPE="$build_type" \
|
||||||
|
-DCMAKE_CXX_FLAGS="-static" \
|
||||||
|
-DBUILD_TESTING=ON \
|
||||||
|
-DWIBO_ENABLE_FIXTURE_TESTS=ON \
|
||||||
&& cmake --build /wibo/build \
|
&& cmake --build /wibo/build \
|
||||||
&& ( [ "$build_type" != "Release" ] || strip -g /wibo/build/wibo )
|
&& ( [ "$build_type" != "Release" ] || strip -g /wibo/build/wibo )
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Ubuntu 24.04 environment that matches CI toolchain and fixture tests.
|
# Build stage
|
||||||
FROM ubuntu:24.04 AS deps
|
FROM ubuntu:24.04 AS build
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
@ -15,14 +17,25 @@ RUN apt-get update \
|
|||||||
wget \
|
wget \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Copy source files
|
||||||
WORKDIR /wibo
|
WORKDIR /wibo
|
||||||
|
|
||||||
FROM deps AS dev
|
|
||||||
COPY . /wibo
|
COPY . /wibo
|
||||||
|
|
||||||
ARG BUILD_TYPE=Debug
|
# Build type (Release, Debug, RelWithDebInfo, MinSizeRel)
|
||||||
# Configure default build folders so docker build can cache compilation layers if desired.
|
ARG build_type=Release
|
||||||
RUN cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILD_TESTING=ON -DWIBO_ENABLE_FIXTURE_TESTS=ON \
|
|
||||||
&& cmake --build build
|
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/bash"]
|
RUN cmake -S /wibo -B /wibo/build -G Ninja \
|
||||||
|
-DCMAKE_BUILD_TYPE="$build_type" \
|
||||||
|
-DBUILD_TESTING=ON \
|
||||||
|
-DWIBO_ENABLE_FIXTURE_TESTS=ON \
|
||||||
|
&& cmake --build /wibo/build \
|
||||||
|
&& ( [ "$build_type" != "Release" ] || strip -g /wibo/build/wibo )
|
||||||
|
|
||||||
|
# Export binary (usage: docker build -f Dockerfile.ubuntu --target export --output dist .)
|
||||||
|
FROM scratch AS export
|
||||||
|
COPY --from=build /wibo/build/wibo .
|
||||||
|
|
||||||
|
# Runnable container
|
||||||
|
FROM ubuntu:24.04
|
||||||
|
COPY --from=build /wibo/build/wibo /usr/local/sbin/wibo
|
||||||
|
CMD ["/usr/local/sbin/wibo"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user