From cb1166cab652538eef7017d0cf4d1d573c776820 Mon Sep 17 00:00:00 2001 From: iphydf Date: Wed, 12 Feb 2025 09:52:41 +0000 Subject: [PATCH] chore: Use reusable deploy workflows. --- .github/workflows/build-test-deploy.yaml | 1138 ++++++++++------------ CMakeLists.txt | 1 + cmake/Installation.cmake | 53 +- platform/appimage/build.sh | 73 +- 4 files changed, 600 insertions(+), 665 deletions(-) diff --git a/.github/workflows/build-test-deploy.yaml b/.github/workflows/build-test-deploy.yaml index fa65211de4..f764859adb 100644 --- a/.github/workflows/build-test-deploy.yaml +++ b/.github/workflows/build-test-deploy.yaml @@ -87,17 +87,9 @@ jobs: --upstream origin --dryrun - update-nightly-tag: - name: Update nightly release tag - needs: [validate-pr] - runs-on: ubuntu-24.04 - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - - name: Move nightly tag to head for nightly release - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - run: git tag -f nightly && git push origin nightly -f + prepare: + name: Prepare + uses: iphydf/debugtox/.github/workflows/deploy-prepare.yml@appimage ################################################################################################ # Static analysis and other checks @@ -246,624 +238,528 @@ jobs: # Build, test, and deploy jobs (PR and push) ################################################################################################ - build-appimage: - name: AppImage on Alpine - runs-on: ubuntu-24.04 - needs: [update-nightly-tag] - strategy: - matrix: - features: [full] - build_type: [Release] - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Cache compiler output - uses: actions/cache@v4 - with: - path: ".cache/ccache" - key: ${{ github.job }}-ccache - - name: Run build - run: docker compose run --rm -e GITHUB_REPOSITORY="$GITHUB_REPOSITORY" -e GITHUB_REF="$GITHUB_REF" alpine-appimage platform/appimage/build.sh --src-dir /qtox - - name: Upload AppImage - uses: actions/upload-artifact@v4 - with: - name: qTox-${{ github.sha }}-x86_64-AppImage - path: | - qTox-*.AppImage - qTox-*.AppImage.zsync - - name: Get tag name for AppImage release file name - if: contains(github.ref, 'refs/tags/v') - id: get_version - run: | - VERSION="$(echo "$GITHUB_REF" | cut -d / -f 3)" - echo "release_appimage=qTox-$VERSION-x86_64.AppImage" >>$GITHUB_OUTPUT - - name: Rename AppImage for release upload - if: contains(github.ref, 'refs/tags/v') - run: | - cp qTox-*-x86_64.AppImage "${{ steps.get_version.outputs.release_appimage }}" - sha256sum "${{ steps.get_version.outputs.release_appimage }}" > "${{ steps.get_version.outputs.release_appimage }}.sha256" - cp qTox-*-x86_64.AppImage.zsync "${{ steps.get_version.outputs.release_appimage }}.zsync" - - name: Upload to versioned release - if: contains(github.ref, 'refs/tags/v') - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - draft: true - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "${{ steps.get_version.outputs.release_appimage }},${{ steps.get_version.outputs.release_appimage }}.sha256,${{ steps.get_version.outputs.release_appimage }}.zsync" - - name: Rename AppImage for nightly upload - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - run: | - cp qTox-*-x86_64.AppImage qTox-nightly-x86_64.AppImage - sha256sum qTox-nightly-x86_64.AppImage > qTox-nightly-x86_64.AppImage.sha256 - cp qTox-*-x86_64.AppImage.zsync qTox-nightly-x86_64.AppImage.zsync - - name: Upload to nightly release - uses: ncipollo/release-action@v1 - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - with: - allowUpdates: true - tag: nightly - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - prerelease: true - replacesArtifacts: true - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "qTox-nightly-x86_64.AppImage,qTox-nightly-x86_64.AppImage.sha256,qTox-nightly-x86_64.AppImage.zsync" + appimage: + name: AppImage + uses: iphydf/debugtox/.github/workflows/deploy-appimage.yml@appimage + needs: [prepare] + with: + project-name: qTox + smoke-test: .ci-scripts/smoke-test.sh + test-files: | + .ci-scripts + test/resources/profile - test-appimage: - name: Test AppImage - needs: [build-appimage] - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v4 - with: - # Fetch tags if we're not already in a tag build. - fetch-tags: ${{ !contains(github.ref, 'refs/tags/v') }} - sparse-checkout: | - .ci-scripts - test/resources/profile - - name: Download artifact from AppImage - uses: actions/download-artifact@v4 - with: - name: qTox-${{ github.sha }}-x86_64-AppImage - - name: Run AppImage - run: | - chmod +x qTox-*.AppImage - .ci-scripts/smoke-test.sh xvfb-run --auto-servernum ./qTox-*.AppImage - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - QTOX_SCREENSHOT: qtox-appimage.png - - name: Upload screenshot artifact - uses: actions/upload-artifact@v4 - with: - name: qtox-appimage.png - path: qtox-appimage.png - - name: Upload screenshot to nightly release - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - tag: nightly - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - prerelease: true - replacesArtifacts: true - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "qtox-appimage.png" - - - build-android: - name: Android - needs: [update-nightly-tag] - runs-on: ubuntu-24.04 - permissions: - contents: write - strategy: - matrix: - arch: [armeabi-v7a, arm64-v8a] - build_type: [Debug, Release] - version: [6.2.4, 6.8.1] - exclude: - - arch: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 'armeabi-v7a' }} - - build_type: ${{ (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') || contains(github.ref, 'refs/tags/v')) && 'Debug' }} - - version: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && '6.8.1' }} - steps: - - name: Compute values for remaining steps - id: computed - run: | - ARTIFACT_TYPE="$(echo '${{ matrix.build_type }}' | tr '[:upper:]' '[:lower:]')" - echo "artifact_type=$ARTIFACT_TYPE" >>$GITHUB_OUTPUT - if [ "${{ matrix.version }}" == "6.2.4" ]; then - SUFFIX="-android7" - echo "built_apk=_build/android-build/build/outputs/apk/debug/android-build-debug.apk" >>$GITHUB_OUTPUT - else - SUFFIX="" - echo "built_apk=_build/android-build/build/outputs/apk/$ARTIFACT_TYPE/android-build-$ARTIFACT_TYPE-signed.apk" >>$GITHUB_OUTPUT - fi - echo "suffix=$SUFFIX" >>$GITHUB_OUTPUT - echo "nightly_apk=qTox-nightly-${{ matrix.arch }}-$ARTIFACT_TYPE$SUFFIX.apk" >>$GITHUB_OUTPUT - - uses: actions/checkout@v4 - - name: Cache compiler output - uses: actions/cache@v4 - with: - path: ".cache/ccache" - key: ${{ github.job }}-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.version }}-ccache - - name: Run build - run: docker compose run --rm "android_builder.${{ matrix.arch }}.${{ steps.computed.outputs.artifact_type }}_${{ matrix.version }}" platform/android/cross-compile/build.sh --arch "${{ matrix.arch }}" --build-type "${{ matrix.build_type }}" - - name: Upload Android apk - uses: actions/upload-artifact@v4 - with: - name: qTox-${{ github.sha }}-${{ matrix.arch }}-${{ steps.computed.outputs.artifact_type }}${{ steps.computed.outputs.suffix }}.apk - path: ${{ steps.computed.outputs.built_apk }} - - name: Get tag name for Android release file name - if: contains(github.ref, 'refs/tags/v') - id: get_version - run: | - VERSION="$(echo "$GITHUB_REF" | cut -d / -f 3)" - echo "release_apk=qTox-$VERSION-${{ matrix.arch }}-${{ steps.computed.outputs.artifact_type }}${{ steps.computed.outputs.suffix }}.apk" >>$GITHUB_OUTPUT - - name: Rename Android APK for release upload - if: contains(github.ref, 'refs/tags/v') - run: | - cp "${{ steps.computed.outputs.built_apk }}" "${{ steps.get_version.outputs.release_apk }}" - sha256sum "${{ steps.get_version.outputs.release_apk }}" > "${{ steps.get_version.outputs.release_apk }}.sha256" - - name: Upload to versioned release - if: contains(github.ref, 'refs/tags/v') - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - draft: true - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "${{ steps.get_version.outputs.release_apk }},${{ steps.get_version.outputs.release_apk }}.sha256" - - name: Rename Android APK for nightly upload - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - run: | - cp "${{ steps.computed.outputs.built_apk }}" "${{ steps.computed.outputs.nightly_apk }}" - sha256sum "${{ steps.computed.outputs.nightly_apk }}" > "${{ steps.computed.outputs.nightly_apk }}.sha256" - - name: Upload to nightly release - uses: ncipollo/release-action@v1 - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - with: - allowUpdates: true - tag: nightly - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - prerelease: true - replacesArtifacts: true - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "${{ steps.computed.outputs.nightly_apk }},${{ steps.computed.outputs.nightly_apk }}.sha256" + # build-android: + # name: Android + # needs: [prepare] + # runs-on: ubuntu-24.04 + # permissions: + # contents: write + # strategy: + # matrix: + # arch: [armeabi-v7a, arm64-v8a] + # build_type: [Debug, Release] + # version: [6.2.4, 6.8.1] + # exclude: + # - arch: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 'armeabi-v7a' }} + # - build_type: ${{ (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') || contains(github.ref, 'refs/tags/v')) && 'Debug' }} + # - version: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && '6.8.1' }} + # steps: + # - name: Compute values for remaining steps + # id: computed + # run: | + # ARTIFACT_TYPE="$(echo '${{ matrix.build_type }}' | tr '[:upper:]' '[:lower:]')" + # echo "artifact_type=$ARTIFACT_TYPE" >>$GITHUB_OUTPUT + # if [ "${{ matrix.version }}" == "6.2.4" ]; then + # SUFFIX="-android7" + # echo "built_apk=_build/android-build/build/outputs/apk/debug/android-build-debug.apk" >>$GITHUB_OUTPUT + # else + # SUFFIX="" + # echo "built_apk=_build/android-build/build/outputs/apk/$ARTIFACT_TYPE/android-build-$ARTIFACT_TYPE-signed.apk" >>$GITHUB_OUTPUT + # fi + # echo "suffix=$SUFFIX" >>$GITHUB_OUTPUT + # echo "nightly_apk=qTox-nightly-${{ matrix.arch }}-$ARTIFACT_TYPE$SUFFIX.apk" >>$GITHUB_OUTPUT + # - uses: actions/checkout@v4 + # - name: Cache compiler output + # uses: actions/cache@v4 + # with: + # path: ".cache/ccache" + # key: ${{ github.job }}-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.version }}-ccache + # - name: Run build + # run: docker compose run --rm "android_builder.${{ matrix.arch }}.${{ steps.computed.outputs.artifact_type }}_${{ matrix.version }}" platform/android/cross-compile/build.sh --arch "${{ matrix.arch }}" --build-type "${{ matrix.build_type }}" + # - name: Upload Android apk + # uses: actions/upload-artifact@v4 + # with: + # name: qTox-${{ github.sha }}-${{ matrix.arch }}-${{ steps.computed.outputs.artifact_type }}${{ steps.computed.outputs.suffix }}.apk + # path: ${{ steps.computed.outputs.built_apk }} + # - name: Get tag name for Android release file name + # if: contains(github.ref, 'refs/tags/v') + # id: get_version + # run: | + # VERSION="$(echo "$GITHUB_REF" | cut -d / -f 3)" + # echo "release_apk=qTox-$VERSION-${{ matrix.arch }}-${{ steps.computed.outputs.artifact_type }}${{ steps.computed.outputs.suffix }}.apk" >>$GITHUB_OUTPUT + # - name: Rename Android APK for release upload + # if: contains(github.ref, 'refs/tags/v') + # run: | + # cp "${{ steps.computed.outputs.built_apk }}" "${{ steps.get_version.outputs.release_apk }}" + # sha256sum "${{ steps.get_version.outputs.release_apk }}" > "${{ steps.get_version.outputs.release_apk }}.sha256" + # - name: Upload to versioned release + # if: contains(github.ref, 'refs/tags/v') + # uses: ncipollo/release-action@v1 + # with: + # allowUpdates: true + # draft: true + # token: ${{ secrets.GITHUB_TOKEN }} + # artifacts: "${{ steps.get_version.outputs.release_apk }},${{ steps.get_version.outputs.release_apk }}.sha256" + # - name: Rename Android APK for nightly upload + # if: github.event_name == 'push' && github.ref == 'refs/heads/master' + # run: | + # cp "${{ steps.computed.outputs.built_apk }}" "${{ steps.computed.outputs.nightly_apk }}" + # sha256sum "${{ steps.computed.outputs.nightly_apk }}" > "${{ steps.computed.outputs.nightly_apk }}.sha256" + # - name: Upload to nightly release + # uses: ncipollo/release-action@v1 + # if: github.event_name == 'push' && github.ref == 'refs/heads/master' + # with: + # allowUpdates: true + # tag: nightly + # omitBodyDuringUpdate: true + # omitNameDuringUpdate: true + # prerelease: true + # replacesArtifacts: true + # token: ${{ secrets.GITHUB_TOKEN }} + # artifacts: "${{ steps.computed.outputs.nightly_apk }},${{ steps.computed.outputs.nightly_apk }}.sha256" - build-flatpak: - name: Flatpak - needs: [update-nightly-tag] - runs-on: ubuntu-24.04 - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Cache flatpak-builder cache (except ccache) - uses: actions/cache@v4 - with: - path: | - .flatpak-builder/cache - .flatpak-builder/checksums - .flatpak-builder/downloads - key: ${{ github.job }}-builder - - name: Cache flatpak-builder cache (only ccache) - uses: actions/cache@v4 - with: - path: ".flatpak-builder/ccache" - key: ${{ github.job }}-ccache - - name: Get tag name for flatpak release file name - if: contains(github.ref, 'refs/tags/v') - id: get_version - run: | - VERSION="$(echo "$GITHUB_REF" | cut -d / -f 3)" - echo "version_tag=$VERSION" >>$GITHUB_OUTPUT - echo "release_flatpak=qTox-$VERSION.x86_64.flatpak" >>$GITHUB_OUTPUT - - name: Point flathub descriptor at the release tag - if: contains(github.ref, 'refs/tags/v') - run: platform/flatpak/localize_flathub_descriptor.py - --flathub-manifest platform/flatpak/io.github.qtox.qTox.json - --output platform/flatpak/io.github.qtox.qTox.json - --git-tag "${{ steps.get_version.outputs.version_tag }}" - - name: Run build - run: docker compose run --rm flatpak platform/flatpak/build.sh - - name: Upload flatpak - uses: actions/upload-artifact@v4 - with: - name: qTox-${{ github.sha }}.x86_64.flatpak - path: qtox.flatpak - - name: Rename flatpak for release upload - if: contains(github.ref, 'refs/tags/v') - run: | - cp qtox.flatpak "${{ steps.get_version.outputs.release_flatpak }}" - sha256sum "${{ steps.get_version.outputs.release_flatpak }}" > "${{ steps.get_version.outputs.release_flatpak }}.sha256" - - name: Upload to versioned release - if: contains(github.ref, 'refs/tags/v') - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - draft: true - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "${{ steps.get_version.outputs.release_flatpak }},${{ steps.get_version.outputs.release_flatpak }}.sha256" - - name: Rename flatpak for nightly upload - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - run: | - cp qtox.flatpak qTox-nightly.flatpak - sha256sum qTox-nightly.flatpak > qTox-nightly.flatpak.sha256 - - name: Upload to nightly release - uses: ncipollo/release-action@v1 - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - with: - allowUpdates: true - tag: nightly - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - prerelease: true - replacesArtifacts: true - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "qTox-nightly.flatpak,qTox-nightly.flatpak.sha256" + # build-flatpak: + # name: Flatpak + # needs: [prepare] + # runs-on: ubuntu-24.04 + # permissions: + # contents: write + # steps: + # - uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # - name: Cache flatpak-builder cache (except ccache) + # uses: actions/cache@v4 + # with: + # path: | + # .flatpak-builder/cache + # .flatpak-builder/checksums + # .flatpak-builder/downloads + # key: ${{ github.job }}-builder + # - name: Cache flatpak-builder cache (only ccache) + # uses: actions/cache@v4 + # with: + # path: ".flatpak-builder/ccache" + # key: ${{ github.job }}-ccache + # - name: Get tag name for flatpak release file name + # if: contains(github.ref, 'refs/tags/v') + # id: get_version + # run: | + # VERSION="$(echo "$GITHUB_REF" | cut -d / -f 3)" + # echo "version_tag=$VERSION" >>$GITHUB_OUTPUT + # echo "release_flatpak=qTox-$VERSION.x86_64.flatpak" >>$GITHUB_OUTPUT + # - name: Point flathub descriptor at the release tag + # if: contains(github.ref, 'refs/tags/v') + # run: platform/flatpak/localize_flathub_descriptor.py + # --flathub-manifest platform/flatpak/io.github.qtox.qTox.json + # --output platform/flatpak/io.github.qtox.qTox.json + # --git-tag "${{ steps.get_version.outputs.version_tag }}" + # - name: Run build + # run: docker compose run --rm flatpak platform/flatpak/build.sh + # - name: Upload flatpak + # uses: actions/upload-artifact@v4 + # with: + # name: qTox-${{ github.sha }}.x86_64.flatpak + # path: qtox.flatpak + # - name: Rename flatpak for release upload + # if: contains(github.ref, 'refs/tags/v') + # run: | + # cp qtox.flatpak "${{ steps.get_version.outputs.release_flatpak }}" + # sha256sum "${{ steps.get_version.outputs.release_flatpak }}" > "${{ steps.get_version.outputs.release_flatpak }}.sha256" + # - name: Upload to versioned release + # if: contains(github.ref, 'refs/tags/v') + # uses: ncipollo/release-action@v1 + # with: + # allowUpdates: true + # draft: true + # token: ${{ secrets.GITHUB_TOKEN }} + # artifacts: "${{ steps.get_version.outputs.release_flatpak }},${{ steps.get_version.outputs.release_flatpak }}.sha256" + # - name: Rename flatpak for nightly upload + # if: github.event_name == 'push' && github.ref == 'refs/heads/master' + # run: | + # cp qtox.flatpak qTox-nightly.flatpak + # sha256sum qTox-nightly.flatpak > qTox-nightly.flatpak.sha256 + # - name: Upload to nightly release + # uses: ncipollo/release-action@v1 + # if: github.event_name == 'push' && github.ref == 'refs/heads/master' + # with: + # allowUpdates: true + # tag: nightly + # omitBodyDuringUpdate: true + # omitNameDuringUpdate: true + # prerelease: true + # replacesArtifacts: true + # token: ${{ secrets.GITHUB_TOKEN }} + # artifacts: "qTox-nightly.flatpak,qTox-nightly.flatpak.sha256" - test-flatpak: - name: Test Flatpak - needs: [build-flatpak] - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v4 - with: - # Fetch tags if we're not already in a tag build. - fetch-tags: ${{ !contains(github.ref, 'refs/tags/v') }} - sparse-checkout: | - .ci-scripts - test/resources/profile - - name: Download artifact from Flatpak - uses: actions/download-artifact@v4 - with: - name: qTox-${{ github.sha }}.x86_64.flatpak - - name: Install flatpak runner - run: sudo apt-get install -y flatpak - - name: Install KDE runtime - run: | - flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - flatpak install --user -y --noninteractive flathub org.kde.Platform/x86_64/6.8 - - name: Install flatpak - run: flatpak install --user -y --bundle qtox.flatpak - - name: Run flatpak - run: .ci-scripts/smoke-test.sh flatpak run io.github.qtox.qTox - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - QT_QPA_PLATFORM: offscreen + # test-flatpak: + # name: Test Flatpak + # needs: [build-flatpak] + # runs-on: ubuntu-20.04 + # steps: + # - uses: actions/checkout@v4 + # with: + # # Fetch tags if we're not already in a tag build. + # fetch-tags: ${{ !contains(github.ref, 'refs/tags/v') }} + # sparse-checkout: | + # .ci-scripts + # test/resources/profile + # - name: Download artifact from Flatpak + # uses: actions/download-artifact@v4 + # with: + # name: qTox-${{ github.sha }}.x86_64.flatpak + # - name: Install flatpak runner + # run: sudo apt-get install -y flatpak + # - name: Install KDE runtime + # run: | + # flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + # flatpak install --user -y --noninteractive flathub org.kde.Platform/x86_64/6.8 + # - name: Install flatpak + # run: flatpak install --user -y --bundle qtox.flatpak + # - name: Run flatpak + # run: .ci-scripts/smoke-test.sh flatpak run io.github.qtox.qTox + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # QT_QPA_PLATFORM: offscreen - build-macos-distributable: - name: macOS distributable - needs: [update-nightly-tag] - strategy: - matrix: - arch: [arm64, x86_64] - macos: ["10.15", "12.0"] - exclude: - - arch: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 'x86_64' }} - - macos: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 12.0 }} - runs-on: ${{ matrix.arch == 'arm64' && 'macos-14' || 'macos-13' }} - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Fetch build scripts - run: git clone --depth=1 https://github.com/TokTok/dockerfiles ".ci-scripts/dockerfiles" - - name: Cache compiler output - uses: actions/cache@v4 - with: - path: ".cache/ccache" - key: ${{ github.job }}-${{ matrix.arch }}-${{ matrix.macos }}-ccache - - name: Cache dependencies (only Qt) - id: cache-qt - uses: actions/cache@v4 - with: - path: | - .ci-scripts/dockerfiles/local-deps/qt - key: ${{ github.job }}-${{ matrix.arch }}-${{ matrix.macos }}-qt - - name: Cache dependencies (except Qt) - id: cache-deps - uses: actions/cache@v4 - with: - path: | - .ci-scripts/dockerfiles/local-deps/bin - .ci-scripts/dockerfiles/local-deps/include - .ci-scripts/dockerfiles/local-deps/lib - .ci-scripts/dockerfiles/local-deps/share - key: ${{ github.job }}-${{ matrix.arch }}-${{ matrix.macos }}-local-deps - - name: Homebrew dependencies to build dependencies - run: | - brew bundle --file platform/macos/Brewfile-DepBuildDeps - sed -i '' -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=15/' "$(realpath "$(which create-dmg)")" - - name: Set up ccache - run: ccache --set-config=max_size=200M --set-config=cache_dir="$PWD/.cache/ccache" && ccache --show-config - - name: Build dependencies (only Qt) - if: steps.cache-qt.outputs.cache-hit != 'true' - run: .ci-scripts/build-local-qt.sh "${{ matrix.arch }}" "release" "" "${{ matrix.macos }}" - - name: Build dependencies (except Qt) - if: steps.cache-deps.outputs.cache-hit != 'true' - run: .ci-scripts/build-local-deps.sh "${{ matrix.arch }}" "release" "" "${{ matrix.macos }}" - - name: Install the Apple certificate - env: - BUILD_CERTIFICATE_BASE64: ${{ secrets.APPLE_BUILD_CERTIFICATE_BASE64 }} - P12_PASSWORD: ${{ secrets.APPLE_P12_PASSWORD }} - KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }} - run: .github/scripts/install_apple_cert >/dev/null - - name: Build qTox - run: .ci-scripts/build-qtox-macos.sh dist "${{ matrix.arch }}" "${{ matrix.macos }}" - - name: Upload dmg - uses: actions/upload-artifact@v4 - with: - name: qTox-${{ github.sha }}-${{ matrix.arch }}-${{ matrix.macos }}.dmg - path: qTox-${{ matrix.arch }}-${{ matrix.macos }}.dmg - - name: Upload to versioned release - if: contains(github.ref, 'refs/tags/v') - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - draft: true - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "qTox-${{ matrix.arch }}-${{ matrix.macos }}.dmg,qTox-${{ matrix.arch }}-${{ matrix.macos }}.dmg.sha256" - - name: Rename artifact for nightly upload - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - run: | - cp qTox-${{ matrix.arch }}-${{ matrix.macos }}.dmg qTox-nightly-${{ matrix.arch }}-${{ matrix.macos }}.dmg - cp qTox-${{ matrix.arch }}-${{ matrix.macos }}.dmg.sha256 qTox-nightly-${{ matrix.arch }}-${{ matrix.macos }}.dmg.sha256 - - name: Upload to nightly release - uses: ncipollo/release-action@v1 - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - with: - allowUpdates: true - tag: nightly - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - prerelease: true - replacesArtifacts: true - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "qTox-nightly-${{ matrix.arch }}-${{ matrix.macos }}.dmg,qTox-nightly-${{ matrix.arch }}-${{ matrix.macos }}.dmg.sha256" + # build-macos-distributable: + # name: macOS distributable + # needs: [prepare] + # strategy: + # matrix: + # arch: [arm64, x86_64] + # macos: ["10.15", "12.0"] + # exclude: + # - arch: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 'x86_64' }} + # - macos: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 12.0 }} + # runs-on: ${{ matrix.arch == 'arm64' && 'macos-14' || 'macos-13' }} + # permissions: + # contents: write + # steps: + # - uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # - name: Fetch build scripts + # run: git clone --depth=1 https://github.com/TokTok/dockerfiles ".ci-scripts/dockerfiles" + # - name: Cache compiler output + # uses: actions/cache@v4 + # with: + # path: ".cache/ccache" + # key: ${{ github.job }}-${{ matrix.arch }}-${{ matrix.macos }}-ccache + # - name: Cache dependencies (only Qt) + # id: cache-qt + # uses: actions/cache@v4 + # with: + # path: | + # .ci-scripts/dockerfiles/local-deps/qt + # key: ${{ github.job }}-${{ matrix.arch }}-${{ matrix.macos }}-qt + # - name: Cache dependencies (except Qt) + # id: cache-deps + # uses: actions/cache@v4 + # with: + # path: | + # .ci-scripts/dockerfiles/local-deps/bin + # .ci-scripts/dockerfiles/local-deps/include + # .ci-scripts/dockerfiles/local-deps/lib + # .ci-scripts/dockerfiles/local-deps/share + # key: ${{ github.job }}-${{ matrix.arch }}-${{ matrix.macos }}-local-deps + # - name: Homebrew dependencies to build dependencies + # run: | + # brew bundle --file platform/macos/Brewfile-DepBuildDeps + # sed -i '' -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=15/' "$(realpath "$(which create-dmg)")" + # - name: Set up ccache + # run: ccache --set-config=max_size=200M --set-config=cache_dir="$PWD/.cache/ccache" && ccache --show-config + # - name: Build dependencies (only Qt) + # if: steps.cache-qt.outputs.cache-hit != 'true' + # run: .ci-scripts/build-local-qt.sh "${{ matrix.arch }}" "release" "" "${{ matrix.macos }}" + # - name: Build dependencies (except Qt) + # if: steps.cache-deps.outputs.cache-hit != 'true' + # run: .ci-scripts/build-local-deps.sh "${{ matrix.arch }}" "release" "" "${{ matrix.macos }}" + # - name: Install the Apple certificate + # env: + # BUILD_CERTIFICATE_BASE64: ${{ secrets.APPLE_BUILD_CERTIFICATE_BASE64 }} + # P12_PASSWORD: ${{ secrets.APPLE_P12_PASSWORD }} + # KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }} + # run: .github/scripts/install_apple_cert >/dev/null + # - name: Build qTox + # run: .ci-scripts/build-qtox-macos.sh dist "${{ matrix.arch }}" "${{ matrix.macos }}" + # - name: Upload dmg + # uses: actions/upload-artifact@v4 + # with: + # name: qTox-${{ github.sha }}-${{ matrix.arch }}-${{ matrix.macos }}.dmg + # path: qTox-${{ matrix.arch }}-${{ matrix.macos }}.dmg + # - name: Upload to versioned release + # if: contains(github.ref, 'refs/tags/v') + # uses: ncipollo/release-action@v1 + # with: + # allowUpdates: true + # draft: true + # token: ${{ secrets.GITHUB_TOKEN }} + # artifacts: "qTox-${{ matrix.arch }}-${{ matrix.macos }}.dmg,qTox-${{ matrix.arch }}-${{ matrix.macos }}.dmg.sha256" + # - name: Rename artifact for nightly upload + # if: github.event_name == 'push' && github.ref == 'refs/heads/master' + # run: | + # cp qTox-${{ matrix.arch }}-${{ matrix.macos }}.dmg qTox-nightly-${{ matrix.arch }}-${{ matrix.macos }}.dmg + # cp qTox-${{ matrix.arch }}-${{ matrix.macos }}.dmg.sha256 qTox-nightly-${{ matrix.arch }}-${{ matrix.macos }}.dmg.sha256 + # - name: Upload to nightly release + # uses: ncipollo/release-action@v1 + # if: github.event_name == 'push' && github.ref == 'refs/heads/master' + # with: + # allowUpdates: true + # tag: nightly + # omitBodyDuringUpdate: true + # omitNameDuringUpdate: true + # prerelease: true + # replacesArtifacts: true + # token: ${{ secrets.GITHUB_TOKEN }} + # artifacts: "qTox-nightly-${{ matrix.arch }}-${{ matrix.macos }}.dmg,qTox-nightly-${{ matrix.arch }}-${{ matrix.macos }}.dmg.sha256" - test-macos-distributable: - name: Test macOS distributable - needs: [build-macos-distributable] - strategy: - matrix: - arch: [arm64, x86_64] - macos: ["10.15", "12.0"] - exclude: - - arch: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 'x86_64' }} - - macos: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 12.0 }} - runs-on: ${{ matrix.arch == 'arm64' && 'macos-14' || 'macos-13' }} - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - with: - # Fetch tags if we're not already in a tag build. - fetch-tags: ${{ !contains(github.ref, 'refs/tags/v') }} - sparse-checkout: | - .ci-scripts - test/resources/profile - - name: Download artifact from macOS distributable (${{ matrix.arch }}) - uses: actions/download-artifact@v4 - with: - name: qTox-${{ github.sha }}-${{ matrix.arch }}-${{ matrix.macos }}.dmg - path: qTox.dmg - - name: Install 7zip - run: brew install 7zip - - name: Unpack dmg - run: 7zz x qTox.dmg qtox.app - - name: Run qTox - run: .ci-scripts/smoke-test.sh qtox.app/Contents/MacOS/qTox - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - QTOX_SCREENSHOT: qtox-macos-${{ matrix.arch }}-${{ matrix.macos }}.png - - name: Upload screenshot artifact - uses: actions/upload-artifact@v4 - with: - name: qtox-macos-${{ matrix.arch }}-${{ matrix.macos }}.png - path: qtox-macos-${{ matrix.arch }}-${{ matrix.macos }}.png - - name: Upload screenshot to nightly release - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - tag: nightly - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - prerelease: true - replacesArtifacts: true - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "qtox-macos-${{ matrix.arch }}-${{ matrix.macos }}.png" + # test-macos-distributable: + # name: Test macOS distributable + # needs: [build-macos-distributable] + # strategy: + # matrix: + # arch: [arm64, x86_64] + # macos: ["10.15", "12.0"] + # exclude: + # - arch: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 'x86_64' }} + # - macos: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 12.0 }} + # runs-on: ${{ matrix.arch == 'arm64' && 'macos-14' || 'macos-13' }} + # permissions: + # contents: write + # steps: + # - uses: actions/checkout@v4 + # with: + # # Fetch tags if we're not already in a tag build. + # fetch-tags: ${{ !contains(github.ref, 'refs/tags/v') }} + # sparse-checkout: | + # .ci-scripts + # test/resources/profile + # - name: Download artifact from macOS distributable (${{ matrix.arch }}) + # uses: actions/download-artifact@v4 + # with: + # name: qTox-${{ github.sha }}-${{ matrix.arch }}-${{ matrix.macos }}.dmg + # path: qTox.dmg + # - name: Install 7zip + # run: brew install 7zip + # - name: Unpack dmg + # run: 7zz x qTox.dmg qtox.app + # - name: Run qTox + # run: .ci-scripts/smoke-test.sh qtox.app/Contents/MacOS/qTox + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # QTOX_SCREENSHOT: qtox-macos-${{ matrix.arch }}-${{ matrix.macos }}.png + # - name: Upload screenshot artifact + # uses: actions/upload-artifact@v4 + # with: + # name: qtox-macos-${{ matrix.arch }}-${{ matrix.macos }}.png + # path: qtox-macos-${{ matrix.arch }}-${{ matrix.macos }}.png + # - name: Upload screenshot to nightly release + # if: github.event_name == 'push' && github.ref == 'refs/heads/master' + # uses: ncipollo/release-action@v1 + # with: + # allowUpdates: true + # tag: nightly + # omitBodyDuringUpdate: true + # omitNameDuringUpdate: true + # prerelease: true + # replacesArtifacts: true + # token: ${{ secrets.GITHUB_TOKEN }} + # artifacts: "qtox-macos-${{ matrix.arch }}-${{ matrix.macos }}.png" - build-macos-user: - name: macOS user - needs: [validate-pr] - if: github.event_name != 'push' - strategy: - matrix: - arch: [arm64, x86_64] - exclude: - - arch: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 'arm64' }} - runs-on: ${{ matrix.arch == 'arm64' && 'macos-14' || 'macos-13' }} - steps: - - uses: actions/checkout@v4 - - name: Fetch build scripts - run: git clone --depth=1 https://github.com/TokTok/dockerfiles ".ci-scripts/dockerfiles" - - name: Cache compiler output - uses: actions/cache@v4 - with: - path: ".cache/ccache" - key: ${{ github.job }}-${{ matrix.arch }}-ccache - - name: Homebrew - run: | - brew bundle --file platform/macos/Brewfile - sed -i '' -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=15/' "$(realpath "$(which create-dmg)")" - - name: Set up ccache - run: ccache --set-config=max_size=200M --set-config=cache_dir="$PWD/.cache/ccache" && ccache --show-config - - name: Install toxcore - run: .ci-scripts/dockerfiles/qtox/build_toxcore_system.sh sudo - - name: Build qTox - run: .ci-scripts/build-qtox-macos.sh user "${{ matrix.arch }}" "12.0" + # build-macos-user: + # name: macOS user + # needs: [validate-pr] + # if: github.event_name != 'push' + # strategy: + # matrix: + # arch: [arm64, x86_64] + # exclude: + # - arch: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 'arm64' }} + # runs-on: ${{ matrix.arch == 'arm64' && 'macos-14' || 'macos-13' }} + # steps: + # - uses: actions/checkout@v4 + # - name: Fetch build scripts + # run: git clone --depth=1 https://github.com/TokTok/dockerfiles ".ci-scripts/dockerfiles" + # - name: Cache compiler output + # uses: actions/cache@v4 + # with: + # path: ".cache/ccache" + # key: ${{ github.job }}-${{ matrix.arch }}-ccache + # - name: Homebrew + # run: | + # brew bundle --file platform/macos/Brewfile + # sed -i '' -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=15/' "$(realpath "$(which create-dmg)")" + # - name: Set up ccache + # run: ccache --set-config=max_size=200M --set-config=cache_dir="$PWD/.cache/ccache" && ccache --show-config + # - name: Install toxcore + # run: .ci-scripts/dockerfiles/qtox/build_toxcore_system.sh sudo + # - name: Build qTox + # run: .ci-scripts/build-qtox-macos.sh user "${{ matrix.arch }}" "12.0" - build-wasm: - name: WebAssembly - needs: [update-nightly-tag] - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Cache compiler output - uses: actions/cache@v4 - with: - path: ".cache/ccache" - key: ${{ github.job }}-ccache - - name: Run build - run: docker compose run --rm wasm_builder platform/wasm/build.sh - - name: Upload zip - uses: actions/upload-artifact@v4 - with: - name: qtox-wasm - path: _site + # build-wasm: + # name: WebAssembly + # needs: [prepare] + # runs-on: ubuntu-24.04 + # steps: + # - uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # - name: Cache compiler output + # uses: actions/cache@v4 + # with: + # path: ".cache/ccache" + # key: ${{ github.job }}-ccache + # - name: Run build + # run: docker compose run --rm wasm_builder platform/wasm/build.sh + # - name: Upload zip + # uses: actions/upload-artifact@v4 + # with: + # name: qtox-wasm + # path: _site - build-windows: - name: Windows - needs: [update-nightly-tag] - runs-on: ubuntu-24.04 - permissions: - contents: write - strategy: - matrix: - arch: [i686, x86_64] - build_type: [Debug, Release] - exclude: - - arch: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 'i686' }} - - build_type: ${{ (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') || contains(github.ref, 'refs/tags/v')) && 'Debug' }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Cache compiler output - uses: actions/cache@v4 - with: - path: ".cache/ccache" - key: ${{ github.job }}-${{ matrix.arch }}-${{ matrix.build_type }}-ccache - - name: Run build - run: docker compose run --rm windows_builder.${{ matrix.arch }} platform/windows/cross-compile/build.sh --arch ${{ matrix.arch }} --build-type ${{ matrix.build_type }} --run-tests --src-dir /qtox - - name: Upload installer - if: matrix.build_type == 'release' - uses: actions/upload-artifact@v4 - with: - name: setup-qtox-${{ matrix.arch }}-${{ matrix.build_type }}.exe - path: package-prefix/setup-qtox.exe - - name: Upload zip - uses: actions/upload-artifact@v4 - with: - name: qtox-${{ matrix.arch }}-${{ matrix.build_type }}.zip - path: install-prefix/qtox-${{ matrix.arch }}-${{ matrix.build_type }}.zip - - name: Rename exe for release upload - if: contains(github.ref, 'refs/tags/v') - run: | - cp package-prefix/setup-qtox.exe setup-qtox-${{ matrix.arch }}-release.exe - sha256sum setup-qtox-${{ matrix.arch }}-release.exe > setup-qtox-${{ matrix.arch }}-release.exe.sha256 - - name: Upload to versioned release - if: contains(github.ref, 'refs/tags/v') - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - draft: true - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "setup-qtox-${{ matrix.arch }}-release.exe,setup-qtox-${{ matrix.arch }}-release.exe.sha256" - - name: Rename zip for nightly upload - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - run: | - cp install-prefix/qtox-${{ matrix.arch }}-${{ matrix.build_type }}.zip qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.zip - sha256sum qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.zip > qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.zip.sha256 - - name: Upload zip to nightly release - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - tag: nightly - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - prerelease: true - replacesArtifacts: true - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.zip,qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.zip.sha256" - - name: Rename exe for nightly upload - if: github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.build_type == 'release' - run: | - cp package-prefix/setup-qtox.exe qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.exe - sha256sum qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.exe > qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.exe.sha256 - - name: Upload exe to nightly release - if: github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.build_type == 'release' - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - tag: nightly - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - prerelease: true - replacesArtifacts: true - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.exe,qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.exe.sha256" + # build-windows: + # name: Windows + # needs: [prepare] + # runs-on: ubuntu-24.04 + # permissions: + # contents: write + # strategy: + # matrix: + # arch: [i686, x86_64] + # build_type: [Debug, Release] + # exclude: + # - arch: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 'i686' }} + # - build_type: ${{ (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') || contains(github.ref, 'refs/tags/v')) && 'Debug' }} + # steps: + # - uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # - name: Cache compiler output + # uses: actions/cache@v4 + # with: + # path: ".cache/ccache" + # key: ${{ github.job }}-${{ matrix.arch }}-${{ matrix.build_type }}-ccache + # - name: Run build + # run: docker compose run --rm windows_builder.${{ matrix.arch }} platform/windows/cross-compile/build.sh --arch ${{ matrix.arch }} --build-type ${{ matrix.build_type }} --run-tests --src-dir /qtox + # - name: Upload installer + # if: matrix.build_type == 'release' + # uses: actions/upload-artifact@v4 + # with: + # name: setup-qtox-${{ matrix.arch }}-${{ matrix.build_type }}.exe + # path: package-prefix/setup-qtox.exe + # - name: Upload zip + # uses: actions/upload-artifact@v4 + # with: + # name: qtox-${{ matrix.arch }}-${{ matrix.build_type }}.zip + # path: install-prefix/qtox-${{ matrix.arch }}-${{ matrix.build_type }}.zip + # - name: Rename exe for release upload + # if: contains(github.ref, 'refs/tags/v') + # run: | + # cp package-prefix/setup-qtox.exe setup-qtox-${{ matrix.arch }}-release.exe + # sha256sum setup-qtox-${{ matrix.arch }}-release.exe > setup-qtox-${{ matrix.arch }}-release.exe.sha256 + # - name: Upload to versioned release + # if: contains(github.ref, 'refs/tags/v') + # uses: ncipollo/release-action@v1 + # with: + # allowUpdates: true + # draft: true + # token: ${{ secrets.GITHUB_TOKEN }} + # artifacts: "setup-qtox-${{ matrix.arch }}-release.exe,setup-qtox-${{ matrix.arch }}-release.exe.sha256" + # - name: Rename zip for nightly upload + # if: github.event_name == 'push' && github.ref == 'refs/heads/master' + # run: | + # cp install-prefix/qtox-${{ matrix.arch }}-${{ matrix.build_type }}.zip qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.zip + # sha256sum qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.zip > qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.zip.sha256 + # - name: Upload zip to nightly release + # if: github.event_name == 'push' && github.ref == 'refs/heads/master' + # uses: ncipollo/release-action@v1 + # with: + # allowUpdates: true + # tag: nightly + # omitBodyDuringUpdate: true + # omitNameDuringUpdate: true + # prerelease: true + # replacesArtifacts: true + # token: ${{ secrets.GITHUB_TOKEN }} + # artifacts: "qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.zip,qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.zip.sha256" + # - name: Rename exe for nightly upload + # if: github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.build_type == 'release' + # run: | + # cp package-prefix/setup-qtox.exe qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.exe + # sha256sum qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.exe > qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.exe.sha256 + # - name: Upload exe to nightly release + # if: github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.build_type == 'release' + # uses: ncipollo/release-action@v1 + # with: + # allowUpdates: true + # tag: nightly + # omitBodyDuringUpdate: true + # omitNameDuringUpdate: true + # prerelease: true + # replacesArtifacts: true + # token: ${{ secrets.GITHUB_TOKEN }} + # artifacts: "qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.exe,qtox-nightly-${{ matrix.arch }}-${{ matrix.build_type }}.exe.sha256" - test-windows: - name: Test Windows - needs: [build-windows] - runs-on: windows-latest - strategy: - matrix: - arch: [i686, x86_64] - build_type: [Release] - exclude: - - arch: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 'i686' }} - steps: - - uses: actions/checkout@v4 - with: - # Fetch tags if we're not already in a tag build. - fetch-tags: ${{ !contains(github.ref, 'refs/tags/v') }} - sparse-checkout: .ci-scripts - - name: Download artifact from Windows - uses: actions/download-artifact@v4 - with: - name: setup-qtox-${{ matrix.arch }}-${{ matrix.build_type }}.exe - - name: Install 7zip - run: choco install -y 7zip - - name: Unpack exe - run: 7z x setup-qtox.exe -oqtox - - name: Run qTox - shell: bash - run: .ci-scripts/smoke-test.sh qtox/bin/qtox.exe - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # test-windows: + # name: Test Windows + # needs: [build-windows] + # runs-on: windows-latest + # strategy: + # matrix: + # arch: [i686, x86_64] + # build_type: [Release] + # exclude: + # - arch: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'packaging') && 'i686' }} + # steps: + # - uses: actions/checkout@v4 + # with: + # # Fetch tags if we're not already in a tag build. + # fetch-tags: ${{ !contains(github.ref, 'refs/tags/v') }} + # sparse-checkout: .ci-scripts + # - name: Download artifact from Windows + # uses: actions/download-artifact@v4 + # with: + # name: setup-qtox-${{ matrix.arch }}-${{ matrix.build_type }}.exe + # - name: Install 7zip + # run: choco install -y 7zip + # - name: Unpack exe + # run: 7z x setup-qtox.exe -oqtox + # - name: Run qTox + # shell: bash + # run: .ci-scripts/smoke-test.sh qtox/bin/qtox.exe + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ################################################################################################ - # Documentation/website jobs - ################################################################################################ + # ################################################################################################ + # # Documentation/website jobs + # ################################################################################################ - build-docs: - name: Docs - needs: [update-nightly-tag] - runs-on: ubuntu-24.04 - env: - DOXYGEN_CONFIG_FILE: doxygen.conf - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Run - run: .ci-scripts/build-docs.sh - - name: Deploy - if: github.ref == 'refs/heads/master' && github.repository_owner == 'qTox' - env: - access_key: ${{ secrets.DOXYGEN_DEPLOY_KEY }} - run: .ci-scripts/deploy-docs.sh + # build-docs: + # name: Docs + # needs: [prepare] + # runs-on: ubuntu-24.04 + # env: + # DOXYGEN_CONFIG_FILE: doxygen.conf + # steps: + # - uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # - name: Run + # run: .ci-scripts/build-docs.sh + # - name: Deploy + # if: github.ref == 'refs/heads/master' && github.repository_owner == 'qTox' + # env: + # access_key: ${{ secrets.DOXYGEN_DEPLOY_KEY }} + # run: .ci-scripts/deploy-docs.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index ba25fe5f68..b6bf183bf9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,7 @@ execute_process( OUTPUT_STRIP_TRAILING_WHITESPACE) project(qtox LANGUAGES CXX) +set(PROJECT_ORG "io.github.qtox") # C++ standard. set(CMAKE_CXX_STANDARD 20) diff --git a/cmake/Installation.cmake b/cmake/Installation.cmake index 45509100d8..2976b591f4 100644 --- a/cmake/Installation.cmake +++ b/cmake/Installation.cmake @@ -2,51 +2,60 @@ # Copyright © 2019 by The qTox Project Contributors # Copyright © 2024-2025 The TokTok team. -################################################################################ +############################################################################# # # :: Installation # -################################################################################ +############################################################################# + +if(NOT PROJECT_ORG) + set(PROJECT_ORG "chat.tox") +endif() if(APPLE) - set_target_properties(${PROJECT_NAME} PROPERTIES - MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/platform/macos/Info.plist") + set_target_properties(${BINARY_NAME} PROPERTIES + ${BUNDLE_ID_OPTION} + MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/platform/macos/Info.plist" + MACOSX_BUNDLE TRUE + WIN32_EXECUTABLE TRUE + ) set(BUNDLE_PATH "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app") - install(FILES img/icons/qtox.icns DESTINATION ${BUNDLE_PATH}/Contents/Resources/) - install(FILES img/icons/qtox_profile.icns DESTINATION ${BUNDLE_PATH}/Contents/Resources/) + list(APPEND PROJECT_ICONS "img/icons/${BINARY_NAME}.icns") + list(APPEND PROJECT_ICONS "img/icons/${BINARY_NAME}_profile.icns") + + foreach(icon ${PROJECT_ICONS}) + install(FILES ${icon} DESTINATION ${BUNDLE_PATH}/Contents/Resources/) + endforeach() install(CODE " message(STATUS \"Creating dmg image\") - execute_process(COMMAND ${CMAKE_SOURCE_DIR}/platform/macos/createdmg ${CMAKE_SOURCE_DIR} ${BUNDLE_PATH}) + execute_process(COMMAND ${CMAKE_SOURCE_DIR}/platform/macos/createdmg ${PROJECT_NAME} ${CMAKE_SOURCE_DIR} ${BUNDLE_PATH}) " COMPONENT Runtime ) else() include(GNUInstallDirs) # follow the xdg-desktop specification - install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") - install(FILES "res/io.github.qtox.qTox.appdata.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo") - install(FILES "io.github.qtox.qTox.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications") + install(TARGETS ${BINARY_NAME} + BUNDLE DESTINATION . + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) + install(FILES "platform/linux/${PROJECT_ORG}.${PROJECT_NAME}.appdata.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo") + install(FILES "platform/linux/${PROJECT_ORG}.${PROJECT_NAME}.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications") # Install application icons according to the XDG spec set(ICON_SIZES 14 16 22 24 32 36 48 64 72 96 128 192 256 512) foreach(size ${ICON_SIZES}) - set(path_from "img/icons/${size}x${size}/qtox.png") + set(path_from "img/icons/${size}x${size}/${BINARY_NAME}.png") set(path_to "share/icons/hicolor/${size}x${size}/apps/") install(FILES ${path_from} DESTINATION ${path_to}) endforeach(size) # process the icon, compress if enabled - set(SVG_SRC "${CMAKE_SOURCE_DIR}/img/icons/qtox.svg") - if(${SVGZ_ICON}) - set(SVG_GZIP "${CMAKE_BINARY_DIR}/qtox.svgz") - install(CODE " - execute_process(COMMAND gzip -S z INPUT_FILE ${SVG_SRC} OUTPUT_FILE ${SVG_GZIP}) - " COMPONENT Runtime) - set(SVG_DEST "${SVG_GZIP}") - else() - set(SVG_DEST "${SVG_SRC}") - endif() - install(FILES "${SVG_DEST}" DESTINATION "share/icons/hicolor/scalable/apps") + set(SVG_SRC "${CMAKE_SOURCE_DIR}/img/icons/${BINARY_NAME}.svg") + install(FILES "${SVG_SRC}" DESTINATION "share/icons/hicolor/scalable/apps") endif() diff --git a/platform/appimage/build.sh b/platform/appimage/build.sh index 36f24744a1..165966ee75 100755 --- a/platform/appimage/build.sh +++ b/platform/appimage/build.sh @@ -8,20 +8,32 @@ set -exuo pipefail usage() { - echo "$0 --src-dir SRC_DIR" - echo "Builds an app image in the CWD based off qtox installation at SRC_DIR" + echo "$0 --src-dir SRC_DIR --project-name PROJECT_NAME [cmake args]" + echo "Builds an app image in the CWD based off PROJECT_NAME installation at SRC_DIR" } while (($# > 0)); do case $1 in + --project-name) + PROJECT_NAME=$2 + shift 2 + ;; --src-dir) - QTOX_SRC_DIR=$2 + SRC_DIR=$2 + shift 2 + ;; + --arch) + ARCH=$2 shift 2 ;; --help | -h) usage exit 1 ;; + --) + shift + break + ;; *) echo "Unexpected argument $1" usage @@ -30,12 +42,24 @@ while (($# > 0)); do esac done -if [ -z "${QTOX_SRC_DIR+x}" ]; then +if [ -z "${ARCH+x}" ]; then + echo "--arch is a required argument" + usage + exit 1 +fi + +if [ -z "${SRC_DIR+x}" ]; then echo "--src-dir is a required argument" usage exit 1 fi +if [ -z "${PROJECT_NAME+x}" ]; then + echo "--project-name is a required argument" + usage + exit 1 +fi + # https://stackoverflow.com/questions/72978485/git-submodule-update-failed-with-fatal-detected-dubious-ownership-in-reposit git config --global --add safe.directory '*' @@ -44,7 +68,7 @@ git describe --tags --match 'v*' # directory paths readonly BUILD_DIR="$(realpath .)" -readonly QTOX_APP_DIR="$BUILD_DIR/QTox.AppDir" +readonly APP_DIR="$BUILD_DIR/$PROJECT_NAME.AppDir" rm -f appimagetool-*.AppImage wget "https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimagetool-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2)" @@ -55,37 +79,42 @@ chmod +x appimagetool-*.AppImage ./appimagetool-*.AppImage --appimage-extract sed -i -e 's!/EEE!/etc!g' squashfs-root/usr/bin/appimagetool -# update information to be embedded in AppImage -#readonly UPDATE_INFO="gh-releases-zsync|TokTok|qTox|latest|qTox-*.x86_64.AppImage.zsync" -#export GIT_VERSION=$(git -C "${QTOX_SRC_DIR}" rev-parse --short HEAD) - export PKG_CONFIG_PATH=/opt/buildhome/lib/pkgconfig -echo "$QTOX_APP_DIR" -cmake "$QTOX_SRC_DIR" \ +ccache --zero-stats +ccache --show-config + +echo "$APP_DIR" +cmake "$SRC_DIR" \ -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_PREFIX_PATH="/opt/buildhome/lib64/cmake;/opt/buildhome/qt/lib/cmake" \ -DCMAKE_INSTALL_PREFIX=/usr \ - -DUPDATE_CHECK=ON \ - -B _build + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -B _build \ + "$@" cmake --build _build -#rm -fr QTox.AppDir -cmake --install _build --prefix QTox.AppDir/usr +cmake --install _build --prefix "$PROJECT_NAME.AppDir/usr" + +ccache --show-stats export QTDIR=/opt/buildhome/qt export LD_LIBRARY_PATH="/opt/buildhome/lib:/opt/buildhome/lib64:$QTDIR/lib" # Copy offscreen/wayland plugins to the app dir. -mkdir -p "$QTOX_APP_DIR/$QTDIR/plugins/platforms" -cp -r "$QTDIR/plugins/platforms/libqoffscreen.so" "$QTOX_APP_DIR/$QTDIR/plugins/platforms/" -cp -r "$QTDIR/plugins/platforms/libqwayland-generic.so" "$QTOX_APP_DIR/$QTDIR/plugins/platforms/" +mkdir -p "$APP_DIR/$QTDIR/plugins/platforms" +cp -r "$QTDIR/plugins/platforms/libqoffscreen.so" "$APP_DIR/$QTDIR/plugins/platforms/" +cp -r "$QTDIR/plugins/platforms/libqwayland-generic.so" "$APP_DIR/$QTDIR/plugins/platforms/" # Copy the tls plugins to the app dir, needed for https connections. -cp -r "$QTDIR/plugins/tls/" "$QTOX_APP_DIR/$QTDIR/plugins/" +cp -r "$QTDIR/plugins/tls/" "$APP_DIR/$QTDIR/plugins/" -squashfs-root/AppRun -s deploy "$QTOX_APP_DIR"/usr/share/applications/*.desktop +squashfs-root/AppRun -s deploy "$APP_DIR"/usr/share/applications/*.desktop # print all links not contained inside the AppDir -LD_LIBRARY_PATH='' find "$QTOX_APP_DIR" -type f -exec ldd {} \; 2>&1 | grep '=>' | grep -v "$QTOX_APP_DIR" +LD_LIBRARY_PATH='' find "$APP_DIR" -type f -exec ldd {} \; 2>&1 | grep '=>' | grep -v "$APP_DIR" + +squashfs-root/AppRun "$APP_DIR" -squashfs-root/AppRun "$QTOX_APP_DIR" +APPIMAGE_FILE="$PROJECT_NAME-$(git rev-parse --short HEAD)-$ARCH.AppImage" +sha256sum "$APPIMAGE_FILE" >"$APPIMAGE_FILE.sha256"