mirror of
https://github.com/D-Modem/gui.git
synced 2026-11-28 22:30:49 -08:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRTRNP9YEnRxydbrw9G
266 lines
10 KiB
YAML
266 lines
10 KiB
YAML
# Builds and tests the three apps and the library they share, and the
|
|
# Windows app for Linux and macOS (winport/)
|
|
name: Build
|
|
|
|
# The nightly release (nightly.yml) takes its files from this
|
|
# workflow's artifacts on main. Each artifact is a .tar.gz or a .zip,
|
|
# because an artifact does not keep the executable bit of a file.
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
linux:
|
|
name: Linux (GTK 4)
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
- name: Packages
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends \
|
|
cmake ninja-build pkg-config libgtk-4-dev libadwaita-1-dev \
|
|
libpulse-dev libsndfile1-dev libasound2-dev libusb-1.0-0-dev
|
|
- name: Build
|
|
run: |
|
|
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
|
cmake --build build
|
|
- name: Test
|
|
run: ctest --test-dir build --output-on-failure
|
|
- name: Test with the sanitizers
|
|
run: |
|
|
cmake -S . -B build-asan -G Ninja -DCMAKE_BUILD_TYPE=Debug \
|
|
-DCMAKE_C_FLAGS="-fsanitize=address,undefined -fno-sanitize-recover=all"
|
|
cmake --build build-asan --target dmodemctl_test
|
|
ctest --test-dir build-asan --output-on-failure -R dmodemctl
|
|
- name: SSH against a real sshd
|
|
run: |
|
|
sudo apt-get install -y --no-install-recommends openssh-server putty-tools
|
|
sudo useradd -m dmtest
|
|
echo 'dmtest:Sesame-42' | sudo chpasswd
|
|
# a key in a file, one of PuTTY's (.ppk) and one in an agent
|
|
ssh-keygen -q -t ed25519 -N '' -f "$RUNNER_TEMP/key"
|
|
: > "$RUNNER_TEMP/empty"
|
|
puttygen -t rsa -b 2048 -o "$RUNNER_TEMP/key.ppk" --new-passphrase "$RUNNER_TEMP/empty"
|
|
ssh-keygen -q -t ecdsa -N '' -f "$RUNNER_TEMP/agentkey"
|
|
eval "$(ssh-agent -a "$RUNNER_TEMP/agent.sock")"
|
|
ssh-add "$RUNNER_TEMP/agentkey"
|
|
unset SSH_AUTH_SOCK
|
|
puttygen "$RUNNER_TEMP/key.ppk" -O public-openssh -o "$RUNNER_TEMP/ppk.pub"
|
|
cat "$RUNNER_TEMP/key.pub" "$RUNNER_TEMP/agentkey.pub" "$RUNNER_TEMP/ppk.pub" > "$RUNNER_TEMP/authorized_keys"
|
|
sudo install -d -m 700 -o dmtest ~dmtest/.ssh
|
|
sudo install -m 600 -o dmtest "$RUNNER_TEMP/authorized_keys" ~dmtest/.ssh/authorized_keys
|
|
sudo mkdir -p /run/sshd
|
|
sudo /usr/sbin/sshd -p 2222 -o ListenAddress=127.0.0.1 -o PasswordAuthentication=yes
|
|
DMODEM_SSH_TEST=127.0.0.1:2222:dmtest:Sesame-42 DMODEM_SSH_TEST_KEY="$RUNNER_TEMP/key" \
|
|
DMODEM_SSH_TEST_PPK="$RUNNER_TEMP/key.ppk" DMODEM_SSH_TEST_AGENT="$RUNNER_TEMP/agent.sock" \
|
|
build/ssh/dmodemssh_test
|
|
- name: Package
|
|
run: |
|
|
DESTDIR="$PWD/pkg" cmake --install build --prefix /usr
|
|
tar -C pkg -czf dmodem-gui-linux-x86_64.tar.gz usr
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dmodem-linux
|
|
path: dmodem-gui-linux-x86_64.tar.gz
|
|
|
|
# Both Windows builds use clang-retro (https://clang-retro.github.io/),
|
|
# its toolchain package from its setup-toolchain action, on Linux
|
|
windows-9x:
|
|
name: Windows 95 and later, the modem built in (clang-retro, win32-picolibc)
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
- uses: clang-retro/dos-sdk/.github/actions/setup-toolchain@main
|
|
id: clang-dos
|
|
- name: Packages
|
|
run: |
|
|
sudo dpkg --add-architecture i386
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends ninja-build wine wine32:i386
|
|
- name: Build
|
|
run: |
|
|
cmake -S . -B build/win9x -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_TOOLCHAIN_FILE=cmake/clang-retro.cmake -DCLANG_RETRO_CONFIG=win32-picolibc \
|
|
-DCMAKE_CROSSCOMPILING_EMULATOR=wine
|
|
cmake --build build/win9x
|
|
- name: Test (Wine)
|
|
run: |
|
|
export WINEDEBUG=-all WINEPREFIX="$RUNNER_TEMP/wine"
|
|
wineboot -i >/dev/null 2>&1 || true
|
|
ctest --test-dir build/win9x --output-on-failure
|
|
- name: Imports (Windows 95, 98 and ME, and NT 4.0)
|
|
run: |
|
|
python3 "$CLANG_DOS/share/clang-dos/check-imports.py" build/win9x/windows/dmodem.exe
|
|
python3 "$CLANG_DOS/share/clang-dos/check-imports.py" --nt 4.0 build/win9x/windows/dmodem.exe
|
|
# (no iphlpapi.dll, which Windows 95 does not have, and no msvcrt.dll)
|
|
if "$CLANG_DOS/bin/llvm-objdump" -p build/win9x/windows/dmodem.exe |
|
|
grep -i "DLL Name: \(msvcrt\|iphlpapi\)"; then
|
|
exit 1
|
|
fi
|
|
"$CLANG_DOS/bin/llvm-nm" build/win9x/windows/dmodem.exe | grep -q dmodem_embed_start
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dmodem-windows-9x
|
|
path: build/win9x/windows/dmodem.exe
|
|
|
|
# The app with the modem built in (external/D-Modem), on msvcrt:
|
|
# Windows 98 SE, ME, 2000 and later. (The Windows 95 build above has
|
|
# the modem too, on picolibc and libc++.)
|
|
windows-98:
|
|
name: Windows 98 SE and later, the modem built in (clang-retro, win98)
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
- uses: clang-retro/dos-sdk/.github/actions/setup-toolchain@main
|
|
id: clang-dos
|
|
- name: Packages
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends ninja-build
|
|
- name: Build
|
|
run: |
|
|
cmake -S . -B build/win98 -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_TOOLCHAIN_FILE=cmake/clang-retro.cmake -DCLANG_RETRO_CONFIG=win98
|
|
cmake --build build/win98
|
|
- name: Imports (Windows 98 SE)
|
|
run: python3 "$CLANG_DOS/share/clang-dos/check-imports.py" build/win98/windows/dmodem.exe
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dmodem-windows-98
|
|
path: build/win98/windows/dmodem.exe
|
|
|
|
windows:
|
|
name: Windows 7 and later (clang-retro)
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
- uses: clang-retro/dos-sdk/.github/actions/setup-toolchain@main
|
|
id: clang-dos
|
|
- name: Packages
|
|
run: |
|
|
sudo dpkg --add-architecture i386
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends ninja-build wine wine32:i386
|
|
- name: Build
|
|
run: |
|
|
cmake -S . -B build/win7 -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_TOOLCHAIN_FILE=cmake/clang-retro.cmake -DCLANG_RETRO_CONFIG=win7 \
|
|
-DCMAKE_CROSSCOMPILING_EMULATOR=wine
|
|
cmake --build build/win7
|
|
- name: Test (Wine)
|
|
run: |
|
|
export WINEDEBUG=-all WINEPREFIX="$RUNNER_TEMP/wine"
|
|
wineboot -i >/dev/null 2>&1 || true
|
|
ctest --test-dir build/win7 --output-on-failure
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dmodem-windows
|
|
path: build/win7/windows/dmodem.exe
|
|
|
|
# The Windows app for Linux and macOS (winport/), over the portable
|
|
# Win32 layer of clang-retro MFC.
|
|
winport-linux:
|
|
name: Windows app on Linux (clang-retro MFC's Win32 layer)
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
repository: clang-retro/mfc
|
|
path: mfc
|
|
- name: Packages
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends \
|
|
cmake ninja-build clang llvm libx11-dev xvfb xauth
|
|
- name: Build
|
|
run: |
|
|
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
-DDMODEM_GUI_LINUX=OFF -DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC="$PWD/mfc" \
|
|
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
|
|
cmake --build build --target dmodem-win32
|
|
- name: Smoke test (Xvfb)
|
|
run: xvfb-run -a winport/test/smoke.sh build/winport/dmodem-win32
|
|
- name: Package
|
|
run: tar -C build/winport -czf dmodem-win32-linux-x86_64.tar.gz dmodem-win32
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dmodem-win32-linux
|
|
path: dmodem-win32-linux-x86_64.tar.gz
|
|
|
|
winport-macos:
|
|
name: Windows app on macOS (clang-retro MFC's Win32 layer)
|
|
runs-on: macos-15
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
repository: clang-retro/mfc
|
|
path: mfc
|
|
- name: Packages
|
|
run: brew install llvm
|
|
- name: Build
|
|
run: |
|
|
cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
-DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC="$PWD/mfc" \
|
|
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
|
|
cmake --build build --target dmodem-win32 -j"$(sysctl -n hw.ncpu)"
|
|
- name: Package
|
|
run: tar -C build/winport -czf dmodem-win32-macos-arm64.tar.gz dmodem-win32
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dmodem-win32-macos
|
|
path: dmodem-win32-macos-arm64.tar.gz
|
|
|
|
# The built-in modem (external/D-Modem) is built by CMake, which
|
|
# writes build/macos-embed.xcconfig for the Xcode project
|
|
macos:
|
|
name: macOS (SwiftUI)
|
|
runs-on: macos-15
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
- name: Library tests
|
|
run: |
|
|
cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0
|
|
cmake --build build
|
|
ctest --test-dir build --output-on-failure
|
|
- name: Project
|
|
run: |
|
|
brew install xcodegen
|
|
cd macos && xcodegen
|
|
- name: Build
|
|
run: |
|
|
cd macos
|
|
xcodebuild -project DModem.xcodeproj -scheme DModem \
|
|
-configuration Release -derivedDataPath ../build/xcode \
|
|
CODE_SIGN_IDENTITY=- build
|
|
- name: The built-in modem is in the app
|
|
run: |
|
|
app=build/xcode/Build/Products/Release/D-Modem.app/Contents/MacOS/D-Modem
|
|
lipo -archs "$app"
|
|
nm "$app" | grep -q dmodem_embed_start
|
|
# (ditto keeps the bundle's symbolic links and executable bits)
|
|
- name: Package
|
|
run: ditto -c -k --keepParent build/xcode/Build/Products/Release/D-Modem.app D-Modem-macos.zip
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dmodem-macos
|
|
path: D-Modem-macos.zip
|