Merge branch 'wesnoth:master' into master #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VCPKG_FEATURE_FLAGS: dependencygraph | |
jobs: | |
checks: # checks that don't need a wesnoth binary | |
runs-on: ubuntu-latest | |
container: | |
image: wesnoth/wesnoth:2204-master | |
options: --tty # docker create options | |
env: | |
CLICOLOR_FORCE: 1 | |
steps: | |
- { uses: actions/checkout@v3, with: { submodules: "recursive" } } | |
- name: Check for invalid characters | |
run: | | |
./utils/CI/check_utf8.sh | |
./utils/CI/utf8_bom_dog.sh | |
- name: Whitespace and WML indentation check | |
if: success() || failure() | |
run: | | |
git config --global --add safe.directory '*' | |
./utils/CI/fix_whitespace.sh; git status; [ "$(git status --short | wc -l)" = 0 ] | |
- name: Run luacheck | |
if: success() || failure() | |
run: luacheck . | |
- name: Doxygen check | |
if: success() || failure() | |
run: doxygen doc/doxygen/Doxyfile | |
ubuntu: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { tool: scons, cc: gcc, cxx: g++, cfg: release, lto: true } | |
- { tool: cmake, cc: clang, cxx: clang++, cfg: debug, lto: false } | |
runs-on: ubuntu-latest | |
container: | |
image: wesnoth/wesnoth:2204-master | |
options: --tty # docker create options | |
env: | |
TOOL: ${{ matrix.tool }} | |
CFG: ${{ matrix.cfg }} | |
CC: ${{ matrix.cc }} | |
CXX: ${{ matrix.cxx }} | |
CXX_STD: 17 | |
LTO: ${{ matrix.lto }} | |
CLICOLOR_FORCE: 1 | |
SDL_VIDEODRIVER: dummy | |
steps: | |
- { uses: actions/checkout@v3, with: { submodules: "recursive" } } | |
# wesnothd and campaignd should be buildable without SDL2 being present | |
- name: Build wesnoth, wesnothd, campaignd and unit tests | |
id: build # needed to check step outcome | |
run: | | |
case $TOOL in | |
scons) | |
build() { | |
scons "$@" build="$CFG" ctool="$CC" cxxtool="$CXX" cxx_std="$CXX_STD" \ | |
extra_flags_config="-pipe" strict=true forum_user_handler=true \ | |
nls=false enable_lto="$LTO" force_color=true jobs=2 --debug=time | |
} | |
build wesnoth boost_unit_tests | |
apt remove -y -qq libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev | |
build wesnothd campaignd | |
;; | |
cmake) | |
build() { | |
cmake "$@" -DCMAKE_BUILD_TYPE="$CFG" -DCXX_STD="$CXX_STD" \ | |
-DEXTRA_FLAGS_CONFIG="-pipe" -DENABLE_STRICT_COMPILATION=true -DENABLE_MYSQL=true \ | |
-DENABLE_NLS=false -DENABLE_LTO="$LTO" -DFORCE_COLOR_OUTPUT=true -DLTO_JOBS=2 . | |
} | |
build -DENABLE_GAME=true -DENABLE_SERVER=false -DENABLE_CAMPAIGN_SERVER=false -DENABLE_TESTS=true | |
make conftests | |
make VERBOSE=1 -j2 | |
apt remove -y -qq libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev | |
build -DENABLE_GAME=false -DENABLE_SERVER=true -DENABLE_CAMPAIGN_SERVER=true -DENABLE_TESTS=false | |
make VERBOSE=1 -j2 | |
;; | |
esac | |
- name: Check path options | |
if: success() || steps.build.outcome == 'success' | |
run: | | |
./wesnoth --version | |
for opt in config data userconfig userdata | |
do | |
output=$(./wesnoth --nobanner --"$opt"-path) | |
if [ "$output" = "" ]; then printf 'option --%s-path prints nothing to stdout!' "$opt" >&2; exit 1; fi | |
printf '%s-path: %s\n' "$opt" "$output" | |
done | |
- name: WML validation | |
if: success() || steps.build.outcome == 'success' | |
run: ./utils/CI/schema_validation.sh | |
- name: Run WML tests | |
if: success() || steps.build.outcome == 'success' | |
run: ./run_wml_tests -g -c -t 20 | |
- name: Run play tests | |
if: success() || steps.build.outcome == 'success' | |
run: ./utils/CI/play_test_executor.sh | |
- name: Run MP tests | |
if: success() || steps.build.outcome == 'success' | |
run: ./utils/CI/mp_test_executor.sh | |
- name: Run unit tests | |
if: success() || steps.build.outcome == 'success' | |
run: ./run_boost_tests | |
steam-runtime: | |
runs-on: ubuntu-latest | |
steps: | |
- { uses: actions/checkout@v3, with: { submodules: "recursive" } } | |
- name: Steam Runtime | |
run: | | |
version=$(sed -n 's/#define VERSION "\(.*\)"/\1/p' src/wesconfig.h) | |
cd utils/dockerbuilds && ./make_steam_build | |
tar -cf "steambuild-$version.tar" steambuild | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Steam-Linux | |
path: utils/dockerbuilds/steambuild-*.tar | |
mingw: | |
runs-on: ubuntu-latest | |
steps: | |
- { uses: actions/checkout@v3, with: { submodules: "recursive" } } | |
- name: MinGW Crosscompile | |
run: | | |
version=$(sed -n 's/#define VERSION "\(.*\)"/\1/p' src/wesconfig.h) | |
git archive --format=tar HEAD > "wesnoth-$version.tar" | |
tar -rf "wesnoth-$version.tar" src/modules/ | |
bzip2 "wesnoth-$version.tar" | |
cd utils/dockerbuilds && ./make_mingw_build | |
mv mingwbuild/wesnoth*-win64.exe "wesnoth-$version-win64.exe" | |
- name: Upload Source | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Source | |
path: wesnoth-*.tar.bz2 | |
- name: Upload Windows-Installer | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Windows-Installer | |
path: utils/dockerbuilds/wesnoth-*-win64.exe | |
flatpak: | |
runs-on: ubuntu-latest | |
container: | |
image: wesnoth/wesnoth:flatpak-master | |
options: --tty --cap-add=ALL --privileged # docker create options | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: "recursive" | |
- name: Flatpak | |
run: | | |
# write to an ignored filename so the build is not marked as modified | |
jq '.modules |= map(select(.name == "wesnoth").sources[0]={"type":"dir","path":"."}) | ."build-options".env.FLATPAK_BUILDER_N_JOBS="2"' packaging/flatpak/org.wesnoth.Wesnoth.json > wesnoth-manifest.json | |
flatpak-builder --force-clean --default-branch=ci --disable-rofiles-fuse wesnoth-app wesnoth-manifest.json | |
flatpak build-export export wesnoth-app ci | |
flatpak build-bundle export wesnoth.flatpak org.wesnoth.Wesnoth ci --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo | |
- name: Upload flatpak bundle | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Flatpak-Bundle | |
path: wesnoth.flatpak | |
translations: | |
runs-on: ubuntu-latest | |
container: | |
image: wesnoth/wesnoth:2204-master | |
env: | |
LANGUAGE: en_US.UTF-8 | |
LANG: en_US.UTF-8 | |
LC_ALL: en_US.UTF-8 | |
CLICOLOR_FORCE: 1 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: "recursive" | |
- name: Translations | |
run: | | |
cmake -DENABLE_NLS=true -DENABLE_GAME=false -DENABLE_SERVER=false -DENABLE_CAMPAIGN_SERVER=false -DENABLE_TESTS=false -DENABLE_POT_UPDATE_TARGET=TRUE . | |
make update-po4a-man; echo "Ran make update-po4a-man" | |
make update-po4a-manual; echo "Ran make update-po4a-manual" | |
make pot-update; echo "Ran make pot-update" | |
make mo-update; echo "Ran make mo-update" | |
make clean | |
scons translations build=release --debug=time nls=true jobs=2; echo "Ran scons translations" | |
scons pot-update; echo "Ran scons pot-update" | |
scons update-po4a; echo "Ran scons update-po4a" | |
scons manual | |
macos-intel: | |
strategy: | |
fail-fast: false | |
matrix: | |
cfg: [ Debug, Release ] | |
runs-on: macos-11.0 | |
env: | |
CFG: ${{ matrix.cfg }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: "recursive" | |
- name: Get dependencies | |
run: | | |
HOMEBREW_NO_AUTO_UPDATE=1 brew install scons | |
./projectfiles/Xcode/Fix_Xcode_Dependencies | |
- name: Build translations | |
run: scons translations build=release --debug=time nls=true jobs=2 | |
- name: Build wesnoth and unit tests | |
working-directory: projectfiles/Xcode | |
run: xcodebuild ARCHS=x86_64 -project "The Battle for Wesnoth.xcodeproj" -target "The Battle for Wesnoth" -target "unit_tests" -configuration "$CFG" | |
# - name: Create disk image | |
# working-directory: projectfiles/Xcode | |
# run: hdiutil create -volname "Wesnoth_$CFG" -fs 'HFS+' -srcfolder "build/$CFG" -ov -format UDBZ "Wesnoth_${CFG}.dmg" | |
- name: Run WML tests | |
if: matrix.cfg == 'Release' | |
run: ./run_wml_tests -g -c -t 30 -p "projectfiles/Xcode/build/$CFG/The Battle for Wesnoth.app/Contents/MacOS/The Battle for Wesnoth" | |
- name: Run unit tests | |
run: ./run_boost_tests --path=projectfiles/Xcode/build/"$CFG" --executable=unit_tests | |
windows: | |
strategy: | |
fail-fast: false | |
matrix: | |
cfg: [Debug, Release] | |
env: | |
CFG: ${{ matrix.cfg }} | |
defaults: | |
run: | |
shell: cmd | |
runs-on: windows-2019 | |
steps: | |
- { uses: actions/checkout@v3, with: { submodules: "recursive" } } | |
- name: Cache object files | |
id: windows-cache | |
uses: actions/cache@v3 | |
with: | |
path: vcpkg_installed # vcpkg generates this dir next to vcpkg.json | |
key: win-cache-master-${{ matrix.cfg }}-0004 | |
- name: Add msbuild to PATH | |
uses: microsoft/[email protected] | |
# checkout a specific commit to prevent vcpkg ABI changes from invalidating the cache (https://learn.microsoft.com/en-us/vcpkg/users/binarycaching#abi-hash) | |
# the commit itself is just whatever happens to be the latest commit when a newer version is needed | |
- name: Build vcpkg | |
run: | | |
git clone https://github.com/microsoft/vcpkg | |
git -C vcpkg checkout 78b61582c9e093fda56a01ebb654be15a0033897 | |
vcpkg/bootstrap-vcpkg.bat | |
- name: Setup cmake | |
uses: jwlawson/[email protected] | |
with: | |
cmake-version: '3.20.6' | |
- name: Run cmake | |
run: | | |
cmake -DCMAKE_BUILD_TYPE=%CFG% -DENABLE_GAME=true -DENABLE_SERVER=true -DENABLE_CAMPAIGN_SERVER=true -DENABLE_TESTS=true -DENABLE_MYSQL=false -DENABLE_NLS=false -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_GENERATOR_PLATFORM=x64 -G "Visual Studio 16 2019" . | |
# delete buildtrees directory to free up space after cmake invokes vcpkg to build the dependencies | |
# otherwise the job was failing when trying to write a .obj file | |
# building vcpkg on the more spacious C drive didn't work since for some reason vcpkg decides to not create the pango/cairo pkgconfig files there | |
- name: Build wesnoth, wesnothd, campaignd and unit tests | |
run: | | |
rmdir /s /q vcpkg\buildtrees | |
MSBuild.exe wesnoth.sln -p:Configuration=%CFG% | |
- name: Run WML unit tests | |
if: matrix.cfg == 'Release' | |
run: python run_wml_tests -v -g -c -t 20 -p %CFG%/wesnoth.exe | |
# run after all other jobs have completed to check overall build status | |
notification: | |
runs-on: ubuntu-latest | |
needs: [checks, ubuntu, steam-runtime, mingw, flatpak, translations, macos-intel, windows] | |
if: failure() && github.event_name == 'push' | |
steps: | |
- name: Discord Notification | |
uses: rjstone/discord-webhook-notify@v1 | |
with: | |
severity: error | |
webhookUrl: ${{ secrets.DISCORD_CI_WEBHOOK }} | |
description: |- | |
pusher: ${{ github.actor }} | |
commit: ${{ github.event.head_commit.message }} | |
commit url: ${{ github.event.head_commit.url }} | |
- name: IRC Notification | |
uses: rectalogic/notify-irc@v1 | |
env: | |
COLOR: ${{ fromJSON('"\u0003"') }} | |
BLUE: 02 | |
PURPLE: 06 | |
SILVER: 15 | |
with: | |
channel: ${{ vars.IRC_CHANNEL }} | |
server: ${{ vars.IRC_SERVER }} | |
nickname: ${{ vars.IRC_NICK }} # is also used for sasl username | |
sasl_password: ${{ secrets.IRC_SASL_PASSWORD }} | |
message: >- | |
${{ format('❌ CI workflow run failed on {0}{1}{2}{0}: {3} by {0}{4}{5}{0}: {0}{6}{7}{0}', env.COLOR, env.PURPLE, github.ref_name, github.event.head_commit.message, env.SILVER, github.actor, env.BLUE, github.event.head_commit.url) }} |