add github actions (#4164)
This commit is contained in:
parent
45d838a0b3
commit
4aaedf64d2
11 changed files with 425 additions and 334 deletions
|
@ -1,4 +1,4 @@
|
||||||
FROM fedora:32
|
FROM fedora:33
|
||||||
|
|
||||||
RUN dnf install -y \
|
RUN dnf install -y \
|
||||||
@development-tools \
|
@development-tools \
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# This script is to be used in .travis.yaml 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.
|
||||||
|
|
||||||
# Read arguments
|
# Read arguments
|
||||||
while [[ "$@" ]]; do
|
while [[ "$@" ]]; do
|
||||||
|
@ -58,7 +58,7 @@ done
|
||||||
|
|
||||||
# Check formatting using clang-format
|
# Check formatting using clang-format
|
||||||
if [[ $CHECK_FORMAT ]]; then
|
if [[ $CHECK_FORMAT ]]; then
|
||||||
source ./.ci/travis-lint.sh
|
source ./.ci/lint.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
@ -69,7 +69,7 @@ mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
|
|
||||||
if ! [[ $CORE_AMOUNT ]]; then
|
if ! [[ $CORE_AMOUNT ]]; then
|
||||||
CORE_AMOUNT="2" # travis machines have 2 cores
|
CORE_AMOUNT="2" # default machines have 2 cores
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add cmake flags
|
# Add cmake flags
|
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# This script is to be sourced in .travis.yaml 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.
|
||||||
|
|
||||||
# Creates or loads docker images to use in compilation, creates RUN function to start compilation on the docker image.
|
# Creates or loads docker images to use in compilation, creates RUN function to start compilation on the docker image.
|
||||||
# --get loads the image from a previously saved image cache, will build if no image is found
|
# --get loads the image from a previously saved image cache, will build if no image is found
|
||||||
# --build builds the image from the Dockerfile in .ci/$NAME
|
# --build builds the image from the Dockerfile in .ci/$NAME
|
||||||
|
@ -9,7 +10,7 @@
|
||||||
# uses env: NAME CACHE BUILD GET SAVE (correspond to args: <name> --set-cache <cache> --build --get --save)
|
# uses env: NAME CACHE BUILD GET SAVE (correspond to args: <name> --set-cache <cache> --build --get --save)
|
||||||
# sets env: RUN CCACHE_DIR IMAGE_NAME RUN_ARGS RUN_OPTS BUILD_SCRIPT
|
# sets env: RUN CCACHE_DIR IMAGE_NAME RUN_ARGS RUN_OPTS BUILD_SCRIPT
|
||||||
# exitcode: 1 for failure, 2 for missing dockerfile, 3 for invalid arguments
|
# exitcode: 1 for failure, 2 for missing dockerfile, 3 for invalid arguments
|
||||||
export BUILD_SCRIPT=".ci/travis-compile.sh"
|
export BUILD_SCRIPT=".ci/compile.sh"
|
||||||
|
|
||||||
project_name="cockatrice"
|
project_name="cockatrice"
|
||||||
save_extension=".tar.gz"
|
save_extension=".tar.gz"
|
||||||
|
@ -64,10 +65,14 @@ if ! [[ -r $docker_dir/Dockerfile ]]; then
|
||||||
return 2 # even if the image is cached, we do not want to run if there is no way to build this image
|
return 2 # even if the image is cached, we do not want to run if there is no way to build this image
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [[ -d $CACHE ]]; then
|
if ! [[ $CACHE ]]; then
|
||||||
echo "could not find cache dir: $CACHE" >&2
|
echo "cache dir is not set!" >&2
|
||||||
unset CACHE
|
|
||||||
else
|
else
|
||||||
|
if ! [[ -d $CACHE ]]; then
|
||||||
|
echo "could not find cache dir: $CACHE" >&2
|
||||||
|
mkdir -p $CACHE
|
||||||
|
unset GET # the dir is empty
|
||||||
|
fi
|
||||||
if [[ $GET || $SAVE ]]; then
|
if [[ $GET || $SAVE ]]; then
|
||||||
img_dir="$CACHE/$image_cache"
|
img_dir="$CACHE/$image_cache"
|
||||||
img_save="$img_dir/$IMAGE_NAME$save_extension"
|
img_save="$img_dir/$IMAGE_NAME$save_extension"
|
19
.ci/get_github_upload_url.sh
Executable file
19
.ci/get_github_upload_url.sh
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/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
|
|
@ -1,9 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Check formatting using clang-format
|
# fetch master branch
|
||||||
|
git fetch origin master
|
||||||
|
|
||||||
|
# unshallow if needed
|
||||||
|
echo "Finding merge base"
|
||||||
|
if ! git merge-base origin/master HEAD; then
|
||||||
|
echo "Could not find merge base, unshallowing repo"
|
||||||
|
git fetch --unshallow
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check formatting using clangify
|
||||||
echo "Checking your code using clang-format..."
|
echo "Checking your code using clang-format..."
|
||||||
|
|
||||||
diff="$(./clangify.sh --diff --cf-version)"
|
diff="$(./clangify.sh --diff --cf-version --branch origin/master)"
|
||||||
err=$?
|
err=$?
|
||||||
|
|
||||||
case $err in
|
case $err in
|
95
.github/CONTRIBUTING.md
vendored
95
.github/CONTRIBUTING.md
vendored
|
@ -39,11 +39,10 @@ albeit slightly less active.
|
||||||
|
|
||||||
### Formatting and continuous integration (CI) ###
|
### Formatting and continuous integration (CI) ###
|
||||||
|
|
||||||
We use a separate job on Travis CI to check your code for formatting issues. If
|
We use a separate job on the CI to check your code for formatting issues. If
|
||||||
your pull request was rejected, you can check the output on their website.
|
your pull request failed the test, you can check the output on the checks tab.
|
||||||
To do so, click on <kbd>Details</kbd> next to the failed Travis CI build at the
|
It's the first job called "linter", you can click the "Run clangify" step to
|
||||||
bottom of your PR on the GitHub page, on the Travis page then click on our "Linting"
|
see the output of the test.
|
||||||
build (the fastest one on the very top of the list) to see the complete log.
|
|
||||||
|
|
||||||
The message will look like this:
|
The message will look like this:
|
||||||
```
|
```
|
||||||
|
@ -59,9 +58,9 @@ The message will look like this:
|
||||||
*** ***
|
*** ***
|
||||||
***********************************************************
|
***********************************************************
|
||||||
```
|
```
|
||||||
The CONTRIBUTING.md file mentioned in that message is the file you are currently
|
The CONTRIBUTING.md file mentioned in that message is the file you are
|
||||||
reading. Please see [this section](#formatting) below for full information on our
|
currently reading. Please see [this section](#formatting) below for full
|
||||||
formatting guidelines.
|
information on our formatting guidelines.
|
||||||
|
|
||||||
### Compatibility ###
|
### Compatibility ###
|
||||||
|
|
||||||
|
@ -272,11 +271,11 @@ https://github.com/Cockatrice/Cockatrice/wiki/Client-server-protocol)
|
||||||
# Reviewing Pull Requests #
|
# Reviewing Pull Requests #
|
||||||
|
|
||||||
After you have finished your changes to the project you should put them on a
|
After you have finished your changes to the project you should put them on a
|
||||||
separate branch of your fork on github and open a [pull request](
|
separate branch of your fork on GitHub and open a [pull request](
|
||||||
https://docs.github.com/en/free-pro-team@latest/desktop/contributing-and-collaborating-using-github-desktop/creating-an-issue-or-pull-request
|
https://docs.github.com/en/free-pro-team@latest/desktop/contributing-and-collaborating-using-github-desktop/creating-an-issue-or-pull-request
|
||||||
).
|
).
|
||||||
Your code will then be automatically compiled by Travis CI for Linux and macOS,
|
Your code will then be automatically compiled by GitHub actions for Linux and
|
||||||
and by Appveyor for Windows. Additionally Travis CI will perform a [Linting
|
macOS, and by Appveyor for Windows. Additionally GitHub will perform a [Linting
|
||||||
check](#formatting-and-continuous-integration-ci). If any issues come up you
|
check](#formatting-and-continuous-integration-ci). If any issues come up you
|
||||||
can check their status at the bottom of the pull request page, click on details
|
can check their status at the bottom of the pull request page, click on details
|
||||||
to go to the CI website and see the different build logs.
|
to go to the CI website and see the different build logs.
|
||||||
|
@ -292,7 +291,7 @@ be included in the next release 👍
|
||||||
Basic workflow for translations:
|
Basic workflow for translations:
|
||||||
1. Developer adds a `tr("foo")` string in the code;
|
1. Developer adds a `tr("foo")` string in the code;
|
||||||
2. Every few days, a maintainer updates the `*_en.ts files` with the new strings;
|
2. Every few days, a maintainer updates the `*_en.ts files` with the new strings;
|
||||||
3. Transifex picks up the new files from github every 24 hours;
|
3. Transifex picks up the new files from GitHub every 24 hours;
|
||||||
4. Translators translate the new untranslated strings on Transifex;
|
4. Translators translate the new untranslated strings on Transifex;
|
||||||
5. Before a release, a maintainer fetches the updated translations from Transifex.
|
5. Before a release, a maintainer fetches the updated translations from Transifex.
|
||||||
|
|
||||||
|
@ -388,37 +387,38 @@ https://github.com/Cockatrice/Cockatrice/wiki/Translation-FAQ).
|
||||||
|
|
||||||
# Release Management #
|
# Release Management #
|
||||||
|
|
||||||
### Publishing A New Beta Release ###
|
### Publishing A New Release ###
|
||||||
|
|
||||||
Travis and AppVeyor have been configured to upload files to GitHub Releases
|
GitHub Actions will upload binaries (Linux & macOS) when any release is published
|
||||||
whenever a <kbd>tag</kbd> is pushed.<br>
|
on GitHub.<br>
|
||||||
Usually, tags are created through publishing a (pre-)release, but there's a way
|
AppVeyor is configured to upload binaries (Windows) to GitHub Releases whenever a
|
||||||
around that.
|
<kbd>tag</kbd> is pushed.<br>
|
||||||
|
You can create a tag when publishing a (pre-)release, but you can also push one
|
||||||
|
manually and use it in the release.
|
||||||
|
|
||||||
To trigger Travis and AppVeyor, simply do the following:
|
To create a tag, simply do the following:
|
||||||
```bash
|
```bash
|
||||||
cd $COCKATRICE_REPO
|
|
||||||
git checkout master
|
git checkout master
|
||||||
git remote update -p
|
git remote update -p
|
||||||
git pull
|
git pull
|
||||||
git tag $TAG_NAME
|
git tag $TAG_NAME
|
||||||
git push upstream $TAG_NAME
|
git push $UPSTREAM $TAG_NAME
|
||||||
```
|
```
|
||||||
You should define the variables as such:
|
You should define the variables as such:
|
||||||
```
|
```
|
||||||
upstream - git@github.com:Cockatrice/Cockatrice.git
|
`$UPSTREAM` - the remote for git@github.com:Cockatrice/Cockatrice.git
|
||||||
$COCKATRICE_REPO - /Location/of/repository/cockatrice.git
|
`$TAG_NAME` should be formatted as:
|
||||||
`$TAG_NAME` should be:
|
|
||||||
- `YYYY-MM-DD-Release-MAJ.MIN.PATCH` for **stable releases**
|
- `YYYY-MM-DD-Release-MAJ.MIN.PATCH` for **stable releases**
|
||||||
- `YYYY-MM-DD-Development-MAJ.MIN.PATCH-beta.X` for **beta releases**<br>
|
- `YYYY-MM-DD-Development-MAJ.MIN.PATCH-beta.X` for **beta releases**<br>
|
||||||
With *MAJ.MIN.PATCH* being the NEXT release version!
|
With *MAJ.MIN.PATCH* being the NEXT release version!
|
||||||
```
|
```
|
||||||
|
|
||||||
This will cause a tagged release to be established on the GitHub repository,
|
This will cause a tagged release to be established on the GitHub repository,
|
||||||
which will then lead to the upload of binaries. If you use this method, the
|
which will then lead to the upload of binaries by Appveyor.
|
||||||
tags (releases) that you create will be marked as a "Pre-release". The
|
If you use a SemVer tag including "beta", the release that will be created at GitHub
|
||||||
`/latest` URL will not be impacted (for stable release downloads) so that's
|
by the CI will be marked as a "Pre-release".
|
||||||
good.
|
The target of the `.../latest` URL will not be changed in that case -
|
||||||
|
it always points to the latest stable release and not pre-releases.
|
||||||
|
|
||||||
If you accidentally push a tag incorrectly (the tag is outdated, you didn't
|
If you accidentally push a tag incorrectly (the tag is outdated, you didn't
|
||||||
pull in the latest branch accidentally, you named the tag wrong, etc.) you can
|
pull in the latest branch accidentally, you named the tag wrong, etc.) you can
|
||||||
|
@ -428,28 +428,31 @@ git push --delete upstream $TAG_NAME
|
||||||
git tag -d $TAG_NAME
|
git tag -d $TAG_NAME
|
||||||
```
|
```
|
||||||
|
|
||||||
**NOTE:** Unfortunately, due to the method of how Travis and AppVeyor work, to
|
**NOTE:** Unfortunately, due to the method of how AppVeyor works, to publish a
|
||||||
publish a stable release you will need to make a copy of the release notes
|
stable release you will need to make a copy of the drafted release notes locally before
|
||||||
locally and then paste them into the GitHub GUI once the binaries have been
|
pushing the tag, and paste them back into the GitHub releases GUI once the binaries have
|
||||||
uploaded by them. These CI services will automatically overwrite the name of
|
been uploaded by the CI.
|
||||||
the release (to "Cockatrice $TAG_NAME"), the status of the release (to
|
<br>
|
||||||
"Pre-release"), and the release body (to "Beta build of Cockatrice").
|
The AppVeyor service will automatically overwrite the name of the release to
|
||||||
|
"Cockatrice $TAG_NAME".
|
||||||
|
In addition, for beta releases, the status of the release will be set to "Pre-release", and
|
||||||
|
the release body will get renamed to "Beta build of Cockatrice".
|
||||||
|
|
||||||
**NOTE 2:** In the first lines of [CMakeLists.txt](
|
**NOTE 2:** In the first lines of [CMakeLists.txt](
|
||||||
https://github.com/Cockatrice/Cockatrice/blob/master/CMakeLists.txt)
|
https://github.com/Cockatrice/Cockatrice/blob/master/CMakeLists.txt)
|
||||||
there's an hardcoded version number used when compiling custom (not tagged)
|
there's an hardcoded version number used when compiling from master or custom (not tagged)
|
||||||
versions. While on tagged versions these numbers are overridden by the version
|
versions. While on tagged versions these numbers are overridden by the version
|
||||||
numbers coming from the tag title, it's good practice to keep them aligned with
|
numbers coming from the tag title, it's good practice to increment the ones at CMake
|
||||||
the real ones.
|
after every full release to stress that master is ahead of the last stable release.
|
||||||
The preferred flow of operation is:
|
The preferred flow of operation is:
|
||||||
* just before a release, update the version number in CMakeLists.txt to "next
|
* Just before a release, make sure the version number in CMakeLists.txt is set
|
||||||
release version";
|
to the same release version you are about to tag.
|
||||||
* tag the release following the previously described syntax in order to get it
|
* Tag the release following the previously described syntax in order to get it correctly
|
||||||
built by CI;
|
built and deployed by CI.
|
||||||
* wait for CI to upload the binaries, double check if everything is in order
|
* Wait for them to upload all binaries, then double check if everything is in order.
|
||||||
* after the release is complete, update the version number again to "next
|
* After the release is complete, update the CMake version number again to the next
|
||||||
targeted beta version", typically increasing `PROJECT_VERSION_PATCH` by one.
|
targeted beta version, typically increasing `PROJECT_VERSION_PATCH` by one.
|
||||||
|
|
||||||
**NOTE 3:** When releasing a new stable version, all the previous beta versions
|
**NOTE 3:** When releasing a new stable version, all previous beta releases (and tags)
|
||||||
should be deleted. This is needed for Cockatrice to update users of the "beta"
|
should be deleted. This is needed for Cockatrice to update users of the "Beta"
|
||||||
release channel to the latest version like other users.
|
release channel correctly to the latest stable version as well.
|
||||||
|
|
26
.github/workflows/clangify.yml
vendored
Normal file
26
.github/workflows/clangify.yml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
name: Clangify
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
linter:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 20 # should be enough to find merge base
|
||||||
|
|
||||||
|
- name: Install clang-format
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y --no-install-recommends clang-format
|
||||||
|
|
||||||
|
- name: Run clangify
|
||||||
|
shell: bash
|
||||||
|
run: ./.ci/lint.sh
|
120
.github/workflows/linux-builds.yml
vendored
Normal file
120
.github/workflows/linux-builds.yml
vendored
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
name: Build on Linux (Docker)
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- published
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
distro: # these names correspond to the files in .ci/$distro
|
||||||
|
- UbuntuFocal
|
||||||
|
- UbuntuBionic
|
||||||
|
- ArchLinux
|
||||||
|
- DebianBuster
|
||||||
|
- Fedora33
|
||||||
|
include:
|
||||||
|
- 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
|
184
.github/workflows/macos-builds.yml
vendored
Normal file
184
.github/workflows/macos-builds.yml
vendored
Normal file
|
@ -0,0 +1,184 @@
|
||||||
|
name: Build on macOS
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
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
|
276
.travis.yml
276
.travis.yml
|
@ -1,276 +0,0 @@
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
language: cpp
|
|
||||||
compiler: gcc
|
|
||||||
|
|
||||||
git:
|
|
||||||
depth: 15
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
include:
|
|
||||||
|
|
||||||
#Static Code Analysis
|
|
||||||
- name: Check code style / Linting
|
|
||||||
if: tag IS NOT present
|
|
||||||
os: linux
|
|
||||||
group: stable
|
|
||||||
script: bash ./.ci/travis-lint.sh
|
|
||||||
|
|
||||||
|
|
||||||
#Ubuntu Bionic (on Docker)
|
|
||||||
- name: Ubuntu Bionic (Debug + Tests)
|
|
||||||
if: tag IS NOT present
|
|
||||||
os: linux
|
|
||||||
services: docker
|
|
||||||
language: minimal
|
|
||||||
env: NAME=UbuntuBionic CACHE=$HOME/$NAME
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $CACHE
|
|
||||||
before_install: source .ci/travis-docker.sh --build
|
|
||||||
script: RUN --server --debug --test
|
|
||||||
|
|
||||||
- name: Ubuntu Bionic (Release)
|
|
||||||
if: (branch = master AND NOT type = pull_request) OR tag IS present
|
|
||||||
os: linux
|
|
||||||
services: docker
|
|
||||||
language: minimal
|
|
||||||
env: NAME=UbuntuBionic CACHE=$HOME/$NAME
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $CACHE
|
|
||||||
before_install: source .ci/travis-docker.sh --build
|
|
||||||
script: RUN --server --package $NAME --release
|
|
||||||
|
|
||||||
#Ubuntu Focal (on Docker)
|
|
||||||
- name: Ubuntu Focal (Compile)
|
|
||||||
if: tag IS NOT present
|
|
||||||
os: linux
|
|
||||||
services: docker
|
|
||||||
language: minimal
|
|
||||||
env: NAME=UbuntuFocal CACHE=$HOME/$NAME
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $CACHE
|
|
||||||
before_install: source .ci/travis-docker.sh --build
|
|
||||||
script: RUN --server
|
|
||||||
|
|
||||||
- name: Ubuntu Focal (Release)
|
|
||||||
if: (branch = master AND NOT type = pull_request) OR tag IS present
|
|
||||||
os: linux
|
|
||||||
services: docker
|
|
||||||
language: minimal
|
|
||||||
env: NAME=UbuntuFocal CACHE=$HOME/$NAME
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $CACHE
|
|
||||||
before_install: source .ci/travis-docker.sh --build
|
|
||||||
script: RUN --server --package $NAME --release
|
|
||||||
|
|
||||||
#Debian Buster (on Docker)
|
|
||||||
- name: Debian Buster (Compile)
|
|
||||||
if: tag IS NOT present
|
|
||||||
os: linux
|
|
||||||
services: docker
|
|
||||||
language: minimal
|
|
||||||
env: NAME=DebianBuster CACHE=$HOME/$NAME
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $CACHE
|
|
||||||
before_install: source .ci/travis-docker.sh --build
|
|
||||||
script: RUN --server
|
|
||||||
|
|
||||||
- name: Debian Buster (Release)
|
|
||||||
if: (branch = master AND NOT type = pull_request) OR tag IS present
|
|
||||||
os: linux
|
|
||||||
services: docker
|
|
||||||
language: minimal
|
|
||||||
env: NAME=DebianBuster CACHE=$HOME/$NAME
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $CACHE
|
|
||||||
before_install: source .ci/travis-docker.sh --build
|
|
||||||
script: RUN --server --package $NAME --release
|
|
||||||
|
|
||||||
|
|
||||||
#Fedora 32 (on Docker)
|
|
||||||
- name: Fedora 32 (Compile)
|
|
||||||
if: tag IS NOT present
|
|
||||||
services: docker
|
|
||||||
language: minimal
|
|
||||||
env: NAME=Fedora32 CACHE=$HOME/$NAME
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $CACHE
|
|
||||||
before_install: source .ci/travis-docker.sh --build
|
|
||||||
script: RUN --server
|
|
||||||
|
|
||||||
- name: Fedora 32 (Release)
|
|
||||||
if: (branch = master AND NOT type = pull_request) OR tag IS present
|
|
||||||
services: docker
|
|
||||||
language: minimal
|
|
||||||
env: NAME=Fedora32 CACHE=$HOME/$NAME
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $CACHE
|
|
||||||
before_install: source .ci/travis-docker.sh --build
|
|
||||||
script: RUN --server --package $NAME RPM --release
|
|
||||||
|
|
||||||
|
|
||||||
#macOS High Sierra
|
|
||||||
- name: macOS High Sierra (Debug)
|
|
||||||
if: tag IS NOT present
|
|
||||||
os: osx
|
|
||||||
osx_image: xcode10.1
|
|
||||||
cache:
|
|
||||||
- ccache
|
|
||||||
- directories:
|
|
||||||
- $HOME/Library/Caches/Homebrew
|
|
||||||
addons:
|
|
||||||
homebrew:
|
|
||||||
packages:
|
|
||||||
- ccache
|
|
||||||
- protobuf
|
|
||||||
- qt
|
|
||||||
- xz
|
|
||||||
update: true
|
|
||||||
script: bash ./.ci/travis-compile.sh --server --install --debug
|
|
||||||
before_cache:
|
|
||||||
- brew cleanup
|
|
||||||
|
|
||||||
- name: macOS High Sierra (Release)
|
|
||||||
if: (branch = master AND NOT type = pull_request) OR tag IS present
|
|
||||||
os: osx
|
|
||||||
osx_image: xcode10.1
|
|
||||||
env: OSX_VERSION=10.13
|
|
||||||
cache:
|
|
||||||
- ccache
|
|
||||||
- directories:
|
|
||||||
- $HOME/Library/Caches/Homebrew
|
|
||||||
addons:
|
|
||||||
homebrew:
|
|
||||||
packages:
|
|
||||||
- ccache
|
|
||||||
- protobuf
|
|
||||||
- qt
|
|
||||||
- xz
|
|
||||||
update: true
|
|
||||||
script: bash ./.ci/travis-compile.sh --server --package "macos$OSX_VERSION" --release
|
|
||||||
before_cache:
|
|
||||||
- brew cleanup
|
|
||||||
|
|
||||||
#macOS Catalina
|
|
||||||
- name: macOS Catalina (Debug)
|
|
||||||
if: tag IS NOT present
|
|
||||||
os: osx
|
|
||||||
osx_image: xcode11.6
|
|
||||||
cache:
|
|
||||||
- ccache
|
|
||||||
- directories:
|
|
||||||
- $HOME/Library/Caches/Homebrew
|
|
||||||
addons:
|
|
||||||
homebrew:
|
|
||||||
packages:
|
|
||||||
- ccache
|
|
||||||
- protobuf
|
|
||||||
- qt
|
|
||||||
- xz
|
|
||||||
update: true
|
|
||||||
script: bash ./.ci/travis-compile.sh --server --install --debug
|
|
||||||
before_cache:
|
|
||||||
- brew cleanup
|
|
||||||
|
|
||||||
- name: macOS Catalina (Release)
|
|
||||||
if: (branch = master AND NOT type = pull_request) OR tag IS present
|
|
||||||
os: osx
|
|
||||||
osx_image: xcode11.6
|
|
||||||
env: OSX_VERSION=10.15
|
|
||||||
cache:
|
|
||||||
- ccache
|
|
||||||
- directories:
|
|
||||||
- $HOME/Library/Caches/Homebrew
|
|
||||||
addons:
|
|
||||||
homebrew:
|
|
||||||
packages:
|
|
||||||
- ccache
|
|
||||||
- protobuf
|
|
||||||
- qt
|
|
||||||
- xz
|
|
||||||
update: true
|
|
||||||
script: bash ./.ci/travis-compile.sh --server --package "macos$OSX_VERSION" --release --zip
|
|
||||||
before_cache:
|
|
||||||
- brew cleanup
|
|
||||||
|
|
||||||
|
|
||||||
#Arch Linux (on Docker) (allow failures)
|
|
||||||
- name: Arch Linux (Debug)
|
|
||||||
if: tag IS NOT present
|
|
||||||
os: linux
|
|
||||||
services: docker
|
|
||||||
language: minimal
|
|
||||||
env: NAME=ArchLinux CACHE=$HOME/$NAME
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $CACHE
|
|
||||||
before_install: source .ci/travis-docker.sh --build
|
|
||||||
script: RUN --server --debug
|
|
||||||
|
|
||||||
allow_failures:
|
|
||||||
# Arch linux is always the latest version and by definition not stable
|
|
||||||
- name: Arch Linux (Debug)
|
|
||||||
# Report build completion even if optional builds are not completed
|
|
||||||
fast_finish: true
|
|
||||||
|
|
||||||
|
|
||||||
# Builds for pull requests skip the deployment step altogether
|
|
||||||
deploy:
|
|
||||||
# Deploy configuration for "beta" releases
|
|
||||||
- provider: releases
|
|
||||||
token:
|
|
||||||
secure: mLMF41q7xgOR1sjczsilEy7HQis2PkZCzhfOGbn/8FoOQnmmPOZjrsdhn06ZSl3SFsbfCLuClDYXAbFscQmdgjcGN5AmHV+JYfW650QEuQa/f4/lQFsVRtEqUA1O3FQ0OuRxdpCfJubZBdFVH8SbZ93GLC5zXJbkWQNq+xCX1fU=
|
|
||||||
name: "Cockatrice $TRAVIS_TAG"
|
|
||||||
release_notes: "Beta release of Cockatrice"
|
|
||||||
skip_cleanup: true
|
|
||||||
file_glob: true
|
|
||||||
file: "build/Cockatrice-*"
|
|
||||||
overwrite: true
|
|
||||||
draft: false
|
|
||||||
prerelease: true
|
|
||||||
on:
|
|
||||||
tags: true
|
|
||||||
repo: Cockatrice/Cockatrice
|
|
||||||
condition: $TRAVIS_TAG =~ ([0-9]|[1-9][0-9])(\.([0-9]|[1-9][0-9])){2}-beta(\.([2-9]|[1-9][0-9]))?$ # regex to match semver naming convention for beta pre-releases
|
|
||||||
|
|
||||||
# Deploy configuration for "stable" releases
|
|
||||||
- provider: releases
|
|
||||||
token:
|
|
||||||
secure: mLMF41q7xgOR1sjczsilEy7HQis2PkZCzhfOGbn/8FoOQnmmPOZjrsdhn06ZSl3SFsbfCLuClDYXAbFscQmdgjcGN5AmHV+JYfW650QEuQa/f4/lQFsVRtEqUA1O3FQ0OuRxdpCfJubZBdFVH8SbZ93GLC5zXJbkWQNq+xCX1fU=
|
|
||||||
skip_cleanup: true
|
|
||||||
file_glob: true
|
|
||||||
file: "build/Cockatrice-*"
|
|
||||||
overwrite: true
|
|
||||||
draft: false
|
|
||||||
prerelease: false
|
|
||||||
on:
|
|
||||||
tags: true
|
|
||||||
repo: Cockatrice/Cockatrice
|
|
||||||
condition: $TRAVIS_TAG =~ ([0-9]|[1-9][0-9])(\.([0-9]|[1-9][0-9])){2}$ # regex to match semver naming convention for stable full releases
|
|
||||||
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
email: false
|
|
||||||
webhooks:
|
|
||||||
urls:
|
|
||||||
- https://webhooks.gitter.im/e/d94969c3b01b22cbdcb7
|
|
||||||
on_success: change
|
|
||||||
on_failure: change
|
|
||||||
on_start: never
|
|
||||||
on_cancel: change
|
|
||||||
on_error: change
|
|
||||||
|
|
||||||
|
|
||||||
# Announcements of build image updates: https://docs.travis-ci.com/user/build-environment-updates/
|
|
||||||
# For precise versions of preinstalled tools on the VM, check “Build system information” in the build log!
|
|
||||||
# Official validator for ".travis.yml" config file: https://yaml.travis-ci.org
|
|
||||||
# Official Travis CI Build Config Explorer: https://config.travis-ci.com/explore
|
|
||||||
# Travis CI config documentation: https://docs.travis-ci.com/user/customizing-the-build
|
|
|
@ -79,7 +79,7 @@ Cockatrice uses Transifex for translations. You can help us bring Cockatrice and
|
||||||
Check out our [Translator FAQ](https://github.com/Cockatrice/Cockatrice/wiki/Translation-FAQ) for more information about contributing!<br>
|
Check out our [Translator FAQ](https://github.com/Cockatrice/Cockatrice/wiki/Translation-FAQ) for more information about contributing!<br>
|
||||||
|
|
||||||
|
|
||||||
# Build [](https://travis-ci.org/Cockatrice/Cockatrice) [](https://ci.appveyor.com/project/ZeldaZach/cockatrice/branch/master) <!-- link to zachs appveyor not correct yet -->
|
# Build  /badge.svg) [](https://ci.appveyor.com/project/ZeldaZach/cockatrice/branch/master) <!-- link to zachs appveyor not correct yet -->
|
||||||
|
|
||||||
**Detailed compiling instructions are on the Cockatrice wiki under [Compiling Cockatrice](https://github.com/Cockatrice/Cockatrice/wiki/Compiling-Cockatrice)**
|
**Detailed compiling instructions are on the Cockatrice wiki under [Compiling Cockatrice](https://github.com/Cockatrice/Cockatrice/wiki/Compiling-Cockatrice)**
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue