mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-01-08 19:33:22 -08:00
add github actions (#4164)
This commit is contained in:
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
|
||||
Reference in New Issue
Block a user