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:
parent
2a54e9d7d1
commit
92ed53e13a
3 changed files with 36 additions and 45 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
42
.github/workflows/desktop-build.yml
vendored
42
.github/workflows/desktop-build.yml
vendored
|
@ -160,11 +160,11 @@ jobs:
|
|||
if: matrix.package != 'skip'
|
||||
shell: bash
|
||||
env:
|
||||
suffix: '-${{matrix.distro}}'
|
||||
type: '${{matrix.package}}'
|
||||
PACKAGE_SUFFIX: '-${{matrix.distro}}'
|
||||
CPACK_GENERATOR: '${{matrix.package}}'
|
||||
run: |
|
||||
source .ci/docker.sh
|
||||
RUN --server --release --package "$type" --suffix "$suffix"
|
||||
RUN --server --release --package
|
||||
|
||||
- name: Upload artifact
|
||||
if: matrix.package != 'skip'
|
||||
|
@ -312,13 +312,13 @@ jobs:
|
|||
|
||||
env:
|
||||
QT_VERSION: '5.15.2'
|
||||
QT_ARCH: msvc2019${{matrix.append}}
|
||||
CMAKE_GENERATOR: 'Visual Studio 16 2019'
|
||||
QT_ARCH: msvc2022${{matrix.append}}
|
||||
CMAKE_GENERATOR: 'Visual Studio 17 2022'
|
||||
|
||||
steps:
|
||||
- name: Add msbuild to PATH
|
||||
id: add-msbuild
|
||||
uses: microsoft/setup-msbuild@v1.0.2
|
||||
uses: microsoft/setup-msbuild@v1.1
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
@ -347,32 +347,20 @@ jobs:
|
|||
appendedCacheKey: ${{hashFiles('**/vcpkg.txt')}}
|
||||
vcpkgTriplet: ${{matrix.triplet}}-windows
|
||||
|
||||
- name: Configure Cockatrice ${{matrix.arch}}-bit
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p build
|
||||
cd build
|
||||
export QTDIR="${{runner.workspace}}/Qt/${{env.QT_VERSION}}/${{env.QT_ARCH}}"
|
||||
cmake .. -G "${{env.CMAKE_GENERATOR}}" -A "${{matrix.cmake}}" -DCMAKE_BUILD_TYPE="Release" -DWITH_SERVER=1 -DTEST=1
|
||||
|
||||
- name: Build Cockatrice ${{matrix.arch}}-bit
|
||||
id: package
|
||||
id: build
|
||||
shell: bash
|
||||
working-directory: build
|
||||
run: |
|
||||
cmake --build . --target package --config Release
|
||||
../.ci/name_build.sh "-win${{matrix.arch}}"
|
||||
|
||||
- name: Run tests
|
||||
shell: bash
|
||||
working-directory: build
|
||||
run: ctest -T Test -C Release
|
||||
env:
|
||||
PACKAGE_SUFFIX: '-win${{matrix.arch}}'
|
||||
CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}'
|
||||
CMAKE_GENERATOR_PLATFORM: '${{matrix.cmake}}'
|
||||
run: ./.ci/compile.sh --server --release --test --package
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Windows-${{matrix.arch}}bit-installer
|
||||
path: ./build/${{steps.package.outputs.name}}
|
||||
path: ./build/${{steps.build.outputs.name}}
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload to release
|
||||
|
@ -382,6 +370,6 @@ jobs:
|
|||
GITHUB_TOKEN: ${{github.token}}
|
||||
with:
|
||||
upload_url: ${{needs.configure.outputs.upload_url}}
|
||||
asset_path: ./build/${{steps.package.outputs.name}}
|
||||
asset_name: ${{steps.package.outputs.name}}
|
||||
asset_path: ./build/${{steps.build.outputs.name}}
|
||||
asset_name: ${{steps.build.outputs.name}}
|
||||
asset_content_type: application/octet-stream
|
||||
|
|
Loading…
Reference in a new issue