Add a GitHub action to build on Linux and macOS (#935)

As with Travis CI, the test is only deemed successful on each platform
if the Stella build completes successfully.

For Linux, the test runs on Ubuntu with the toolchain test build
repository, using G++ 9, and the packaged version of SDL2, which is
guaranteed to be at least 2.0.10.

For macOS, SDL2 2.0.10 is still built from the upstream source code;
however that no longer builds with the newer Xcode versions available
in GHAs, so the build now uses "Unix-style" ./configure && make.

The runners provide two cores on Linux and three cores on macOS, so
the compile stages use the appropriate -j setting to build in
parallel.

Signed-off-by: Stephen Kitt <steve@sk2.org>

Signed-off-by: Stephen Kitt <steve@sk2.org>
This commit is contained in:
Stephen Kitt 2022-10-10 19:15:55 +02:00 committed by GitHub
parent 7b5d25d9f1
commit d7d73234ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 63 deletions

39
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,39 @@
---
name: Build
on:
pull_request:
permissions: {}
jobs:
linux:
name: Linux
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- name: Install GCC 9 and SDL2
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install g++-9 libsdl2-dev
- name: Build Stella
run: |
./configure && make -j2 all
macos:
name: macOS
runs-on: macos-latest
steps:
- name: Check out the repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- name: Install SDL2
run: |
curl https://www.libsdl.org/release/SDL2-2.0.10.tar.gz | tar xzf -
mkdir SDL2-2.0.10/build
cd SDL2-2.0.10/build
../configure && make -j3 && sudo make install
- name: Build Stella
run: |
./configure && make -j3 all

View File

@ -1,63 +0,0 @@
# Build matrix / environment variables are explained on:
# http://about.travis-ci.org/docs/user/build-configuration/
# This file can be validated on: http://lint.travis-ci.org/
language: cpp
matrix:
include:
- os: linux
dist: xenial
compiler: gcc
env: GCC=9 CC=gcc-9 CXX=g++-9
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-9
- g++-9
update: true
- os: osx
osx_image: xcode11.3
compiler: clang
addons:
homebrew:
update: true
install:
- |
old_cwd=$(pwd)
cd ~
if [[ "$HOST" == macosx-* ]]; then
curl -O https://www.libsdl.org/release/SDL2-2.0.10.tar.gz
tar xzf SDL2-2.0.10.tar.gz
cd SDL2-2.0.10/Xcode/SDL
sed -i -e 's/@rpath//g' SDL.xcodeproj/project.pbxproj
xcodebuild -configuration Release
mkdir -p ~/Library/Frameworks/
ln -s `pwd`/build/Release/SDL2.framework ~/Library/Frameworks/
else
curl -O https://www.libsdl.org/release/SDL2-2.0.10.tar.gz
tar xzf SDL2-2.0.10.tar.gz
cd SDL2-2.0.10
mkdir build
cd build
../configure
make
sudo make install
fi
cd $old_cwd
script:
- |
./configure
make all