mirror of
https://github.com/gbdev/rgbds.git
synced 2026-09-23 06:07:06 +00:00
Since we build in a different configuration, it's plausible that some warnings would only surface in Release (optimised) builds. That should be an immediate blocker, so let's make it fail loudly.
136 lines
4.6 KiB
YAML
136 lines
4.6 KiB
YAML
name: Create release artifacts
|
|
on:
|
|
push:
|
|
tags:
|
|
- v[0-9]*
|
|
|
|
concurrency:
|
|
group: ${{github.workflow}}-${{github.ref}}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
# Force colored output (see https://bixense.com/clicolors/ and https://force-color.org/)
|
|
TERM: xterm-256color
|
|
CLICOLOR: 1
|
|
CLICOLOR_FORCE: 1
|
|
|
|
CMAKE_COLOR_DIAGNOSTICS: ON # Tells CMake-generated build systems to have colored output.
|
|
CMAKE_BUILD_TYPE: Release # `cmake -S` now implies `-DCMAKE_BUILD_TYPE=Release`.
|
|
CMAKE_CONFIG_TYPE: Release # `cmake --build` now implies `--config Release`.
|
|
|
|
# We instruct CMake to download and build third-party projects in the same place as in `testing.yml`
|
|
# to prevent divergence between testing and release workflows.
|
|
DEPS_ROOT_DIR: ~/_deps
|
|
|
|
# We use Ninja as the generator for CMake below because it provides synchronous output by default,
|
|
# and only shows full command lines when they fail.
|
|
|
|
jobs:
|
|
windows:
|
|
runs-on: windows-2022
|
|
strategy:
|
|
matrix:
|
|
bits: [32, 64]
|
|
fail-fast: false
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v7
|
|
- name: Install deps
|
|
run: |
|
|
bash .github/scripts/install-deps.sh windows
|
|
- name: Build Windows binaries
|
|
shell: cmd
|
|
run: |
|
|
call .github\scripts\msvc-env.bat ${{ matrix.bits }}
|
|
cmake -B build -G Ninja -DFETCHCONTENT_BASE_DIR="${{ env.DEPS_ROOT_DIR }}" ^
|
|
-DCMAKE_COMPILE_WARNING_AS_ERROR=YES -DCMAKE_LINK_WARNING_AS_ERROR=YES ^
|
|
-DCMAKE_C_FLAGS="/nologo" -DCMAKE_INSTALL_BINDIR=. -DCPACK_COMPONENTS_ALL=binaries
|
|
cmake --build build -- -k 0
|
|
- name: Package binaries
|
|
working-directory: build
|
|
run: |
|
|
cpack -DCPACK_PACKAGE_FILE_NAME=rgbds-win${{ matrix.bits }} -G ZIP --verbose
|
|
- name: Upload Windows binaries
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
path: build/rgbds-win${{ matrix.bits }}.zip
|
|
archive: false
|
|
if-no-files-found: error
|
|
|
|
macos:
|
|
runs-on: macos-26
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v7
|
|
- name: Install deps
|
|
run: |
|
|
./.github/scripts/install-deps.sh macos lld
|
|
- name: Build binaries
|
|
run: |
|
|
cmake -B build -G Ninja --preset macos-static -DFETCHCONTENT_BASE_DIR="${{ env.DEPS_ROOT_DIR }}" \
|
|
-DCMAKE_COMPILE_WARNING_AS_ERROR=YES -DCMAKE_LINK_WARNING_AS_ERROR=YES
|
|
cmake --build build -- -k 0
|
|
strip rgb{asm,link,fix,gfx}
|
|
env:
|
|
LDFLAGS: -fuse-ld=lld # cmake/macos-static.cmake comments explain why we use lld.
|
|
- name: Create install script
|
|
run: |
|
|
make install.sh
|
|
- name: Package binaries
|
|
run: |
|
|
zip --junk-paths rgbds-macos.zip rgb{asm,link,fix,gfx} man/* install.sh
|
|
- name: Upload macOS binaries
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
path: rgbds-macos.zip
|
|
archive: false
|
|
if-no-files-found: error
|
|
|
|
linux:
|
|
runs-on: ubuntu-22.04 # Oldest supported, for best glibc compatibility.
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v7
|
|
- name: Install deps
|
|
run: |
|
|
./.github/scripts/install-deps.sh ubuntu-22.04
|
|
- name: Build binaries
|
|
run: |
|
|
make -k -j "$(getconf _NPROCESSORS_ONLN)" WARNFLAGS="-Werror -Wall -Wextra -pedantic -static" PKG_CONFIG="pkg-config --static" Q=
|
|
strip rgb{asm,link,fix,gfx}
|
|
- name: Create install script
|
|
run: |
|
|
make install.sh Q=
|
|
- name: Package binaries
|
|
run: |
|
|
tar caf rgbds-linux-x86_64.tar.xz --transform='s#.*/##' rgb{asm,link,fix,gfx} man/* install.sh
|
|
- name: Upload Linux binaries
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
path: rgbds-linux-x86_64.tar.xz
|
|
archive: false
|
|
if-no-files-found: error
|
|
|
|
release:
|
|
runs-on: ubuntu-slim
|
|
needs: [windows, macos, linux]
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v7
|
|
- name: Package sources
|
|
run: |
|
|
make dist Q=
|
|
- name: Download all binary packages
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
skip-decompress: true # Do not decompress `.zip`s, we want them as-is.
|
|
merge-multiple: true # Do not download non-`.zip`s into separate directories.
|
|
- name: Draft the release
|
|
run: |
|
|
.github/scripts/draft-release.sh "${ref#refs/tags/}"
|
|
env:
|
|
ref: ${{ github.ref_name }}
|
|
GH_TOKEN: ${{ github.token }} # Required by the `gh` command.
|