update workflow to use windows 2022 image (#4580)

* update workflow to use windows 2022 image

* return the version of the run vcpkg action

the action has been changed to now use a vcpkg.json file instead of the
txt file we use now, we should try to find a way to update it to the new
workflow in case the current one becomes obsolete

* clean up a bit for consistency

* run ctest directly instead of relying on the makefile

* set -C flag for ctest

* set config option for cmake --build

this option is ignored for other platforms
This commit is contained in:
ebbit1q 2022-02-27 22:32:54 +01:00 committed by GitHub
parent 2a54e9d7d1
commit 92ed53e13a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 45 deletions

View file

@ -1,9 +1,10 @@
#!/bin/bash
# This script is to be used by the ci environment from the project root directory, do not use it from somewhere else.
LINT_SCRIPT=".ci/lint_cpp.sh"
# Read arguments
while [[ "$@" ]]; do
while [[ $# != 0 ]]; do
case "$1" in
'--')
shift
@ -67,7 +68,7 @@ done
# Check formatting using clang-format
if [[ $CHECK_FORMAT ]]; then
echo "::group::Run linter"
source ./.ci/lint.sh
source "$LINT_SCRIPT"
echo "::endgroup::"
fi
@ -83,17 +84,19 @@ if [[ ! $CMAKE_BUILD_PARALLEL_LEVEL ]]; then
fi
# Add cmake flags
flags=()
if [[ $MAKE_SERVER ]]; then
flags+=" -DWITH_SERVER=1"
flags+=("-DWITH_SERVER=1")
fi
if [[ $MAKE_TEST ]]; then
flags+=" -DTEST=1"
flags+=("-DTEST=1")
fi
if [[ $BUILDTYPE ]]; then
flags+=" -DCMAKE_BUILD_TYPE=$BUILDTYPE"
if [[ ! $BUILDTYPE ]]; then
BUILDTYPE=Release
fi
flags+=("-DCMAKE_BUILD_TYPE=$BUILDTYPE")
if [[ $PACKAGE_TYPE ]]; then
flags+=" -DCPACK_GENERATOR=$PACKAGE_TYPE"
flags+=("-DCPACK_GENERATOR=$PACKAGE_TYPE")
fi
if [[ $(uname) == "Darwin" ]]; then
@ -102,7 +105,7 @@ if [[ $(uname) == "Darwin" ]]; then
PATH="/usr/local/opt/ccache/libexec:$PATH"
fi
# Add qt install location when using homebrew
flags+=" -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5/"
flags+=("-DCMAKE_PREFIX_PATH=/usr/local/opt/qt5/")
fi
# Compile
@ -114,11 +117,11 @@ fi
echo "::group::Configure cmake"
cmake --version
cmake .. $flags
cmake .. "${flags[@]}"
echo "::endgroup::"
echo "::group::Build project"
cmake --build .
cmake --build . --config "$BUILDTYPE"
echo "::endgroup::"
if [[ $USE_CCACHE ]]; then
@ -129,19 +132,19 @@ fi
if [[ $MAKE_TEST ]]; then
echo "::group::Run tests"
cmake --build . --target test
ctest -C "$BUILDTYPE"
echo "::endgroup::"
fi
if [[ $MAKE_INSTALL ]]; then
echo "::group::Install"
cmake --build . --target install
cmake --build . --target install --config "$BUILDTYPE"
echo "::endgroup::"
fi
if [[ $MAKE_PACKAGE ]]; then
echo "::group::Create package"
cmake --build . --target package
cmake --build . --target package --config "$BUILDTYPE"
echo "::endgroup::"
if [[ $PACKAGE_SUFFIX ]]; then

View file

@ -18,7 +18,7 @@ image_cache="image"
ccache_cache=".ccache"
# Read arguments
while [[ "$@" ]]; do
while [[ $# != 0 ]]; do
case "$1" in
'--build')
BUILD=1
@ -70,7 +70,7 @@ if ! [[ $CACHE ]]; then
else
if ! [[ -d $CACHE ]]; then
echo "could not find cache dir: $CACHE" >&2
mkdir -p $CACHE
mkdir -p "$CACHE"
unset GET # the dir is empty
fi
if [[ $GET || $SAVE ]]; then
@ -133,11 +133,11 @@ function RUN ()
{
echo "running image:"
if docker images | grep "$IMAGE_NAME"; then
args="--mount type=bind,source=$PWD,target=/src -w=/src"
args=(--mount "type=bind,source=$PWD,target=/src" -w="/src")
if [[ $CCACHE_DIR ]]; then
args+=" --mount type=bind,source=$CCACHE_DIR,target=/.ccache -e CCACHE_DIR=/.ccache"
args+=(--mount "type=bind,source=$CCACHE_DIR,target=/.ccache" -e "CCACHE_DIR=/.ccache")
fi
docker run $args $RUN_ARGS "$IMAGE_NAME" bash "$BUILD_SCRIPT" $RUN_OPTS $@
docker run "${args[@]}" $RUN_ARGS "$IMAGE_NAME" bash "$BUILD_SCRIPT" $RUN_OPTS "$@"
return $?
else
echo "could not find docker image: $IMAGE_NAME" >&2