mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
add github actions (#4164)
This commit is contained in:
parent
45d838a0b3
commit
4aaedf64d2
11 changed files with 425 additions and 334 deletions
95
.github/CONTRIBUTING.md
vendored
95
.github/CONTRIBUTING.md
vendored
|
|
@ -39,11 +39,10 @@ albeit slightly less active.
|
|||
|
||||
### Formatting and continuous integration (CI) ###
|
||||
|
||||
We use a separate job on Travis CI to check your code for formatting issues. If
|
||||
your pull request was rejected, you can check the output on their website.
|
||||
To do so, click on <kbd>Details</kbd> next to the failed Travis CI build at the
|
||||
bottom of your PR on the GitHub page, on the Travis page then click on our "Linting"
|
||||
build (the fastest one on the very top of the list) to see the complete log.
|
||||
We use a separate job on the CI to check your code for formatting issues. If
|
||||
your pull request failed the test, you can check the output on the checks tab.
|
||||
It's the first job called "linter", you can click the "Run clangify" step to
|
||||
see the output of the test.
|
||||
|
||||
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
|
||||
reading. Please see [this section](#formatting) below for full information on our
|
||||
formatting guidelines.
|
||||
The CONTRIBUTING.md file mentioned in that message is the file you are
|
||||
currently reading. Please see [this section](#formatting) below for full
|
||||
information on our formatting guidelines.
|
||||
|
||||
### Compatibility ###
|
||||
|
||||
|
|
@ -272,11 +271,11 @@ https://github.com/Cockatrice/Cockatrice/wiki/Client-server-protocol)
|
|||
# Reviewing Pull Requests #
|
||||
|
||||
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
|
||||
).
|
||||
Your code will then be automatically compiled by Travis CI for Linux and macOS,
|
||||
and by Appveyor for Windows. Additionally Travis CI will perform a [Linting
|
||||
Your code will then be automatically compiled by GitHub actions for Linux and
|
||||
macOS, and by Appveyor for Windows. Additionally GitHub will perform a [Linting
|
||||
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
|
||||
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:
|
||||
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;
|
||||
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;
|
||||
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 #
|
||||
|
||||
### Publishing A New Beta Release ###
|
||||
### Publishing A New Release ###
|
||||
|
||||
Travis and AppVeyor have been configured to upload files to GitHub Releases
|
||||
whenever a <kbd>tag</kbd> is pushed.<br>
|
||||
Usually, tags are created through publishing a (pre-)release, but there's a way
|
||||
around that.
|
||||
GitHub Actions will upload binaries (Linux & macOS) when any release is published
|
||||
on GitHub.<br>
|
||||
AppVeyor is configured to upload binaries (Windows) to GitHub Releases whenever a
|
||||
<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
|
||||
cd $COCKATRICE_REPO
|
||||
git checkout master
|
||||
git remote update -p
|
||||
git pull
|
||||
git tag $TAG_NAME
|
||||
git push upstream $TAG_NAME
|
||||
git push $UPSTREAM $TAG_NAME
|
||||
```
|
||||
You should define the variables as such:
|
||||
```
|
||||
upstream - git@github.com:Cockatrice/Cockatrice.git
|
||||
$COCKATRICE_REPO - /Location/of/repository/cockatrice.git
|
||||
`$TAG_NAME` should be:
|
||||
`$UPSTREAM` - the remote for git@github.com:Cockatrice/Cockatrice.git
|
||||
`$TAG_NAME` should be formatted as:
|
||||
- `YYYY-MM-DD-Release-MAJ.MIN.PATCH` for **stable releases**
|
||||
- `YYYY-MM-DD-Development-MAJ.MIN.PATCH-beta.X` for **beta releases**<br>
|
||||
With *MAJ.MIN.PATCH* being the NEXT release version!
|
||||
```
|
||||
|
||||
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
|
||||
tags (releases) that you create will be marked as a "Pre-release". The
|
||||
`/latest` URL will not be impacted (for stable release downloads) so that's
|
||||
good.
|
||||
which will then lead to the upload of binaries by Appveyor.
|
||||
If you use a SemVer tag including "beta", the release that will be created at GitHub
|
||||
by the CI will be marked as a "Pre-release".
|
||||
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
|
||||
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
|
||||
```
|
||||
|
||||
**NOTE:** Unfortunately, due to the method of how Travis and AppVeyor work, to
|
||||
publish a stable release you will need to make a copy of the release notes
|
||||
locally and then paste them into the GitHub GUI once the binaries have been
|
||||
uploaded by them. These CI services will automatically overwrite the name of
|
||||
the release (to "Cockatrice $TAG_NAME"), the status of the release (to
|
||||
"Pre-release"), and the release body (to "Beta build of Cockatrice").
|
||||
**NOTE:** Unfortunately, due to the method of how AppVeyor works, to publish a
|
||||
stable release you will need to make a copy of the drafted release notes locally before
|
||||
pushing the tag, and paste them back into the GitHub releases GUI once the binaries have
|
||||
been uploaded by the CI.
|
||||
<br>
|
||||
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](
|
||||
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
|
||||
numbers coming from the tag title, it's good practice to keep them aligned with
|
||||
the real ones.
|
||||
numbers coming from the tag title, it's good practice to increment the ones at CMake
|
||||
after every full release to stress that master is ahead of the last stable release.
|
||||
The preferred flow of operation is:
|
||||
* just before a release, update the version number in CMakeLists.txt to "next
|
||||
release version";
|
||||
* tag the release following the previously described syntax in order to get it
|
||||
built by CI;
|
||||
* wait for CI to upload the binaries, double check if everything is in order
|
||||
* after the release is complete, update the version number again to "next
|
||||
targeted beta version", typically increasing `PROJECT_VERSION_PATCH` by one.
|
||||
* Just before a release, make sure the version number in CMakeLists.txt is set
|
||||
to the same release version you are about to tag.
|
||||
* Tag the release following the previously described syntax in order to get it correctly
|
||||
built and deployed by CI.
|
||||
* Wait for them to upload all binaries, then double check if everything is in order.
|
||||
* After the release is complete, update the CMake version number again to the next
|
||||
targeted beta version, typically increasing `PROJECT_VERSION_PATCH` by one.
|
||||
|
||||
**NOTE 3:** When releasing a new stable version, all the previous beta versions
|
||||
should be deleted. This is needed for Cockatrice to update users of the "beta"
|
||||
release channel to the latest version like other users.
|
||||
**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"
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue