Files
uc2/.github/workflows/build.yml
Eremey Valetov 09cdc80986 ci: build the DOS (DJGPP) target and consolidate the toolchain file
A new Linux job installs the andrewwutw DJGPP v3.4 cross-toolchain
(gcc 12.2.0, sha256-pinned), cross-compiles uc2.exe with
cmake/djgpp.cmake, and verifies the result is a DJGPP go32 DOS
executable. The DOS build had no CI coverage and could regress
silently.

The repo carried two diverged DJGPP toolchain files. djgpp.cmake
(referenced by the build docs) forces -nostdinc with explicit DJGPP
include paths, so it builds cleanly even on hosts where /usr/include
would otherwise leak past the cross-compiler. djgpp-toolchain.cmake
(previously referenced by the README) relied on the cross-gcc finding
its own headers and broke in that case. Keep djgpp.cmake as the single
toolchain file, point the README and roadmap at it, and drop
djgpp-toolchain.cmake.
2026-06-13 07:53:46 -04:00

105 lines
4.2 KiB
YAML

name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, name: Linux }
- { os: macos-latest, name: macOS }
- { os: windows-latest, name: Windows (MSVC) }
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@v4
- name: Lint -- forbid assert(side-effect)
if: runner.os == 'Linux'
run: python3 tests/scripts/check_assert_side_effects.py
- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build build --config Release
- name: Smoke test (Unix)
if: runner.os != 'Windows'
run: ./build/cli/uc2 -h
- name: Smoke test (Windows)
if: runner.os == 'Windows'
run: .\build\cli\Release\uc2.exe -h
- name: Test
run: ctest --test-dir build --output-on-failure -C Release
libarchive:
runs-on: ubuntu-latest
name: libarchive plugin
env:
LIBARCHIVE_VERSION: 3.7.7
LIBARCHIVE_SHA256: 4cc540a3e9a1eebdefa1045d2e4184831100667e6d7d5b315bb1cbc951f8ddff
steps:
- uses: actions/checkout@v4
- name: Fetch libarchive source
run: |
curl -fsSLO "https://github.com/libarchive/libarchive/releases/download/v${LIBARCHIVE_VERSION}/libarchive-${LIBARCHIVE_VERSION}.tar.gz"
echo "${LIBARCHIVE_SHA256} libarchive-${LIBARCHIVE_VERSION}.tar.gz" | sha256sum -c -
tar xzf "libarchive-${LIBARCHIVE_VERSION}.tar.gz"
- name: Build libarchive static (dependency-free)
run: |
cmake -S "libarchive-${LIBARCHIVE_VERSION}" -B larch-build \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DBUILD_SHARED_LIBS=OFF -DENABLE_TEST=OFF -DENABLE_TAR=OFF \
-DENABLE_CPIO=OFF -DENABLE_CAT=OFF -DENABLE_UNZIP=OFF \
-DENABLE_WERROR=OFF -DENABLE_ZLIB=OFF -DENABLE_BZip2=OFF \
-DENABLE_LZMA=OFF -DENABLE_ZSTD=OFF -DENABLE_LZ4=OFF \
-DENABLE_LIBXML2=OFF -DENABLE_EXPAT=OFF -DENABLE_OPENSSL=OFF \
-DENABLE_LIBB2=OFF -DENABLE_ICONV=OFF -DENABLE_ACL=OFF \
-DENABLE_XATTR=OFF -DENABLE_CNG=OFF -DENABLE_MBEDTLS=OFF \
-DENABLE_NETTLE=OFF -DENABLE_PCREPOSIX=OFF -DENABLE_PCRE2POSIX=OFF
cmake --build larch-build --target archive_static -j
- name: Configure UC2 with libarchive plugin
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release \
-DUC2_BUILD_LIBARCHIVE_PLUGIN=ON \
-DLIBARCHIVE_SOURCE_DIR="$PWD/libarchive-${LIBARCHIVE_VERSION}" \
-DLIBARCHIVE_LIBRARY="$PWD/larch-build/libarchive/libarchive.a"
- name: Build
run: cmake --build build -j
- name: Round-trip test
run: ctest --test-dir build --output-on-failure -R libarchive_roundtrip
djgpp:
runs-on: ubuntu-latest
name: DOS (DJGPP)
env:
DJGPP_URL: https://github.com/andrewwutw/build-djgpp/releases/download/v3.4/djgpp-linux64-gcc1220.tar.bz2
DJGPP_SHA256: 8464f17017d6ab1b2bb2df4ed82357b5bf692e6e2b7fee37e315638f3d505f00
# Keep host include dirs out of the cross-compiler's search path in
# every step (the toolchain file also forces -nostdinc, but a stray
# CPATH on the runner would otherwise leak glibc headers).
CPATH: ''
CPLUS_INCLUDE_PATH: ''
steps:
- uses: actions/checkout@v4
- name: Install DJGPP cross-toolchain
run: |
curl -fsSL -o djgpp.tar.bz2 "$DJGPP_URL"
echo "${DJGPP_SHA256} djgpp.tar.bz2" | sha256sum -c -
sudo tar xjf djgpp.tar.bz2 -C /opt # -> /opt/djgpp
- name: Configure (DJGPP toolchain)
run: |
cmake -B build-dos \
-DCMAKE_TOOLCHAIN_FILE=cmake/djgpp.cmake \
-DDJGPP_ROOT=/opt/djgpp -DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build build-dos -j
- name: Verify DOS executable
run: |
file build-dos/cli/uc2.exe
file build-dos/cli/uc2.exe | grep -q "DJGPP go32 DOS extender" \
|| { echo "uc2.exe is not a DJGPP DOS executable"; exit 1; }