Simplify steam and mingw jobs

This commit is contained in:
Gunter Labes 2023-06-01 13:02:26 +02:00 committed by GitHub
parent df855235b4
commit 6dc01df7c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 230 deletions

View file

@ -137,69 +137,50 @@ jobs:
run: ./run_boost_tests
steam-runtime:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
- { uses: actions/checkout@v3, with: { submodules: "recursive" } }
- name: Steam Runtime
run: |
export BRANCH=master
export IMAGE=steamrt
export NLS=false
export TOOL=scons
export CC=gcc-9
export CXX=g++-9
export CXX_STD=17
export CFG=release
export LTO=false
export CLICOLOR_FORCE=1
./.github/workflows/ci-scripts/ubuntu.sh
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: |
~/steambuild-*.tar
path: utils/dockerbuilds/steambuild-*.tar
mingw:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
- { uses: actions/checkout@v3, with: { submodules: "recursive" } }
- name: MinGW Crosscompile
run: |
export BRANCH=master
export IMAGE=mingw
export NLS=false
export TOOL=scons
export CC=gcc
export CXX=g++
export CXX_STD=17
export CFG=release
export LTO=false
export CLICOLOR_FORCE=1
./.github/workflows/ci-scripts/ubuntu.sh
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"
- name: Upload 1
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
path: wesnoth-*.tar.bz2
- name: Upload 2
- name: Upload Windows-Installer
uses: actions/upload-artifact@v3
with:
name: Windows-Installer
path: |
~/wesnoth-*-win64.exe
path: utils/dockerbuilds/wesnoth-*-win64.exe
flatpak:
runs-on: ubuntu-latest

View file

@ -1,147 +0,0 @@
#!/bin/bash
echo "Using docker:"
echo "BRANCH: $BRANCH"
echo "IMAGE: $IMAGE"
echo "NLS: $NLS"
echo "TOOL: $TOOL"
echo "CC: $CC"
echo "CXX: $CXX"
echo "CXX_STD: $CXX_STD"
echo "CFG: $CFG"
echo "LTO: $LTO"
# set the fake display for unit tests
export DISPLAY=:99.0
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1024x768x24
red=$(tput setaf 1)
blue=$(tput bold; tput setaf 4)
reset=$(tput sgr0)
print() { printf '%s%s%s\n' "$blue" "$*" "$reset"; }
# print given message in red
error() { printf '%s%s%s\n' "$red" "$*" "$reset"; }
# print given message and exit
die() { error "$*"; exit 1; }
# print given message ($1) and execute given command; sets EXIT_VAL on failure
execute() {
local message=$1; shift
echo
print " -~=+=~- ${message//?/-}"
print "Executing $message"
print " -~=+=~- ${message//?/-}"
echo
if "$@"; then
: # success
else
EXIT_VAL=$?
error '********** !FAILURE! **********'
error '********** !FAILURE! **********'
error '********** !FAILURE! **********'
error '********** !FAILURE! **********'
error '********** !FAILURE! **********'
echo
error "$message failed! ($*)"
echo
fi
}
# in order:
# check for proper indentation of WML
# check for trailing whitespace in hpp|cpp files
# check for trailing whitespace in lua files
checkindent() {
./utils/CI/fix_whitespace.sh
git status
(( $(git status --short | wc -l) == 0 ))
}
EXIT_VAL=-1
if [ "$NLS" == "only" ]; then
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
./utils/CI/check_utf8.sh || exit 1
./utils/CI/utf8_bom_dog.sh || exit 1
echo "Checked for invalid characters"
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 || exit 1
echo "Ran cmake pdate-po4a-man"
make update-po4a-manual || exit 1
echo "Ran make update-po4a-manual"
make pot-update || exit 1
echo "Ran make pot-update"
make mo-update || exit 1
echo "Ran make mo-update"
make clean
scons translations build=release --debug=time nls=true jobs=2 || exit 1
echo "Ran scons translations"
scons pot-update || exit 1
echo "Ran scons pot-update"
scons update-po4a || exit 1
echo "Ran scons update-po4a"
scons manual || exit 1
exit 0
elif [ "$IMAGE" == "flatpak" ]; then
# docker's --volume means the directory is on a separate filesystem
# flatpak-builder doesn't support this
# therefore manually move stuff between where flatpak needs it and where CI caching can see it
rm -R .flatpak-builder/*
jq '.modules[2].sources[0]={"type":"dir","path":"/home/wesnoth-CI"} | ."build-options".env.FLATPAK_BUILDER_N_JOBS="2"' packaging/flatpak/org.wesnoth.Wesnoth.json > utils/dockerbuilds/CI/org.wesnoth.Wesnoth.json
flatpak-builder --force-clean --disable-rofiles-fuse wesnoth-app utils/dockerbuilds/CI/org.wesnoth.Wesnoth.json
EXIT_VAL=$?
exit $EXIT_VAL
else
if [ "$TOOL" == "cmake" ]; then
cmake -DCMAKE_BUILD_TYPE="$CFG" -DENABLE_GAME=true -DENABLE_SERVER=true -DENABLE_CAMPAIGN_SERVER=true -DENABLE_TESTS=true -DENABLE_NLS="$NLS" \
-DEXTRA_FLAGS_CONFIG="-pipe" -DENABLE_STRICT_COMPILATION=true -DENABLE_LTO="$LTO" -DLTO_JOBS=2 -DENABLE_MYSQL=true \
-DFORCE_COLOR_OUTPUT=true -DCXX_STD="$CXX_STD" . || exit 1
make conftests || exit 1
make VERBOSE=1 -j2
EXIT_VAL=$?
else
scons wesnoth wesnothd campaignd boost_unit_tests build="$CFG" \
ctool="$CC" cxxtool="$CXX" cxx_std="$CXX_STD" \
extra_flags_config="-pipe" strict=true forum_user_handler=true \
nls="$NLS" enable_lto="$LTO" force_color=true jobs=2 --debug=time
EXIT_VAL=$?
fi
fi
if [ $EXIT_VAL != 0 ]; then
exit $EXIT_VAL
fi
# rename debug executables to what the tests expect
if [ "$CFG" == "debug" ]; then
mv wesnoth-debug wesnoth
mv wesnothd-debug wesnothd
mv campaignd-debug campaignd
mv boost_unit_tests-debug boost_unit_tests
fi
execute "WML validation" ./utils/CI/schema_validation.sh
execute "Luacheck linting" luacheck .
execute "Whitespace and WML indentation check" checkindent
execute "Doxygen check" ./utils/CI/doxygen-check.sh
execute "WML tests" ./run_wml_tests -g -c -t 20
execute "Play tests" ./utils/CI/play_test_executor.sh
execute "MP tests" ./utils/CI/mp_test_executor.sh
execute "Boost unit tests" ./utils/CI/test_executor.sh
if [ -f "errors.log" ]; then
echo
error '***'
error '*'
error '* Errors reported in wml unit tests, here is errors.log...'
error '*'
error '***'
cat errors.log
fi
exit $EXIT_VAL

View file

@ -1,45 +0,0 @@
#!/bin/bash
echo "Using linux:"
echo "BRANCH: $BRANCH"
echo "IMAGE: $IMAGE"
echo "NLS: $NLS"
echo "TOOL: $TOOL"
echo "CC: $CC"
echo "CXX: $CXX"
echo "CXX_STD: $CXX_STD"
echo "CFG: $CFG"
echo "LTO: $LTO"
version=$(grep '#define VERSION' src/wesconfig.h | cut -d\" -f2)
echo "Found version: $version"
if [ "$IMAGE" == "steamrt" ]; then
cd utils/dockerbuilds/
./make_steam_build || exit 1
tar -cf steambuild.tar steambuild
mv steambuild.tar ~/steambuild-$version.tar
elif [ "$IMAGE" == "mingw" ]; then
git archive --format=tar HEAD > wesnoth.tar
tar rf wesnoth.tar src/modules/
bzip2 -z wesnoth.tar
mv wesnoth.tar.bz2 ~/wesnoth-$version.tar.bz2
cd utils/dockerbuilds/
./make_mingw_build || exit 1
cd mingwbuild
mv ./wesnoth*-win64.exe ~/wesnoth-$version-win64.exe
else
# pull the pre-created image
docker build -t wesnoth-repo:"$IMAGE"-"$BRANCH" -f - . <<-EOF
FROM wesnoth/wesnoth:$IMAGE-$BRANCH
COPY ./ /home/wesnoth-CI/
WORKDIR /home/wesnoth-CI
EOF
[[ $NLS == only ]] || tty=1 # something in the update-po4a-manual step hangs when building the xml (po4a-translate) and --tty is used
docker run ${tty+--tty} --cap-add=ALL --privileged \
--env BRANCH --env IMAGE --env NLS --env TOOL --env CC --env CXX \
--env CXX_STD --env CFG --env LTO --env CLICOLOR_FORCE \
wesnoth-repo:"$IMAGE"-"$BRANCH" ./.github/workflows/ci-scripts/docker.sh
fi