Add GitHub Actions configuration file to enable CI

There are several builds defined here, and a few more sketched out that
don't quite work.

Most of the steps call out to external shell or batch files,
to make things easier to keep track of.
This commit is contained in:
2022-07-05 13:54:28 -04:00
parent cc2e3403f8
commit b5a1bbf283
11 changed files with 273 additions and 0 deletions

197
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,197 @@
{
name: CI,
on: {
push: {
branches: [ master, ci ]
},
pull_request: {
branches: [ master ]
}
},
jobs: {
macos-old: {
runs-on: macos-10.14,
env: {
DEVELOPER_DIR: /Applications/Xcode_10.3.app/Contents/Developer
},
steps: [
{
name: checkout,
uses: actions/checkout@v2
},
{
name: install Boost,
run: brew install Boost
},
{
name: install SFML,
run: ./.github/workflows/scripts/mac/install-sfml.sh
},
{
name: patch Xcode project,
run: ./.github/workflows/scripts/mac/fix-xcode-proj.sh
},
{
name: build,
run: ./.github/workflows/scripts/mac/xcode-build.sh
},
{
name: unit tests,
run: ./.github/workflows/scripts/mac/run-tests.sh
}
]
},
macos-xcode: {
runs-on: macos-10.15,
env: {
DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer
},
steps: [
{
name: checkout,
uses: actions/checkout@v2
},
{
name: install Boost,
run: brew install Boost
},
{
name: install SFML,
run: ./.github/workflows/scripts/mac/install-sfml.sh
},
{
name: patch Xcode project,
run: ./.github/workflows/scripts/mac/fix-xcode-proj.sh
},
{
name: build,
run: ./.github/workflows/scripts/mac/xcode-build.sh
},
{
name: unit tests,
run: ./.github/workflows/scripts/mac/run-tests.sh
}
]
},
# macos-scons: {
# runs-on: macos-10.15,
# steps: [
# {
# name: checkout,
# uses: actions/checkout@v2
# },
# {
# name: install dependencies,
# run: brew install scons SFML Boost
# },
# {
# name: build and unit test,
# run: ./.github/workflows/scripts/mac/scons-build.sh
# }
# ]
# },
win-old: {
runs-on: windows-2016,
steps: [
{
name: checkout,
uses: actions/checkout@v2
},
{
name: install dependencies,
run: '.\.github\workflows\scripts\win\install-deps.bat x86'
},
{
name: build,
run: '.\.github\workflows\scripts\win\msvc-build.bat x86'
}
]
},
win: {
runs-on: windows-2019,
steps: [
{
name: checkout,
uses: actions/checkout@v2
},
{
name: install dependencies,
run: '.\.github\workflows\scripts\win\install-deps.bat x64'
},
{
name: build,
run: '.\.github\workflows\scripts\win\msvc-build.bat x64'
},
{
name: unit tests,
run: '.\.github\workflows\scripts\win\run-tests.bat'
}
]
},
win-scons: {
runs-on: windows-2019,
steps: [
{
name: checkout,
uses: actions/checkout@v2
},
{
name: install build dependencies,
run: 'vcpkg install libxml2 && pip install scons'
},
{
name: install dependencies,
run: '.\.github\workflows\scripts\win\install-deps.bat x64'
},
{
name: build and unit test,
run: '.\.github\workflows\scripts\win\scons-build.bat'
}
]
},
# win-mingw: {
# runs-on: windows-2019,
# steps: [
# {
# name: checkout,
# uses: actions/checkout@v2
# },
# {
# name: install build dependencies,
# run: 'vcpkg install libxml2 && pip install scons'
# },
# {
# name: install dependencies,
# run: '.\.github\workflows\scripts\win\install-deps.bat x64'
# },
# {
# name: build and unit test,
# run: scons toolset=mingw
# }
# ]
# },
linux: {
runs-on: ubuntu-20.04,
steps: [
{
name: checkout,
uses: actions/checkout@v2
},
{
name: install dependencies,
run: 'sudo apt-get install scons libxml2-utils zlib1g libsfml-dev libboost-all-dev zenity'
},
{
name: install TGUI,
run: 'sudo ./.github/workflows/scripts/linux/install-tgui.sh'
},
{
name: build and unit test,
run: CCFLAGS=-fdiagnostics-color=always scons
}
],
}
}
}

View File

@@ -0,0 +1,9 @@
#!/bin/sh -ve
git clone --depth 1 -b 0.8 https://github.com/texus/TGUI.git
cd TGUI
export CLICOLOR_FORCE=1
cmake .
make
cmake --install .
cd .. # Probably not needed but...

View File

@@ -0,0 +1,3 @@
#!/bin/sh -v
sed -E -i '' -e 's| "?/Library/Frameworks/([a-zA-Z-]+)\.framework"?| "/usr/local/Frameworks/\1.framework"|' -e 's|/opt/local/libexec/boost/[0-9.]+/lib/|/usr/local/lib/|' proj/xc12/BoE.xcodeproj/project.pbxproj

View File

@@ -0,0 +1,9 @@
#!/bin/sh -ve
# brew install SFML does not install it as frameworks,
# so instead we manually download the release from GitHub
# and copy the files to an appropriate location.
curl -LO https://github.com/SFML/SFML/releases/download/2.5.1/SFML-2.5.1-macOS-clang.tar.gz
tar -xzf SFML-2.5.1-macOS-clang.tar.gz
cp -r SFML-2.5.1-macOS-clang/Frameworks/* SFML-2.5.1-macOS-clang/extlibs/* $(brew --prefix)/Frameworks

7
.github/workflows/scripts/mac/run-tests.sh vendored Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh -ve
cd test
# These are the same command-line arguments that are passed in the Xcode scheme.
# If the scheme is changed, these should be updated too.
../proj/xc12/build/Release/boe_test -i --order lex

View File

@@ -0,0 +1,6 @@
#!/bin/sh -ve
export CC="$(brew --prefix llvm)/bin/clang"
export CXX="$(brew --prefix llvm)/bin/clang++"
scons CXXFLAGS="-I/usr/local/opt/zlib/include" LINKFLAGS="-L/usr/local/opt/zlib/lib"

17
.github/workflows/scripts/mac/xcode-build.sh vendored Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh -v
set -o pipefail
xcodebuild ARCHS=x86_64 -project proj/xc12/BoE.xcodeproj -alltargets -configuration Release |
tee build.log |
xcpretty --color
EXIT=$?
if [ ! $EXIT ]; then
echo 'FULL BUILD LOG:'
echo
echo build.log
fi
exit $EXIT

View File

@@ -0,0 +1,2 @@
vcpkg install zlib:%1-windows sfml:%1-windows opengl:%1-windows boost-any:%1-windows boost-dynamic-bitset:%1-windows boost-ptr-container:%1-windows boost-core:%1-windows boost-filesystem:%1-windows boost-system:%1-windows boost-date-time:%1-windows boost-chrono:%1-windows boost-math:%1-windows

View File

@@ -0,0 +1,9 @@
vcpkg integrate install
setlocal enabledelayedexpansion
for /f "usebackq tokens=*" %%i in (`vswhere -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do (
"%%i" -clp:ForceConsoleColor -target:Build -property:Configuration=Release -property:Platform=%1 "proj/vs2017/Blades of Exile.sln"
exit /b !errorlevel!
)

View File

@@ -0,0 +1,6 @@
cd test
@rem These are the same command-line arguments that are passed in the Xcode scheme.
@rem If the scheme is changed, these should be updated too.
"..\proj\vs2017\x64\Release\Tests.exe" -i --order lex

View File

@@ -0,0 +1,8 @@
setlocal enabledelayedexpansion
for /f "usebackq tokens=*" %%i in (`vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -find **/Auxiliary/Build/vcvarsall.bat`) do (
%%i
)
scons