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
|
#!/bin/bash
|
||||||
|
|
||||||
# This script is to be used by the ci environment from the project root directory, do not use it from somewhere else.
|
# 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
|
# Read arguments
|
||||||
while [[ "$@" ]]; do
|
while [[ $# != 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
'--')
|
'--')
|
||||||
shift
|
shift
|
||||||
|
@ -67,7 +68,7 @@ done
|
||||||
# Check formatting using clang-format
|
# Check formatting using clang-format
|
||||||
if [[ $CHECK_FORMAT ]]; then
|
if [[ $CHECK_FORMAT ]]; then
|
||||||
echo "::group::Run linter"
|
echo "::group::Run linter"
|
||||||
source ./.ci/lint.sh
|
source "$LINT_SCRIPT"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -83,17 +84,19 @@ if [[ ! $CMAKE_BUILD_PARALLEL_LEVEL ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add cmake flags
|
# Add cmake flags
|
||||||
|
flags=()
|
||||||
if [[ $MAKE_SERVER ]]; then
|
if [[ $MAKE_SERVER ]]; then
|
||||||
flags+=" -DWITH_SERVER=1"
|
flags+=("-DWITH_SERVER=1")
|
||||||
fi
|
fi
|
||||||
if [[ $MAKE_TEST ]]; then
|
if [[ $MAKE_TEST ]]; then
|
||||||
flags+=" -DTEST=1"
|
flags+=("-DTEST=1")
|
||||||
fi
|
fi
|
||||||
if [[ $BUILDTYPE ]]; then
|
if [[ ! $BUILDTYPE ]]; then
|
||||||
flags+=" -DCMAKE_BUILD_TYPE=$BUILDTYPE"
|
BUILDTYPE=Release
|
||||||
fi
|
fi
|
||||||
|
flags+=("-DCMAKE_BUILD_TYPE=$BUILDTYPE")
|
||||||
if [[ $PACKAGE_TYPE ]]; then
|
if [[ $PACKAGE_TYPE ]]; then
|
||||||
flags+=" -DCPACK_GENERATOR=$PACKAGE_TYPE"
|
flags+=("-DCPACK_GENERATOR=$PACKAGE_TYPE")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(uname) == "Darwin" ]]; then
|
if [[ $(uname) == "Darwin" ]]; then
|
||||||
|
@ -102,7 +105,7 @@ if [[ $(uname) == "Darwin" ]]; then
|
||||||
PATH="/usr/local/opt/ccache/libexec:$PATH"
|
PATH="/usr/local/opt/ccache/libexec:$PATH"
|
||||||
fi
|
fi
|
||||||
# Add qt install location when using homebrew
|
# Add qt install location when using homebrew
|
||||||
flags+=" -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5/"
|
flags+=("-DCMAKE_PREFIX_PATH=/usr/local/opt/qt5/")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Compile
|
# Compile
|
||||||
|
@ -114,11 +117,11 @@ fi
|
||||||
|
|
||||||
echo "::group::Configure cmake"
|
echo "::group::Configure cmake"
|
||||||
cmake --version
|
cmake --version
|
||||||
cmake .. $flags
|
cmake .. "${flags[@]}"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "::group::Build project"
|
echo "::group::Build project"
|
||||||
cmake --build .
|
cmake --build . --config "$BUILDTYPE"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
if [[ $USE_CCACHE ]]; then
|
if [[ $USE_CCACHE ]]; then
|
||||||
|
@ -129,19 +132,19 @@ fi
|
||||||
|
|
||||||
if [[ $MAKE_TEST ]]; then
|
if [[ $MAKE_TEST ]]; then
|
||||||
echo "::group::Run tests"
|
echo "::group::Run tests"
|
||||||
cmake --build . --target test
|
ctest -C "$BUILDTYPE"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $MAKE_INSTALL ]]; then
|
if [[ $MAKE_INSTALL ]]; then
|
||||||
echo "::group::Install"
|
echo "::group::Install"
|
||||||
cmake --build . --target install
|
cmake --build . --target install --config "$BUILDTYPE"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $MAKE_PACKAGE ]]; then
|
if [[ $MAKE_PACKAGE ]]; then
|
||||||
echo "::group::Create package"
|
echo "::group::Create package"
|
||||||
cmake --build . --target package
|
cmake --build . --target package --config "$BUILDTYPE"
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
if [[ $PACKAGE_SUFFIX ]]; then
|
if [[ $PACKAGE_SUFFIX ]]; then
|
||||||
|
|
|
@ -18,7 +18,7 @@ image_cache="image"
|
||||||
ccache_cache=".ccache"
|
ccache_cache=".ccache"
|
||||||
|
|
||||||
# Read arguments
|
# Read arguments
|
||||||
while [[ "$@" ]]; do
|
while [[ $# != 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
'--build')
|
'--build')
|
||||||
BUILD=1
|
BUILD=1
|
||||||
|
@ -70,7 +70,7 @@ if ! [[ $CACHE ]]; then
|
||||||
else
|
else
|
||||||
if ! [[ -d $CACHE ]]; then
|
if ! [[ -d $CACHE ]]; then
|
||||||
echo "could not find cache dir: $CACHE" >&2
|
echo "could not find cache dir: $CACHE" >&2
|
||||||
mkdir -p $CACHE
|
mkdir -p "$CACHE"
|
||||||
unset GET # the dir is empty
|
unset GET # the dir is empty
|
||||||
fi
|
fi
|
||||||
if [[ $GET || $SAVE ]]; then
|
if [[ $GET || $SAVE ]]; then
|
||||||
|
@ -133,11 +133,11 @@ function RUN ()
|
||||||
{
|
{
|
||||||
echo "running image:"
|
echo "running image:"
|
||||||
if docker images | grep "$IMAGE_NAME"; then
|
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
|
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
|
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 $?
|
return $?
|
||||||
else
|
else
|
||||||
echo "could not find docker image: $IMAGE_NAME" >&2
|
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'
|
if: matrix.package != 'skip'
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
suffix: '-${{matrix.distro}}'
|
PACKAGE_SUFFIX: '-${{matrix.distro}}'
|
||||||
type: '${{matrix.package}}'
|
CPACK_GENERATOR: '${{matrix.package}}'
|
||||||
run: |
|
run: |
|
||||||
source .ci/docker.sh
|
source .ci/docker.sh
|
||||||
RUN --server --release --package "$type" --suffix "$suffix"
|
RUN --server --release --package
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
if: matrix.package != 'skip'
|
if: matrix.package != 'skip'
|
||||||
|
@ -312,13 +312,13 @@ jobs:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
QT_VERSION: '5.15.2'
|
QT_VERSION: '5.15.2'
|
||||||
QT_ARCH: msvc2019${{matrix.append}}
|
QT_ARCH: msvc2022${{matrix.append}}
|
||||||
CMAKE_GENERATOR: 'Visual Studio 16 2019'
|
CMAKE_GENERATOR: 'Visual Studio 17 2022'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Add msbuild to PATH
|
- name: Add msbuild to PATH
|
||||||
id: add-msbuild
|
id: add-msbuild
|
||||||
uses: microsoft/setup-msbuild@v1.0.2
|
uses: microsoft/setup-msbuild@v1.1
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -347,32 +347,20 @@ jobs:
|
||||||
appendedCacheKey: ${{hashFiles('**/vcpkg.txt')}}
|
appendedCacheKey: ${{hashFiles('**/vcpkg.txt')}}
|
||||||
vcpkgTriplet: ${{matrix.triplet}}-windows
|
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
|
- name: Build Cockatrice ${{matrix.arch}}-bit
|
||||||
id: package
|
id: build
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: build
|
env:
|
||||||
run: |
|
PACKAGE_SUFFIX: '-win${{matrix.arch}}'
|
||||||
cmake --build . --target package --config Release
|
CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}'
|
||||||
../.ci/name_build.sh "-win${{matrix.arch}}"
|
CMAKE_GENERATOR_PLATFORM: '${{matrix.cmake}}'
|
||||||
|
run: ./.ci/compile.sh --server --release --test --package
|
||||||
- name: Run tests
|
|
||||||
shell: bash
|
|
||||||
working-directory: build
|
|
||||||
run: ctest -T Test -C Release
|
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Windows-${{matrix.arch}}bit-installer
|
name: Windows-${{matrix.arch}}bit-installer
|
||||||
path: ./build/${{steps.package.outputs.name}}
|
path: ./build/${{steps.build.outputs.name}}
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload to release
|
- name: Upload to release
|
||||||
|
@ -382,6 +370,6 @@ jobs:
|
||||||
GITHUB_TOKEN: ${{github.token}}
|
GITHUB_TOKEN: ${{github.token}}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{needs.configure.outputs.upload_url}}
|
upload_url: ${{needs.configure.outputs.upload_url}}
|
||||||
asset_path: ./build/${{steps.package.outputs.name}}
|
asset_path: ./build/${{steps.build.outputs.name}}
|
||||||
asset_name: ${{steps.package.outputs.name}}
|
asset_name: ${{steps.build.outputs.name}}
|
||||||
asset_content_type: application/octet-stream
|
asset_content_type: application/octet-stream
|
||||||
|
|
Loading…
Reference in a new issue