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
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue