mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-13 01:24:46 -07:00
merge build workflows (#4197)
* merge build workflows * fix mac version comparisons
This commit is contained in:
parent
1ddc9cc929
commit
b63145c0a1
9 changed files with 549 additions and 649 deletions
|
|
@ -5,6 +5,9 @@
|
||||||
# Read arguments
|
# Read arguments
|
||||||
while [[ "$@" ]]; do
|
while [[ "$@" ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
'--')
|
||||||
|
shift
|
||||||
|
;;
|
||||||
'--format')
|
'--format')
|
||||||
CHECK_FORMAT=1
|
CHECK_FORMAT=1
|
||||||
shift
|
shift
|
||||||
|
|
@ -17,14 +20,19 @@ while [[ "$@" ]]; do
|
||||||
MAKE_PACKAGE=1
|
MAKE_PACKAGE=1
|
||||||
shift
|
shift
|
||||||
if [[ $# != 0 && $1 != -* ]]; then
|
if [[ $# != 0 && $1 != -* ]]; then
|
||||||
PACKAGE_NAME="$1"
|
PACKAGE_TYPE="$1"
|
||||||
shift
|
shift
|
||||||
if [[ $# != 0 && $1 != -* ]]; then
|
|
||||||
PACKAGE_TYPE="$1"
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
'--suffix')
|
||||||
|
shift
|
||||||
|
if [[ $# == 0 ]]; then
|
||||||
|
echo "::error file=$0::--suffix expects an argument"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
PACKAGE_SUFFIX="$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
'--server')
|
'--server')
|
||||||
MAKE_SERVER=1
|
MAKE_SERVER=1
|
||||||
shift
|
shift
|
||||||
|
|
@ -41,13 +49,9 @@ while [[ "$@" ]]; do
|
||||||
BUILDTYPE="Release"
|
BUILDTYPE="Release"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
'--zip')
|
|
||||||
MAKE_ZIP=1
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
if [[ $1 == -* ]]; then
|
if [[ $1 == -* ]]; then
|
||||||
echo "unrecognized option: $1"
|
echo "::error file=$0::unrecognized option: $1"
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
BUILDTYPE="$1"
|
BUILDTYPE="$1"
|
||||||
|
|
@ -58,7 +62,9 @@ done
|
||||||
|
|
||||||
# Check formatting using clang-format
|
# Check formatting using clang-format
|
||||||
if [[ $CHECK_FORMAT ]]; then
|
if [[ $CHECK_FORMAT ]]; then
|
||||||
|
echo "::group::Run linter"
|
||||||
source ./.ci/lint.sh
|
source ./.ci/lint.sh
|
||||||
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
@ -68,8 +74,8 @@ set -e
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
|
|
||||||
if ! [[ $CORE_AMOUNT ]]; then
|
if [[ ! $CMAKE_BUILD_PARALLEL_LEVEL ]]; then
|
||||||
CORE_AMOUNT="2" # default machines have 2 cores
|
CMAKE_BUILD_PARALLEL_LEVEL=2 # default machines have 2 cores
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add cmake flags
|
# Add cmake flags
|
||||||
|
|
@ -78,7 +84,6 @@ if [[ $MAKE_SERVER ]]; then
|
||||||
fi
|
fi
|
||||||
if [[ $MAKE_TEST ]]; then
|
if [[ $MAKE_TEST ]]; then
|
||||||
flags+=" -DTEST=1"
|
flags+=" -DTEST=1"
|
||||||
BUILDTYPE="Debug" # test requires buildtype Debug
|
|
||||||
fi
|
fi
|
||||||
if [[ $BUILDTYPE ]]; then
|
if [[ $BUILDTYPE ]]; then
|
||||||
flags+=" -DCMAKE_BUILD_TYPE=$BUILDTYPE"
|
flags+=" -DCMAKE_BUILD_TYPE=$BUILDTYPE"
|
||||||
|
|
@ -87,42 +92,51 @@ if [[ $PACKAGE_TYPE ]]; then
|
||||||
flags+=" -DCPACK_GENERATOR=$PACKAGE_TYPE"
|
flags+=" -DCPACK_GENERATOR=$PACKAGE_TYPE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add qt install location when using brew
|
|
||||||
if [[ $(uname) == "Darwin" ]]; then
|
if [[ $(uname) == "Darwin" ]]; then
|
||||||
PATH="/usr/local/opt/ccache/bin:$PATH"
|
# prepend ccache compiler binaries to path
|
||||||
|
PATH="/usr/local/opt/ccache/libexec:$PATH"
|
||||||
|
# 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
|
||||||
|
echo "::group::Show ccache stats"
|
||||||
|
ccache --show-stats
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
echo "::group::Configure cmake"
|
||||||
cmake --version
|
cmake --version
|
||||||
cmake .. $flags
|
cmake .. $flags
|
||||||
make -j"$CORE_AMOUNT"
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
echo "::group::Build project"
|
||||||
|
cmake --build .
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
echo "::group::Show ccache stats again"
|
||||||
|
ccache --show-stats
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
if [[ $MAKE_TEST ]]; then
|
if [[ $MAKE_TEST ]]; then
|
||||||
make test
|
echo "::group::Run tests"
|
||||||
|
cmake --build . --target test
|
||||||
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $MAKE_INSTALL ]]; then
|
if [[ $MAKE_INSTALL ]]; then
|
||||||
make install
|
echo "::group::Install"
|
||||||
|
cmake --build . --target install
|
||||||
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $MAKE_PACKAGE ]]; then
|
if [[ $MAKE_PACKAGE ]]; then
|
||||||
make package
|
echo "::group::Create package"
|
||||||
if [[ $PACKAGE_NAME ]]; then
|
cmake --build . --target package
|
||||||
found="$(find . -maxdepth 1 -type f -name "Cockatrice-*.*" -print -quit)"
|
echo "::endgroup::"
|
||||||
path="${found%/*}"
|
|
||||||
file="${found##*/}"
|
if [[ $PACKAGE_SUFFIX ]]; then
|
||||||
if [[ ! $file ]]; then
|
echo "::group::Update package name"
|
||||||
echo "could not find package" >&2
|
../.ci/name_build.sh "$PACKAGE_SUFFIX"
|
||||||
exit 1
|
echo "::endgroup::"
|
||||||
fi
|
|
||||||
new_name="$path/${file%.*}-$PACKAGE_NAME."
|
|
||||||
if [[ $MAKE_ZIP ]]; then
|
|
||||||
zip "${new_name}zip" "$path/$file"
|
|
||||||
mv "$path/$file" "$path/_$file"
|
|
||||||
else
|
|
||||||
extension="${file##*.}"
|
|
||||||
mv "$path/$file" "$new_name$extension"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ if ! [[ $NAME ]]; then
|
||||||
return 3
|
return 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export IMAGE_NAME="${project_name,,}_${NAME,,}"
|
export IMAGE_NAME="${project_name,,}_${NAME,,}" # lower case
|
||||||
|
|
||||||
docker_dir=".ci/$NAME"
|
docker_dir=".ci/$NAME"
|
||||||
if ! [[ -r $docker_dir/Dockerfile ]]; then
|
if ! [[ -r $docker_dir/Dockerfile ]]; then
|
||||||
|
|
@ -133,7 +133,7 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# this script is to be used by the ci to fetch the github upload url
|
|
||||||
# using curl and jq
|
|
||||||
[[ $ref ]] || missing+=" ref"
|
|
||||||
[[ $repo ]] || missing+=" repo"
|
|
||||||
if [[ $missing ]]; then
|
|
||||||
echo "missing env:$missing" >&2
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
tag="${ref##*/}"
|
|
||||||
api_url="https://api.github.com/repos/$repo/releases/tags/$tag"
|
|
||||||
upload_url="$(curl "$api_url" | jq -r '.upload_url')"
|
|
||||||
if [[ $upload_url && $upload_url != null ]]; then
|
|
||||||
echo "$upload_url"
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "failed to fetch upload url from $api_url" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
50
.ci/name_build.sh
Executable file
50
.ci/name_build.sh
Executable file
|
|
@ -0,0 +1,50 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# used by the ci to rename build artifacts
|
||||||
|
# renames the file to [original name][SUFFIX].[original extension]
|
||||||
|
# where SUFFIX is either available in the environment or as the first arg
|
||||||
|
# if MAKE_ZIP is set instead a zip is made
|
||||||
|
# expected to be run in the build directory
|
||||||
|
builddir="."
|
||||||
|
findrx="Cockatrice-*.*"
|
||||||
|
|
||||||
|
if [[ $1 ]]; then
|
||||||
|
SUFFIX="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check env
|
||||||
|
if [[ ! $SUFFIX ]]; then
|
||||||
|
echo "::error file=$0::SUFFIX is missing"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# find file
|
||||||
|
found="$(find "$builddir" -maxdepth 1 -type f -name "$findrx" -print -quit)"
|
||||||
|
path="${found%/*}" # remove all after last /
|
||||||
|
file="${found##*/}" # remove all before last /
|
||||||
|
if [[ ! $file ]]; then
|
||||||
|
echo "::error file=$0::could not find package"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ! cd "$path"; then
|
||||||
|
echo "::error file=$0::could not get file path"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set filename
|
||||||
|
name="${file%.*}" # remove all after last .
|
||||||
|
new_name="$name$SUFFIX."
|
||||||
|
if [[ $MAKE_ZIP ]]; then
|
||||||
|
filename="${new_name}zip"
|
||||||
|
echo "creating zip '$filename' from '$file'"
|
||||||
|
zip "$filename" "$file"
|
||||||
|
else
|
||||||
|
extension="${file##*.}" # remove all before last .
|
||||||
|
filename="$new_name$extension"
|
||||||
|
echo "renaming '$file' to '$filename'"
|
||||||
|
mv "$file" "$filename"
|
||||||
|
fi
|
||||||
|
ls -l "$PWD/$filename"
|
||||||
|
echo "::set-output name=path::$PWD/$filename"
|
||||||
|
echo "::set-output name=name::$filename"
|
||||||
424
.github/workflows/ci-builds.yml
vendored
Normal file
424
.github/workflows/ci-builds.yml
vendored
Normal file
|
|
@ -0,0 +1,424 @@
|
||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
configure:
|
||||||
|
name: Configure
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
name: ${{steps.configure.outputs.name}}
|
||||||
|
tag: ${{steps.configure.outputs.tag}}
|
||||||
|
release_url: ${{steps.create_release.outputs.upload_url}}
|
||||||
|
is_beta: ${{steps.configure.outputs.is_beta}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Cancel previous runs
|
||||||
|
uses: styfle/cancel-workflow-action@0.6.0
|
||||||
|
with:
|
||||||
|
access_token: ${{github.token}} # needs other token https://github.com/styfle/cancel-workflow-action/issues/7
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
id: configure
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
tag_regex='^refs/tags/'
|
||||||
|
beta_regex='beta'
|
||||||
|
if [[ $GITHUB_EVENT_NAME == pull-request ]]; then # pull request
|
||||||
|
name="${{github.event.pull_request.head.sha}}"
|
||||||
|
elif [[ $GITHUB_REF =~ $tag_regex ]]; then # release
|
||||||
|
tag="${GITHUB_REF/refs\/tags\//}"
|
||||||
|
name="$tag-$GITHUB_SHA"
|
||||||
|
echo "::set-output name=tag::$tag"
|
||||||
|
if [[ $tag =~ beta_regex ]]; then
|
||||||
|
echo "::set-output name=is_beta::yes"
|
||||||
|
else
|
||||||
|
echo "::set-output name=is_beta::no"
|
||||||
|
fi
|
||||||
|
else # push to branch
|
||||||
|
name="$GITHUB_SHA"
|
||||||
|
fi
|
||||||
|
echo "::set-output name=name::$name"
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
if: steps.configure.outputs.tag != null
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Create release title
|
||||||
|
id: title
|
||||||
|
if: steps.configure.outputs.tag != null
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
name_regex='set\(GIT_TAG_RELEASENAME "([[:print:]]+)")'
|
||||||
|
if [[ $(cat CMakeLists.txt) =~ $name_regex ]]; then
|
||||||
|
name="${BASH_REMATCH[1]}"
|
||||||
|
title="Cockatrice ${{steps.configure.name}}: $name"
|
||||||
|
echo "::set-output name=name::$name"
|
||||||
|
echo "::set-output name=title::$title"
|
||||||
|
else
|
||||||
|
echo "::error::could not find releasename in CMakeLists.txt"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
if: steps.configure.outputs.tag != null
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{github.token}}
|
||||||
|
with:
|
||||||
|
tag_name: ${{github.ref}}
|
||||||
|
release_name: ${{steps.title.outputs.title}}
|
||||||
|
draft: true
|
||||||
|
prerelease: ${{steps.configure.is_beta == 'yes'}}
|
||||||
|
|
||||||
|
build-linux:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
distro: # these names correspond to the files in .ci/$distro
|
||||||
|
- UbuntuGroovy
|
||||||
|
- UbuntuFocal
|
||||||
|
- UbuntuBionic
|
||||||
|
- ArchLinux
|
||||||
|
- DebianBuster
|
||||||
|
- Fedora33
|
||||||
|
include:
|
||||||
|
- distro: UbuntuGroovy
|
||||||
|
package: DEB
|
||||||
|
|
||||||
|
- distro: UbuntuFocal
|
||||||
|
package: DEB
|
||||||
|
test: skip # UbuntuFocal has a broken qt for debug builds
|
||||||
|
|
||||||
|
- distro: UbuntuBionic
|
||||||
|
package: DEB
|
||||||
|
|
||||||
|
- distro: ArchLinux
|
||||||
|
package: skip # we are packaged in arch already
|
||||||
|
allow-failure: yes
|
||||||
|
|
||||||
|
- distro: DebianBuster
|
||||||
|
package: DEB
|
||||||
|
|
||||||
|
- distro: Fedora33
|
||||||
|
package: RPM
|
||||||
|
test: skip # Fedora is our slowest build
|
||||||
|
|
||||||
|
name: ${{matrix.distro}}
|
||||||
|
|
||||||
|
needs: configure
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
continue-on-error: ${{matrix.allow-failure == 'yes'}}
|
||||||
|
|
||||||
|
env:
|
||||||
|
NAME: ${{matrix.distro}}
|
||||||
|
CACHE: /tmp/${{matrix.distro}}-cache # ${{runner.temp}} does not work?
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Get cache timestamp
|
||||||
|
id: cache_timestamp
|
||||||
|
shell: bash
|
||||||
|
run: echo "::set-output name=timestamp::$(date -u '+%Y%m%d%H%M%S')"
|
||||||
|
|
||||||
|
- name: Restore cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
env:
|
||||||
|
timestamp: ${{steps.cache_timestamp.outputs.timestamp}}
|
||||||
|
with:
|
||||||
|
path: ${{env.CACHE}}
|
||||||
|
key: docker-${{matrix.distro}}-cache-${{env.timestamp}}
|
||||||
|
restore-keys: |
|
||||||
|
docker-${{matrix.distro}}-cache-
|
||||||
|
|
||||||
|
- name: Build ${{matrix.distro}} Docker image
|
||||||
|
shell: bash
|
||||||
|
run: source .ci/docker.sh --build
|
||||||
|
|
||||||
|
- name: Build debug and test
|
||||||
|
if: matrix.test != 'skip'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
source .ci/docker.sh
|
||||||
|
RUN --server --debug --test
|
||||||
|
|
||||||
|
- name: Build release package
|
||||||
|
id: package
|
||||||
|
if: matrix.package != 'skip'
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
suffix: '-${{matrix.distro}}'
|
||||||
|
type: '${{matrix.package}}'
|
||||||
|
run: |
|
||||||
|
source .ci/docker.sh
|
||||||
|
RUN --server --release --package "$type" --suffix "$suffix"
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
if: matrix.package != 'skip'
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: ${{matrix.distro}}-package
|
||||||
|
path: ./build/${{steps.package.outputs.name}}
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Upload to release
|
||||||
|
if: matrix.package != 'skip' && needs.configure.outputs.tag != null
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
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_content_type: application/octet-stream
|
||||||
|
|
||||||
|
build-macos:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- Debug
|
||||||
|
- 10.11_El_Capitan
|
||||||
|
- 10.14_Mojave
|
||||||
|
- 10.15_Catalina
|
||||||
|
- 11.0_Big_Sur
|
||||||
|
include:
|
||||||
|
- target: Debug # tests only
|
||||||
|
os: macos-latest
|
||||||
|
xcode: 11.7
|
||||||
|
type: Debug
|
||||||
|
do_tests: 0 # tests do not work yet on mac
|
||||||
|
make_package: false
|
||||||
|
|
||||||
|
- target: 10.11_El_Capitan
|
||||||
|
os: macos-10.13 # runs on HighSierra
|
||||||
|
allow-failure: yes # we don't know if it'll be added
|
||||||
|
xcode: 8.2.1 # should be compatible with macos 10.11.5
|
||||||
|
type: Release
|
||||||
|
do_tests: 0
|
||||||
|
make_package: true
|
||||||
|
|
||||||
|
- target: 10.14_Mojave
|
||||||
|
os: macos-10.15 # runs on Catalina
|
||||||
|
xcode: 10.3 # should be compatible with macos 10.14.3
|
||||||
|
type: Release
|
||||||
|
do_tests: 0
|
||||||
|
make_package: true
|
||||||
|
|
||||||
|
- target: 10.15_Catalina
|
||||||
|
os: macos-10.15
|
||||||
|
xcode: 11.7
|
||||||
|
type: Release
|
||||||
|
do_tests: 0
|
||||||
|
make_package: true
|
||||||
|
|
||||||
|
- target: 11.0_Big_Sur
|
||||||
|
os: macos-11.0
|
||||||
|
xcode: 12.2
|
||||||
|
type: Release
|
||||||
|
do_tests: 0
|
||||||
|
make_package: true
|
||||||
|
|
||||||
|
name: macOS ${{matrix.target}}
|
||||||
|
|
||||||
|
needs: configure
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
continue-on-error: ${{matrix.allow-failure == 'yes'}}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CCACHE_DIR: ~/.ccache
|
||||||
|
DEVELOPER_DIR:
|
||||||
|
/Applications/Xcode_${{matrix.xcode}}.app/Contents/Developer
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install dependencies using homebrew
|
||||||
|
shell: bash
|
||||||
|
# cmake cannot find the mysql connector
|
||||||
|
# neither of these works: mariadb-connector-c mysql-connector-c++
|
||||||
|
run: brew install ccache protobuf
|
||||||
|
|
||||||
|
- name: Install QT using homebrew
|
||||||
|
id: brew_install_qt
|
||||||
|
continue-on-error: true
|
||||||
|
shell: bash
|
||||||
|
run: brew install qt --force-bottle
|
||||||
|
|
||||||
|
- name: Install QT using actions
|
||||||
|
if: steps.brew_install_qt.outcome != 'success'
|
||||||
|
uses: jurplel/install-qt-action@v2
|
||||||
|
|
||||||
|
- name: Get ccache timestamp
|
||||||
|
id: ccache_timestamp
|
||||||
|
shell: bash
|
||||||
|
run: echo "::set-output name=timestamp::$(date -u '+%Y%m%d%H%M%S')"
|
||||||
|
|
||||||
|
- name: Restore ccache cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
env:
|
||||||
|
timestamp: ${{steps.ccache_timestamp.outputs.timestamp}}
|
||||||
|
with:
|
||||||
|
path: ${{env.CCACHE_DIR}}
|
||||||
|
key: ${{runner.os}}-xcode-${{matrix.xcode}}-ccache-${{env.timestamp}}
|
||||||
|
restore-keys: |
|
||||||
|
${{runner.os}}-xcode-${{matrix.xcode}}-ccache-
|
||||||
|
|
||||||
|
- name: Build on Xcode ${{matrix.xcode}}
|
||||||
|
shell: bash
|
||||||
|
run: .ci/compile.sh ${{matrix.type}} --server
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
if: matrix.do_tests == 1
|
||||||
|
shell: bash
|
||||||
|
working-directory: build
|
||||||
|
run: cmake --build . --target test
|
||||||
|
|
||||||
|
- name: Package for ${{matrix.target}}
|
||||||
|
id: package
|
||||||
|
if: matrix.make_package
|
||||||
|
shell: bash
|
||||||
|
working-directory: build
|
||||||
|
run: |
|
||||||
|
cmake --build . --target package
|
||||||
|
../.ci/name_build.sh "-macOS-${{matrix.target}}"
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
if: matrix.make_package
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: macOS-${{matrix.target}}-xcode-${{matrix.xcode}}-dmg
|
||||||
|
path: ${{steps.package.outputs.path}}
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Upload to release
|
||||||
|
if: matrix.make_package && needs.configure.outputs.tag != null
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{github.token}}
|
||||||
|
with:
|
||||||
|
upload_url: ${{needs.configure.outputs.upload_url}}
|
||||||
|
asset_path: ${{steps.package.outputs.path}}
|
||||||
|
asset_name: ${{steps.package.outputs.name}}
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
|
||||||
|
windows-build:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
arch:
|
||||||
|
- 64
|
||||||
|
- 32
|
||||||
|
include:
|
||||||
|
- arch: 64
|
||||||
|
triplet: x64
|
||||||
|
cmake: x64
|
||||||
|
append: _64
|
||||||
|
|
||||||
|
- arch: 32
|
||||||
|
triplet: x86
|
||||||
|
cmake: Win32
|
||||||
|
|
||||||
|
name: Windows ${{matrix.arch}}
|
||||||
|
|
||||||
|
needs: configure
|
||||||
|
|
||||||
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
env:
|
||||||
|
QT_VERSION: '5.12.9'
|
||||||
|
QT_ARCH: msvc2017${{matrix.append}}
|
||||||
|
CMAKE_GENERATOR: 'Visual Studio 16 2019'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Add msbuild to PATH
|
||||||
|
id: add-msbuild
|
||||||
|
uses: microsoft/setup-msbuild@v1.0.2
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Restore Qt ${{env.QT_VERSION}} ${{matrix.arch}}-bit from cache
|
||||||
|
id: cache-qt
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
key: ${{runner.os}}-QtCache-${{env.QT_VERSION}}-${{matrix.arch}}
|
||||||
|
path: ${{runner.workspace}}/Qt
|
||||||
|
|
||||||
|
- name: Install ${{matrix.arch}}-bit Qt
|
||||||
|
uses: jurplel/install-qt-action@v2
|
||||||
|
with:
|
||||||
|
cached: ${{steps.cache-qt.outputs.cache-hit}}
|
||||||
|
version: ${{env.QT_VERSION}}
|
||||||
|
arch: win${{matrix.arch}}_${{env.QT_ARCH}}
|
||||||
|
|
||||||
|
- name: Restore or setup vcpkg
|
||||||
|
uses: lukka/run-vcpkg@v6
|
||||||
|
with:
|
||||||
|
vcpkgArguments: '@${{github.workspace}}/vcpkg.txt'
|
||||||
|
vcpkgDirectory: ${{github.workspace}}/vcpkg
|
||||||
|
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/$QT_VERSION/$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
|
||||||
|
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
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: Windows-${{matrix.arch}}bit-installer
|
||||||
|
path: ./build/${{steps.package.outputs.name}}
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Upload to release
|
||||||
|
if: needs.configure.outputs.tag != null
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
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_content_type: application/octet-stream
|
||||||
131
.github/workflows/linux-builds.yml
vendored
131
.github/workflows/linux-builds.yml
vendored
|
|
@ -1,131 +0,0 @@
|
||||||
name: Build on Linux (Docker)
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
release:
|
|
||||||
types:
|
|
||||||
- published
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
distro: # these names correspond to the files in .ci/$distro
|
|
||||||
- UbuntuGroovy
|
|
||||||
- UbuntuFocal
|
|
||||||
- UbuntuBionic
|
|
||||||
- ArchLinux
|
|
||||||
- DebianBuster
|
|
||||||
- Fedora33
|
|
||||||
include:
|
|
||||||
- distro: UbuntuGroovy
|
|
||||||
package: DEB
|
|
||||||
|
|
||||||
- distro: UbuntuFocal
|
|
||||||
package: DEB
|
|
||||||
test: skip # UbuntuFocal has a broken qt for debug builds
|
|
||||||
|
|
||||||
- distro: UbuntuBionic
|
|
||||||
package: DEB
|
|
||||||
|
|
||||||
- distro: ArchLinux
|
|
||||||
package: skip # we are packaged in arch already
|
|
||||||
allow-failure: yes
|
|
||||||
|
|
||||||
- distro: DebianBuster
|
|
||||||
package: DEB
|
|
||||||
|
|
||||||
- distro: Fedora33
|
|
||||||
package: RPM
|
|
||||||
test: skip # Fedora is our slowest build
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
continue-on-error: ${{matrix.allow-failure == 'yes'}}
|
|
||||||
|
|
||||||
env:
|
|
||||||
NAME: ${{matrix.distro}}
|
|
||||||
CACHE: /tmp/${{matrix.distro}}-cache # ${{runner.temp}} does not work?
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Get cache timestamp
|
|
||||||
id: cache_timestamp
|
|
||||||
shell: bash
|
|
||||||
run: echo "::set-output name=timestamp::$(date -u '+%Y%m%d%H%M%S')"
|
|
||||||
|
|
||||||
- name: Restore cache
|
|
||||||
uses: actions/cache@v2
|
|
||||||
env:
|
|
||||||
timestamp: ${{steps.cache_timestamp.outputs.timestamp}}
|
|
||||||
with:
|
|
||||||
path: ${{env.CACHE}}
|
|
||||||
key: docker-${{matrix.distro}}-cache-${{env.timestamp}}
|
|
||||||
restore-keys: |
|
|
||||||
docker-${{matrix.distro}}-cache-
|
|
||||||
|
|
||||||
- name: Build ${{matrix.distro}} Docker image
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
source .ci/docker.sh --build
|
|
||||||
export BUILD_SCRIPT="./ccache-stats.sh"
|
|
||||||
echo "ccache --show-stats" >$BUILD_SCRIPT
|
|
||||||
RUN # show stats in container instead of build
|
|
||||||
|
|
||||||
- name: Build debug and test
|
|
||||||
if: matrix.test != 'skip'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
source .ci/docker.sh
|
|
||||||
RUN --server --debug --test
|
|
||||||
|
|
||||||
- name: Build release package
|
|
||||||
if: matrix.package != 'skip'
|
|
||||||
id: build_package
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
source .ci/docker.sh
|
|
||||||
RUN --server --release --package ${{matrix.distro}} ${{matrix.package}}
|
|
||||||
file=$(cd build && echo Cockatrice-*.*)
|
|
||||||
echo "::set-output name=file::$file"
|
|
||||||
|
|
||||||
- name: Upload artifacts
|
|
||||||
if: matrix.package != 'skip'
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: ${{matrix.distro}}-package
|
|
||||||
path: build/${{steps.build_package.outputs.file}}
|
|
||||||
|
|
||||||
- name: Get release upload url
|
|
||||||
if: matrix.package != 'skip' && startsWith(github.ref, 'refs/tags/')
|
|
||||||
id: get_url
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
ref: "${{github.ref}}"
|
|
||||||
repo: "${{github.repository}}"
|
|
||||||
run: |
|
|
||||||
url="$(./.ci/get_github_upload_url.sh)"
|
|
||||||
echo "::set-output name=upload_url::$url"
|
|
||||||
|
|
||||||
- name: Upload release to GitHub
|
|
||||||
if: steps.get_url.outcome == 'success'
|
|
||||||
uses: actions/upload-release-asset@v1.0.2
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
||||||
with:
|
|
||||||
upload_url: ${{steps.get_url.outputs.upload_url}}
|
|
||||||
asset_path: build/${{steps.build_package.outputs.file}}
|
|
||||||
asset_name: ${{steps.build_package.outputs.file}}
|
|
||||||
asset_content_type: binary_package # required but arbitrary
|
|
||||||
191
.github/workflows/macos-builds.yml
vendored
191
.github/workflows/macos-builds.yml
vendored
|
|
@ -1,191 +0,0 @@
|
||||||
name: Build on macOS
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
release:
|
|
||||||
types:
|
|
||||||
- published
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
target:
|
|
||||||
- Debug
|
|
||||||
- ElCapitan
|
|
||||||
- Mojave
|
|
||||||
- Catalina
|
|
||||||
- BigSur
|
|
||||||
include:
|
|
||||||
- target: Debug # tests only
|
|
||||||
os: macos-latest
|
|
||||||
xcode: 11.7
|
|
||||||
type: Debug
|
|
||||||
do_tests: 0 # tests do not work yet on mac
|
|
||||||
make_package: false
|
|
||||||
|
|
||||||
- target: ElCapitan # xcode 8.2.1 should be compatible with macos 10.11.5
|
|
||||||
os: macos-10.13 # runs on HighSierra
|
|
||||||
allow-failure: yes # we don't know if it'll be added
|
|
||||||
xcode: 8.2.1
|
|
||||||
type: Release
|
|
||||||
do_tests: 0
|
|
||||||
make_package: true
|
|
||||||
|
|
||||||
- target: Mojave # xcode 10.3 should be compatible with macos 10.14.3
|
|
||||||
os: macos-10.15 # runs on Catalina
|
|
||||||
xcode: 10.3
|
|
||||||
type: Release
|
|
||||||
do_tests: 0
|
|
||||||
make_package: true
|
|
||||||
|
|
||||||
- target: Catalina
|
|
||||||
os: macos-10.15
|
|
||||||
xcode: 11.7
|
|
||||||
type: Release
|
|
||||||
do_tests: 0
|
|
||||||
make_package: true
|
|
||||||
|
|
||||||
- target: BigSur
|
|
||||||
os: macos-11.0
|
|
||||||
xcode: 12.2
|
|
||||||
type: Release
|
|
||||||
do_tests: 0
|
|
||||||
make_package: true
|
|
||||||
|
|
||||||
runs-on: ${{matrix.os}}
|
|
||||||
|
|
||||||
continue-on-error: ${{matrix.allow-failure == 'yes'}}
|
|
||||||
|
|
||||||
env:
|
|
||||||
CCACHE_DIR: ~/.ccache
|
|
||||||
DEVELOPER_DIR:
|
|
||||||
/Applications/Xcode_${{matrix.xcode}}.app/Contents/Developer
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Install dependencies using homebrew
|
|
||||||
shell: bash
|
|
||||||
# cmake cannot find the mysql connector
|
|
||||||
# neither of these works: mariadb-connector-c mysql-connector-c++
|
|
||||||
run: brew install ccache protobuf
|
|
||||||
|
|
||||||
# in case we'd want to modify this for windows (should be its own workflow):
|
|
||||||
# - if: runner.os == 'windows'
|
|
||||||
# name: Install dependencies using vcpkg
|
|
||||||
# shell: bash
|
|
||||||
# run: vcpkg install protobuf liblzma zlib --triplet x64-windows
|
|
||||||
|
|
||||||
- name: Install QT using homebrew
|
|
||||||
id: brew_install_qt
|
|
||||||
continue-on-error: true
|
|
||||||
shell: bash
|
|
||||||
run: brew install qt --force-bottle
|
|
||||||
|
|
||||||
- name: Install QT using actions
|
|
||||||
if: steps.brew_install_qt.outcome == 'failure'
|
|
||||||
uses: jurplel/install-qt-action@v2
|
|
||||||
|
|
||||||
- name: Get ccache timestamp
|
|
||||||
id: ccache_timestamp
|
|
||||||
shell: bash
|
|
||||||
run: echo "::set-output name=timestamp::$(date -u '+%Y%m%d%H%M%S')"
|
|
||||||
|
|
||||||
- name: Restore ccache cache
|
|
||||||
uses: actions/cache@v2
|
|
||||||
env:
|
|
||||||
timestamp: ${{steps.ccache_timestamp.outputs.timestamp}}
|
|
||||||
with:
|
|
||||||
path: ${{env.CCACHE_DIR}}
|
|
||||||
key: ${{runner.os}}-xcode-${{matrix.xcode}}-ccache-${{env.timestamp}}
|
|
||||||
restore-keys: |
|
|
||||||
${{runner.os}}-xcode-${{matrix.xcode}}-ccache-
|
|
||||||
|
|
||||||
- name: Create build environment
|
|
||||||
run: cmake -E make_directory build
|
|
||||||
|
|
||||||
- name: Configure CMake
|
|
||||||
shell: bash
|
|
||||||
working-directory: build
|
|
||||||
run: |
|
|
||||||
ccache --show-stats
|
|
||||||
mkdir -p $CCACHE_DIR
|
|
||||||
ls $CCACHE_DIR
|
|
||||||
if [[ ${{steps.brew_install_qt.outcome}} == 'success' ]]; then
|
|
||||||
cmake_args=" -DCMAKE_PREFIX_PATH=$(echo /usr/local/Cellar/qt/*)"
|
|
||||||
echo "added$cmake_args cmake argument for homebrew"
|
|
||||||
fi
|
|
||||||
cmake_args+=" -DTEST=${{matrix.do_tests}}"
|
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=${{matrix.type}} -DWITH_SERVER=1 $cmake_args
|
|
||||||
|
|
||||||
- name: Build on Xcode ${{matrix.xcode}}
|
|
||||||
shell: bash
|
|
||||||
working-directory: build
|
|
||||||
run: cmake --build .
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
if: matrix.do_tests == 1
|
|
||||||
shell: bash
|
|
||||||
working-directory: build
|
|
||||||
run: cmake --build . --target test
|
|
||||||
|
|
||||||
- name: Package for ${{matrix.target}}
|
|
||||||
if: matrix.make_package
|
|
||||||
id: build_package
|
|
||||||
shell: bash
|
|
||||||
working-directory: build
|
|
||||||
run: |
|
|
||||||
# temporary workaround for big sur images having old cmake
|
|
||||||
if [[ ${{matrix.os}} == macos-11.0 ]]; then
|
|
||||||
curl -L https://github.com/Kitware/CMake/releases/download/v3.19.0/cmake-3.19.0-Darwin-x86_64.tar.gz | tar -xz
|
|
||||||
./cmake-3.19.0-Darwin-x86_64/CMake.app/Contents/bin/cpack --config ./CPackConfig.cmake
|
|
||||||
else
|
|
||||||
cmake --build . --target package
|
|
||||||
fi
|
|
||||||
file=$(echo Cockatrice-*.*)
|
|
||||||
extension="${file##*.}"
|
|
||||||
name="${file%.*}"
|
|
||||||
newfile="$name-macOS-${{matrix.target}}.$extension"
|
|
||||||
mv "$file" "$newfile" # avoid file name conflicts
|
|
||||||
echo "::set-output name=file::$newfile"
|
|
||||||
|
|
||||||
- name: Upload artifacts
|
|
||||||
if: matrix.make_package
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: macOS-${{matrix.target}}-xcode-${{matrix.xcode}}-dmg
|
|
||||||
path: build/${{steps.build_package.outputs.file}}
|
|
||||||
|
|
||||||
- name: Get release upload URL
|
|
||||||
if: matrix.make_package && startsWith(github.ref, 'refs/tags/')
|
|
||||||
id: get_url
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
ref: "${{github.ref}}"
|
|
||||||
repo: "${{github.repository}}"
|
|
||||||
run: |
|
|
||||||
url=$(./.ci/get_github_upload_url.sh)
|
|
||||||
echo "::set-output name=upload_url::$url"
|
|
||||||
|
|
||||||
- name: Upload release for ${{matrix.target}}
|
|
||||||
if: steps.get_url.outcome == 'success'
|
|
||||||
uses: actions/upload-release-asset@v1.0.2
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
||||||
with:
|
|
||||||
upload_url: ${{steps.get_url.outputs.upload_url}}
|
|
||||||
asset_path: build/${{steps.build_package.outputs.file}}
|
|
||||||
asset_name: ${{steps.build_package.outputs.file}}
|
|
||||||
asset_content_type: binary_package # required but arbitrary
|
|
||||||
246
.github/workflows/windows-builds.yml
vendored
246
.github/workflows/windows-builds.yml
vendored
|
|
@ -1,246 +0,0 @@
|
||||||
name: 'Build on Windows'
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
win64:
|
|
||||||
name: 'Windows 64-bit'
|
|
||||||
runs-on: [windows-latest]
|
|
||||||
env:
|
|
||||||
QT_VERSION: '5.12.9'
|
|
||||||
CMAKE_GENERATOR: "Visual Studio 16 2019"
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: 'Add msbuild to PATH'
|
|
||||||
uses: microsoft/setup-msbuild@v1.0.2
|
|
||||||
|
|
||||||
- name: 'Checkout'
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
submodules: 'recursive'
|
|
||||||
|
|
||||||
- name: 'Get Cockatrice git info'
|
|
||||||
shell: bash
|
|
||||||
working-directory: ${{ github.workspace }}
|
|
||||||
run: |
|
|
||||||
git fetch --prune --unshallow
|
|
||||||
echo "GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
|
|
||||||
echo "GIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
|
||||||
echo "GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: 'Restore Qt 64-bit from cache'
|
|
||||||
id: cache-qt32
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
${{ runner.workspace }}/Qt64
|
|
||||||
key: ${{ runner.os }}-QtCache-64bit
|
|
||||||
|
|
||||||
- name: 'Install 64-bit Qt'
|
|
||||||
uses: jurplel/install-qt-action@v2
|
|
||||||
with:
|
|
||||||
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
|
||||||
version: '${{ env.QT_VERSION }}'
|
|
||||||
arch: 'win64_msvc2017_64'
|
|
||||||
dir: ${{ runner.workspace }}/Qt64
|
|
||||||
|
|
||||||
- name: 'Restore or setup vcpkg'
|
|
||||||
uses: lukka/run-vcpkg@v6
|
|
||||||
with:
|
|
||||||
vcpkgArguments: '@${{ github.workspace }}/vcpkg.txt'
|
|
||||||
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
|
|
||||||
appendedCacheKey: ${{ hashFiles('**/vcpkg.txt') }}
|
|
||||||
vcpkgTriplet: x64-windows
|
|
||||||
|
|
||||||
- name: 'Configure Cockatrice 64-bit'
|
|
||||||
working-directory: ${{ github.workspace }}
|
|
||||||
run: |
|
|
||||||
New-Item build64 -type directory -force
|
|
||||||
cd build64
|
|
||||||
cmake .. -G "${{ env.CMAKE_GENERATOR }}" -A "x64" -DQTDIR="${{ runner.workspace }}\Qt64\Qt\5.12.9\msvc2017_64" -DCMAKE_BUILD_TYPE="Release" -DWITH_SERVER=1 -DTEST=t
|
|
||||||
|
|
||||||
- name: 'Build Cockatrice 64-bit'
|
|
||||||
working-directory: ${{ github.workspace }}
|
|
||||||
run: msbuild /m /p:Configuration=Release .\build64\Cockatrice.sln
|
|
||||||
|
|
||||||
- name: 'Build Cockatrice Installer Package 64-bit'
|
|
||||||
working-directory: ${{ github.workspace }}
|
|
||||||
run: |
|
|
||||||
cd build64
|
|
||||||
msbuild /m /p:Configuration=Release PACKAGE.vcxproj
|
|
||||||
cp *.exe ../Cockatrice-${{ env.GIT_TAG }}-${{ env.GIT_HASH }}-64bit-installer.exe
|
|
||||||
|
|
||||||
- name: 'Run Tests'
|
|
||||||
working-directory: ${{ github.workspace }}/build64
|
|
||||||
run: ctest -T Test -C Release
|
|
||||||
|
|
||||||
- name: 'Publish'
|
|
||||||
if: success()
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: 'Cockatrice-${{ env.GIT_TAG }}-64bit'
|
|
||||||
path: './*.exe'
|
|
||||||
|
|
||||||
win32:
|
|
||||||
name: 'Windows 32-bit'
|
|
||||||
runs-on: [windows-latest]
|
|
||||||
env:
|
|
||||||
QT_VERSION: '5.12.9'
|
|
||||||
CMAKE_GENERATOR: "Visual Studio 16 2019"
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: 'Add msbuild to PATH'
|
|
||||||
uses: microsoft/setup-msbuild@v1.0.2
|
|
||||||
|
|
||||||
- name: 'Checkout'
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
submodules: 'recursive'
|
|
||||||
|
|
||||||
- name: 'Get Cockatrice git info'
|
|
||||||
shell: bash
|
|
||||||
working-directory: ${{ github.workspace }}
|
|
||||||
run: |
|
|
||||||
git fetch --prune --unshallow
|
|
||||||
echo "GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
|
|
||||||
echo "GIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
|
||||||
echo "GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: 'Restore Qt from cache'
|
|
||||||
id: cache-qt32
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
${{ runner.workspace }}/Qt32
|
|
||||||
key: ${{ runner.os }}-QtCache-32bit
|
|
||||||
|
|
||||||
- name: 'Install 32-bit Qt'
|
|
||||||
uses: jurplel/install-qt-action@v2
|
|
||||||
with:
|
|
||||||
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
|
||||||
version: '${{ env.QT_VERSION }}'
|
|
||||||
arch: 'win32_msvc2017'
|
|
||||||
dir: ${{ runner.workspace }}/Qt32
|
|
||||||
|
|
||||||
- name: 'Restore or setup vcpkg'
|
|
||||||
uses: lukka/run-vcpkg@v6
|
|
||||||
with:
|
|
||||||
vcpkgArguments: '@${{ github.workspace }}/vcpkg.txt'
|
|
||||||
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
|
|
||||||
appendedCacheKey: ${{ hashFiles('**/vcpkg.txt') }}
|
|
||||||
vcpkgTriplet: x86-windows
|
|
||||||
|
|
||||||
- name: 'Configure Cockatrice 32-bit'
|
|
||||||
working-directory: ${{ github.workspace }}
|
|
||||||
run: |
|
|
||||||
New-Item build32 -type directory -force
|
|
||||||
cd build32
|
|
||||||
cmake .. -G "${{ env.CMAKE_GENERATOR }}" -A "Win32" -DQTDIR="${{ runner.workspace }}\Qt32\Qt\5.12.9\msvc2017" -DCMAKE_BUILD_TYPE="Release" -DWITH_SERVER=1 -DTEST=1
|
|
||||||
|
|
||||||
- name: 'Build Cockatrice 32-bit'
|
|
||||||
working-directory: ${{ github.workspace }}
|
|
||||||
run: msbuild /m /p:Configuration=Release .\build32\Cockatrice.sln
|
|
||||||
|
|
||||||
- name: 'Build Cockatrice Installer Package 32-bit'
|
|
||||||
working-directory: ${{ github.workspace }}
|
|
||||||
run: |
|
|
||||||
cd build32
|
|
||||||
msbuild /m /p:Configuration=Release PACKAGE.vcxproj
|
|
||||||
cp *.exe ../Cockatrice-${{ env.GIT_TAG }}-${{ env.GIT_HASH }}-32bit-installer.exe
|
|
||||||
|
|
||||||
- name: 'Run Tests'
|
|
||||||
working-directory: ${{ github.workspace }}/build32
|
|
||||||
run: ctest -T Test -C Release
|
|
||||||
|
|
||||||
- name: 'Publish'
|
|
||||||
if: success()
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: 'Cockatrice-${{ env.GIT_TAG }}-32bit'
|
|
||||||
path: './*.exe'
|
|
||||||
|
|
||||||
make-release:
|
|
||||||
name: 'Create and upload release'
|
|
||||||
runs-on: [ubuntu-latest]
|
|
||||||
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
|
||||||
needs: [win32,win64]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: 'Checkout'
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
submodules: 'recursive'
|
|
||||||
|
|
||||||
- name: 'Fetch git tags'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
git fetch --prune --unshallow
|
|
||||||
echo "GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
|
|
||||||
echo "GIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
|
||||||
echo "GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: 'Checking if beta'
|
|
||||||
if: contains(env.GIT_TAG, 'beta')
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo 'IS_BETA=true' >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: 'Checking if beta'
|
|
||||||
if: "!contains(env.GIT_TAG, 'beta')"
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo 'IS_BETA=false' >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: 'Create Release'
|
|
||||||
id: create_release
|
|
||||||
uses: actions/create-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
tag_name: ${{ env.GIT_TAG }}
|
|
||||||
release_name: Cockatrice ${{ env.GIT_TAG }}
|
|
||||||
draft: true
|
|
||||||
prerelease: ${{ env.IS_BETA }}
|
|
||||||
|
|
||||||
- name: 'Generate filenames'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
FILE_NAME=Cockatrice-${{ env.GIT_TAG }}-${{ env.GIT_HASH }}
|
|
||||||
echo "FILE_NAME=${FILE_NAME}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: 'Download artifacts'
|
|
||||||
uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
path: ./
|
|
||||||
|
|
||||||
- name: 'Upload 32bit to release'
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: ./Cockatrice-${{ env.GIT_TAG }}-32bit/${{ env.FILE_NAME }}-32bit-installer.exe
|
|
||||||
asset_name: Cockatrice-${{ env.GIT_TAG }}-32bit-installer.exe
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: 'Upload 64bit to release'
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: ./Cockatrice-${{ env.GIT_TAG }}-64bit/${{ env.FILE_NAME }}-64bit-installer.exe
|
|
||||||
asset_name: Cockatrice-${{ env.GIT_TAG }}-64bit-installer.exe
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
#include <QRegularExpression>
|
||||||
#include <QSysInfo>
|
#include <QSysInfo>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
|
@ -45,24 +46,19 @@ void ReleaseChannel::checkForUpdates()
|
||||||
#if defined(Q_OS_OSX)
|
#if defined(Q_OS_OSX)
|
||||||
bool ReleaseChannel::downloadMatchesCurrentOS(const QString &fileName)
|
bool ReleaseChannel::downloadMatchesCurrentOS(const QString &fileName)
|
||||||
{
|
{
|
||||||
const int mac_os_version = QSysInfo::productVersion().split(".")[1].toInt();
|
static QRegularExpression version_regex("macOS-(\\d+)\\.(\\d+)");
|
||||||
|
auto match = version_regex.match(fileName);
|
||||||
// TODO: If we change macOS builds, this must be updated
|
if (!match.hasMatch()) {
|
||||||
if (mac_os_version <= 12) {
|
|
||||||
// We no longer compile files for macOS 10.12 Sierra or older
|
|
||||||
return false;
|
return false;
|
||||||
} else if (mac_os_version == 13) {
|
|
||||||
// We support 10.13 High Sierra
|
|
||||||
return fileName.contains("macos10.13");
|
|
||||||
} else if (14 <= mac_os_version && mac_os_version <= 15) {
|
|
||||||
// We support 10.14 Mojave, and 10.15 Catalina
|
|
||||||
return fileName.contains("macos10.14");
|
|
||||||
} else {
|
|
||||||
// Future Mac releases we haven't heard of or accounted for yet
|
|
||||||
return (!fileName.contains("macos10.13") && !fileName.contains("macos10.14") && fileName.contains("macos"));
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// older(smaller) releases are compatible with a newer or the same system version
|
||||||
|
int sys_maj = QSysInfo::productVersion().split(".")[0].toInt();
|
||||||
|
int sys_min = QSysInfo::productVersion().split(".")[1].toInt();
|
||||||
|
int rel_maj = match.captured(1).toInt();
|
||||||
|
int rel_min = match.captured(2).toInt();
|
||||||
|
return rel_maj < sys_maj || (rel_maj == sys_maj && rel_min <= rel_min);
|
||||||
|
}
|
||||||
#elif defined(Q_OS_WIN)
|
#elif defined(Q_OS_WIN)
|
||||||
bool ReleaseChannel::downloadMatchesCurrentOS(const QString &fileName)
|
bool ReleaseChannel::downloadMatchesCurrentOS(const QString &fileName)
|
||||||
{
|
{
|
||||||
|
|
@ -283,18 +279,21 @@ void BetaReleaseChannel::fileListFinished()
|
||||||
bool needToUpdate = (QString::compare(shortHash, myHash, Qt::CaseInsensitive) != 0);
|
bool needToUpdate = (QString::compare(shortHash, myHash, Qt::CaseInsensitive) != 0);
|
||||||
bool compatibleVersion = false;
|
bool compatibleVersion = false;
|
||||||
|
|
||||||
foreach (QVariant file, resultList) {
|
QStringList resultUrlList{};
|
||||||
|
for (QVariant file : resultList) {
|
||||||
QVariantMap map = file.toMap();
|
QVariantMap map = file.toMap();
|
||||||
|
resultUrlList << map["browser_download_url"].toString();
|
||||||
|
}
|
||||||
|
|
||||||
QString url = map["browser_download_url"].toString();
|
resultUrlList.sort();
|
||||||
|
// iterate in reverse so the first item is the latest os version
|
||||||
if (!downloadMatchesCurrentOS(url))
|
for (auto url = resultUrlList.rbegin(); url < resultUrlList.rend(); ++url) {
|
||||||
continue;
|
if (downloadMatchesCurrentOS(*url)) {
|
||||||
|
compatibleVersion = true;
|
||||||
compatibleVersion = true;
|
lastRelease->setDownloadUrl(*url);
|
||||||
lastRelease->setDownloadUrl(url);
|
qDebug() << "Found compatible version url=" << *url;
|
||||||
qDebug() << "Found compatible version url=" << url;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit finishedCheck(needToUpdate, compatibleVersion, lastRelease);
|
emit finishedCheck(needToUpdate, compatibleVersion, lastRelease);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue