mirror of
https://github.com/gbdev/rgbds.git
synced 2026-03-25 06:13:03 +00:00
`FetchContent` respects existing installs, and downloads and compiles the libs if they aren't found. This is admittedly a little finicky, since this ignores the usual `Find*` modules provided by CMake, requiring a bit of glue on our side. But, one upside is that this moves that logic from our CI into the build system, which can thus benefit other downstream users. This also opens the door to some improvements in upcoming commits. Doing this with Bison turned out to be much more painful, however, due to `FindBISON` providing the specific `bison_target` command; thus, it remains installed externally, so that it can be picked up by `FindBISON`. This also bumps our CMake version requirement slightly, though it's possible that older versions keep working, or could be supported with small patches; however, our CI doesn't provide anything below 3.31, so we can't check.
143 lines
5.2 KiB
YAML
143 lines
5.2 KiB
YAML
name: Create release artifacts
|
|
on:
|
|
push:
|
|
tags:
|
|
- v[0-9]*
|
|
|
|
jobs:
|
|
windows:
|
|
runs-on: windows-2022
|
|
strategy:
|
|
matrix:
|
|
bits: [32, 64]
|
|
include:
|
|
- bits: 32
|
|
arch: x86
|
|
platform: Win32
|
|
- bits: 64
|
|
arch: x86_x64
|
|
platform: x64
|
|
fail-fast: false
|
|
steps:
|
|
- name: Get version from tag
|
|
shell: bash
|
|
run: | # Turn "vX.Y.Z" into "X.Y.Z"
|
|
VERSION="${{ github.ref_name }}"
|
|
echo "version=${VERSION#v}" >> $GITHUB_ENV
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
- name: Install deps
|
|
run: .github/scripts/get_win_deps.ps1
|
|
- name: Build Windows binaries
|
|
shell: bash
|
|
# We instruct CMake to download and build third-party projects outside of our source tree,
|
|
# otherwise they can trigger `-Werror=dev` (from the `develop` preset).
|
|
run: |
|
|
cmake -S . -B build -A ${{ matrix.platform }} -DCMAKE_BUILD_TYPE=Release -DFETCHCONTENT_BASE_DIR="$TEMP/cmake-deps" -DBISON_EXECUTABLE=bison/win_bison.exe
|
|
cmake --build build --config Release -j
|
|
cmake --install build --config Release --prefix install_dir --verbose
|
|
- name: Package binaries
|
|
run: |
|
|
Compress-Archive -LiteralPath @("install_dir/bin/rgbasm.exe", "install_dir/bin/rgblink.exe", "install_dir/bin/rgbfix.exe", "install_dir/bin/rgbgfx.exe", "install_dir/bin/z.dll", "install_dir/bin/libpng16.dll") "rgbds-win${{ matrix.bits }}.zip"
|
|
- name: Upload Windows binaries
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: win${{ matrix.bits }}
|
|
path: rgbds-win${{ matrix.bits }}.zip
|
|
|
|
macos:
|
|
runs-on: macos-14
|
|
steps:
|
|
- name: Get version from tag
|
|
shell: bash
|
|
run: | # Turn "refs/tags/vX.Y.Z" into "X.Y.Z"
|
|
VERSION="${{ github.ref_name }}"
|
|
echo "version=${VERSION#v}" >> $GITHUB_ENV
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
- name: Install deps
|
|
shell: bash
|
|
run: |
|
|
./.github/scripts/install_deps.sh macos
|
|
- name: Build libpng
|
|
run: |
|
|
./.github/scripts/build_libpng.sh
|
|
# We force linking libpng statically; the other libs are provided by macOS itself
|
|
- name: Build binaries
|
|
run: |
|
|
make -kj CXXFLAGS="-O3 -flto -DNDEBUG -mmacosx-version-min=10.9 -arch x86_64 -arch arm64" PNGCFLAGS="-I libpng-staging/include" PNGLDLIBS="libpng-staging/lib/libpng.a -lz" Q=
|
|
strip rgb{asm,link,fix,gfx}
|
|
- name: Package binaries
|
|
run: |
|
|
zip --junk-paths rgbds-macos.zip rgb{asm,link,fix,gfx} man/* .github/scripts/install.sh
|
|
- name: Upload macOS binaries
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: macos
|
|
path: rgbds-macos.zip
|
|
|
|
linux:
|
|
runs-on: ubuntu-22.04 # Oldest supported, for best glibc compatibility.
|
|
steps:
|
|
- name: Get version from tag
|
|
shell: bash
|
|
run: | # Turn "refs/tags/vX.Y.Z" into "X.Y.Z"
|
|
VERSION="${{ github.ref_name }}"
|
|
echo "version=${VERSION#v}" >> $GITHUB_ENV
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
- name: Install deps
|
|
shell: bash
|
|
run: |
|
|
./.github/scripts/install_deps.sh ubuntu-22.04
|
|
- name: Build binaries
|
|
run: |
|
|
make -kj WARNFLAGS="-Wall -Wextra -pedantic -static" PKG_CONFIG="pkg-config --static" Q=
|
|
strip rgb{asm,link,fix,gfx}
|
|
- name: Package binaries
|
|
run: |
|
|
tar caf rgbds-linux-x86_64.tar.xz --transform='s#.*/##' rgb{asm,link,fix,gfx} man/* .github/scripts/install.sh
|
|
- name: Upload Linux binaries
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: linux
|
|
path: rgbds-linux-x86_64.tar.xz
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs: [windows, macos, linux]
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Get version from tag
|
|
shell: bash
|
|
run: | # Turn "refs/tags/vX.Y.Z" into "X.Y.Z"
|
|
VERSION="${{ github.ref_name }}"
|
|
echo "version=${VERSION#v}" >> $GITHUB_ENV
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
- name: Package sources
|
|
run: |
|
|
make dist Q=
|
|
ls
|
|
- name: Download Linux binaries
|
|
uses: actions/download-artifact@v4
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
body: |
|
|
Please ensure that the packages below work properly.
|
|
Once that's done, replace this text with the changelog, un-draft the release, and update the `release` branch.
|
|
By the way, if you forgot to update `include/version.hpp`, RGBASM's version test is going to fail in the tag's regression testing! (Use `git push --delete origin <tag>` to delete it)
|
|
draft: true # Don't publish the release quite yet...
|
|
prerelease: ${{ contains(github.ref, '-rc') }}
|
|
files: |
|
|
win32/rgbds-win32.zip
|
|
win64/rgbds-win64.zip
|
|
macos/rgbds-macos.zip
|
|
linux/rgbds-linux-x86_64.tar.xz
|
|
rgbds-source.tar.gz
|
|
fail_on_unmatched_files: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|