name: Build Desktop on: push: branches: - master paths-ignore: - '**.md' - 'webclient/**' - '.github/workflows/web-*.yml' tags: - '*' pull_request: paths-ignore: - '**.md' - 'webclient/**' - '.github/workflows/web-*.yml' jobs: configure: name: Configure runs-on: ubuntu-latest outputs: tag: ${{steps.configure.outputs.tag}} sha: ${{steps.configure.outputs.sha}} upload_url: ${{steps.create_release.outputs.upload_url}} steps: - name: Cancel previous runs uses: styfle/cancel-workflow-action@0.9.1 with: access_token: ${{github.token}} # needs other token https://github.com/styfle/cancel-workflow-action/issues/7 - name: Configure id: configure shell: bash run: | tag_regex='^refs/tags/' if [[ $GITHUB_EVENT_NAME == pull-request ]]; then # pull request sha="${{github.event.pull_request.head.sha}}" elif [[ $GITHUB_REF =~ $tag_regex ]]; then # release sha="$GITHUB_SHA" tag="${GITHUB_REF/refs\/tags\//}" echo "::set-output name=tag::$tag" else # push to branch sha="$GITHUB_SHA" fi echo "::set-output name=sha::$sha" - name: Checkout if: steps.configure.outputs.tag != null uses: actions/checkout@v3 with: fetch-depth: 0 - name: Prepare release parameters id: prepare if: steps.configure.outputs.tag != null shell: bash env: TAG: ${{steps.configure.outputs.tag}} run: .ci/prep_release.sh - name: Create release if: steps.configure.outputs.tag != null id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{github.token}} with: tag_name: ${{github.ref}} release_name: ${{steps.prepare.outputs.title}} body_path: ${{steps.prepare.outputs.body_path}} draft: true prerelease: ${{steps.prepare.outputs.is_beta == 'yes'}} build-linux: strategy: fail-fast: false matrix: # these names correspond to the files in .ci/$distro include: - distro: ArchLinux package: skip # we are packaged in arch already allow-failure: yes - distro: Debian10 package: DEB test: skip # running tests on all distros is superfluous - distro: Debian11 package: DEB - distro: Fedora35 package: RPM test: skip - distro: Fedora36 package: RPM - distro: UbuntuBionic package: DEB - distro: UbuntuFocal package: DEB test: skip # UbuntuFocal has a broken qt for debug builds - distro: UbuntuJammy package: DEB name: ${{matrix.distro}} needs: configure 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? # cache size over the entire repo is 10Gi link: # https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy CCACHE_SIZE: 200M steps: - name: Checkout uses: actions/checkout@v3 - 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@v3 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 - name: Build debug and test if: matrix.test != 'skip' shell: bash env: distro: '${{matrix.distro}}' run: | source .ci/docker.sh RUN --server --debug --test --ccache "$CCACHE_SIZE" --parallel 2 - name: Build release package id: package if: matrix.package != 'skip' shell: bash env: suffix: '-${{matrix.distro}}' type: '${{matrix.package}}' distro: '${{matrix.distro}}' run: | source .ci/docker.sh RUN --server --release --package "$type" --suffix "$suffix" \ --ccache "$CCACHE_SIZE" --parallel 2 - name: Upload artifact if: matrix.package != 'skip' uses: actions/upload-artifact@v3 with: name: ${{matrix.distro}}-package path: ${{steps.package.outputs.path}} if-no-files-found: error - name: Upload to release if: matrix.package != 'skip' && needs.configure.outputs.tag != null uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{github.token}} with: upload_url: ${{needs.configure.outputs.upload_url}} asset_path: ${{steps.package.outputs.path}} asset_name: ${{steps.package.outputs.name}} asset_content_type: application/octet-stream build-macos: strategy: fail-fast: false matrix: include: - target: Debug # tests only os: macos-latest xcode: 12.5.1 qt_version: 6 type: Debug do_tests: 1 - target: 10.14_Mojave os: macos-10.15 # runs on Catalina xcode: 10.3 # allows compatibility with macOS 10.14 qt_version: 5 type: Release # do_tests: 1 # tests do not work on qt5? make_package: 1 - target: 10.15_Catalina os: macos-10.15 xcode: 12.4 qt_version: 6 type: Release do_tests: 1 make_package: 1 - target: 11_Big_Sur os: macos-11 xcode: 13.2 qt_version: 6 type: Release do_tests: 1 make_package: 1 # - target: 12_Monterey # os: macos-12 # xcode: 13.3 # qt_version: 6 # type: Release # do_tests: 1 # make_package: 1 name: macOS ${{matrix.target}} needs: configure runs-on: ${{matrix.os}} continue-on-error: ${{matrix.allow-failure == 'yes'}} env: DEVELOPER_DIR: /Applications/Xcode_${{matrix.xcode}}.app/Contents/Developer steps: - name: Checkout uses: actions/checkout@v3 - name: Install dependencies using homebrew shell: bash # cmake cannot find the mysql connector # neither of these works: mariadb-connector-c mysql-connector-c++ env: qt_version: 'qt@${{matrix.qt_version}}' run: | brew update brew install protobuf brew install "$qt_version" --force-bottle - name: Build on Xcode ${{matrix.xcode}} shell: bash id: build env: BUILDTYPE: '${{matrix.type}}' MAKE_TEST: '${{matrix.do_tests}}' MAKE_PACKAGE: '${{matrix.make_package}}' PACKAGE_SUFFIX: '-macOS-${{matrix.target}}' # set QTDIR to find qt5, qt6 can be found without this QTDIR: '/usr/local/opt/qt5' # Mac machines actually have 3 cores run: .ci/compile.sh --server --parallel 3 - name: Upload artifact if: matrix.make_package uses: actions/upload-artifact@v3 with: name: macOS-${{matrix.target}}-dmg path: ${{steps.build.outputs.path}} if-no-files-found: error - name: Upload to release if: matrix.make_package && needs.configure.outputs.tag != null uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{github.token}} with: upload_url: ${{needs.configure.outputs.upload_url}} asset_path: ${{steps.build.outputs.path}} asset_name: ${{steps.build.outputs.name}} asset_content_type: application/octet-stream build-windows: strategy: fail-fast: false matrix: include: - target: Win-32bit bit: 32 arch: x86 cmake_generator_platform: Win32 qt_version: 5.15.* qt_arch: msvc2019 qt_tools: "tools_openssl_x86" - target: Win7+-64bit bit: 64 arch: x64 cmake_generator_platform: x64 qt_version: 5.15.* qt_arch: msvc2019_64 qt_tools: "tools_openssl_x64" - target: Win10+-64bit bit: 64 arch: x64 cmake_generator_platform: x64 qt_version: 6.3.* qt_arch: msvc2019_64 qt_tools: "tools_openssl_x64" qt_modules: "qtmultimedia qtwebsockets" name: ${{matrix.target}} needs: configure runs-on: windows-2019 env: CMAKE_GENERATOR: 'Visual Studio 16 2019' steps: - name: Add msbuild to PATH id: add-msbuild uses: microsoft/setup-msbuild@v1.1 - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Install Qt ${{matrix.qt_version}} for ${{matrix.target}} uses: jurplel/install-qt-action@v3 with: cache: true setup-python: false version: ${{matrix.qt_version}} arch: win${{matrix.bit}}_${{matrix.qt_arch}} tools: ${{matrix.qt_tools}} modules: ${{matrix.qt_modules}} - name: Run vcpkg uses: lukka/run-vcpkg@v10.2 with: runVcpkgInstall: true appendedCacheKey: ${{matrix.bit}}-bit env: VCPKG_DEFAULT_TRIPLET: '${{matrix.arch}}-windows' VCPKG_DISABLE_METRICS: 1 - name: Build Cockatrice id: build shell: bash env: PACKAGE_SUFFIX: '-${{matrix.target}}' CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}' CMAKE_GENERATOR_PLATFORM: '${{matrix.cmake_generator_platform}}' QTDIR: '${{github.workspace}}\Qt\${{matrix.qt_version}}\win${{matrix.bit}}_${{matrix.qt_arch}}' run: .ci/compile.sh --server --release --test --package --parallel 2 - name: Upload artifact uses: actions/upload-artifact@v3 with: name: ${{matrix.target}}-installer path: ${{steps.build.outputs.path}} if-no-files-found: error - name: Upload to release if: needs.configure.outputs.tag != null uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{github.token}} with: upload_url: ${{needs.configure.outputs.upload_url}} asset_path: ${{steps.build.outputs.path}} asset_name: ${{steps.build.outputs.name}} asset_content_type: application/octet-stream