name: Build on Linux (Docker) on: push: branches: - master 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