name: CI # Controls when the workflow will run on: push: branches: [main] paths: - "td" # on TDLib updates pull_request: branches: [main] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: env: TDLIB_REPO: https://github.com/tdlib/td ARTIFACT_NAME: TDLibFramework.zip ARTIFACT_DIR: ./builder/build DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer jobs: # iOS build-openssl-iOS: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 env: PLATFORM: iOS steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Patch Build script run: | cd td git apply ../builder/tdlib-patches/build-openssl.patch - name: Cache Openssl id: cache-openssl uses: actions/cache@v3 with: path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} key: openssl-v1-${{ env.PLATFORM }}-${{ hashFiles('td/example/ios/build-openssl.sh', 'td/example/ios/Python-Apple-support.patch', 'builder/tdlib-patches/build-openssl.patch') }} - name: Install deps if: steps.cache-openssl.outputs.cache-hit != 'true' run: brew install gperf cmake coreutils - name: Build Openssl if: steps.cache-openssl.outputs.cache-hit != 'true' run: | cd td/example/ios ./build-openssl.sh $PLATFORM - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} if-no-files-found: error build-tdlib-iOS: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: [build-openssl-iOS] env: PLATFORM: iOS steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Patch Build run: | cp builder/tdlib-patches/build.sh td/example/ios - name: Cache tdlib id: cache-tdlib uses: actions/cache@v3 with: path: td/example/ios/build/install-${{ env.PLATFORM }} key: tdlib-install-v1-${{ env.PLATFORM }}-${{ hashFiles('td', 'builder/tdlib-patches/build.sh') }} - name: Restore ccache cache if: steps.cache-tdlib.outputs.cache-hit != 'true' id: cache-ccache uses: actions/cache@v3 with: path: ~/Library/Caches/ccache key: tdlib-ccache-v1-${{ env.PLATFORM }}-${{ github.ref }}-${{ github.sha }} restore-keys: | tdlib-ccache-v1-${{ env.PLATFORM }}-${{ github.ref }}- tdlib-ccache-v1-${{ env.PLATFORM }}- - name: Install deps if: steps.cache-tdlib.outputs.cache-hit != 'true' run: brew install gperf cmake coreutils ccache - name: Download Artifacts if: steps.cache-tdlib.outputs.cache-hit != 'true' uses: actions/download-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} - name: Pregenerate Sources if: steps.cache-tdlib.outputs.cache-hit != 'true' run: | cd td mkdir native-build cd native-build cmake .. cmake --build . --target prepare_cross_compiling - name: Build TDLib if: steps.cache-tdlib.outputs.cache-hit != 'true' run: | cd td/example/ios ./build.sh $PLATFORM "$(python3 ../../../scripts/extract_os_version.py ${PLATFORM})" - name: Show ccache stats if: steps.cache-tdlib.outputs.cache-hit != 'true' run: ccache -s - name: Upload ${{ env.PLATFORM }} install artifacts uses: actions/upload-artifact@v3 with: name: tdlib-install-${{ env.PLATFORM }} path: td/example/ios/build/install-${{ env.PLATFORM }} if-no-files-found: error # iOS build-openssl-iOS-simulator: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 env: PLATFORM: iOS-simulator steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Patch Build script run: | cd td git apply ../builder/tdlib-patches/build-openssl.patch - name: Cache Openssl id: cache-openssl uses: actions/cache@v3 with: path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} key: openssl-v1-${{ env.PLATFORM }}-${{ hashFiles('td/example/ios/build-openssl.sh', 'td/example/ios/Python-Apple-support.patch', 'builder/tdlib-patches/build-openssl.patch') }} - name: Install deps if: steps.cache-openssl.outputs.cache-hit != 'true' run: brew install gperf cmake coreutils - name: Build Openssl if: steps.cache-openssl.outputs.cache-hit != 'true' run: | cd td/example/ios ./build-openssl.sh $PLATFORM - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} if-no-files-found: error build-tdlib-iOS-simulator: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: [build-openssl-iOS-simulator] env: PLATFORM: iOS-simulator steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Patch Build run: | cp builder/tdlib-patches/build.sh td/example/ios - name: Cache tdlib id: cache-tdlib uses: actions/cache@v3 with: path: td/example/ios/build/install-${{ env.PLATFORM }} key: tdlib-install-v1-${{ env.PLATFORM }}-${{ hashFiles('td', 'builder/tdlib-patches/build.sh') }} - name: Restore ccache cache if: steps.cache-tdlib.outputs.cache-hit != 'true' id: cache-ccache uses: actions/cache@v3 with: path: ~/Library/Caches/ccache key: tdlib-ccache-v1-${{ env.PLATFORM }}-${{ github.ref }}-${{ github.sha }} restore-keys: | tdlib-ccache-v1-${{ env.PLATFORM }}-${{ github.ref }}- tdlib-ccache-v1-${{ env.PLATFORM }}- - name: Install deps if: steps.cache-tdlib.outputs.cache-hit != 'true' run: brew install gperf cmake coreutils ccache - name: Download Artifacts if: steps.cache-tdlib.outputs.cache-hit != 'true' uses: actions/download-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} - name: Pregenerate Sources if: steps.cache-tdlib.outputs.cache-hit != 'true' run: | cd td mkdir native-build cd native-build cmake .. cmake --build . --target prepare_cross_compiling - name: Build TDLib if: steps.cache-tdlib.outputs.cache-hit != 'true' run: | cd td/example/ios ./build.sh $PLATFORM "$(python3 ../../../scripts/extract_os_version.py ${PLATFORM})" - name: Show ccache stats if: steps.cache-tdlib.outputs.cache-hit != 'true' run: ccache -s - name: Upload ${{ env.PLATFORM }} install artifacts uses: actions/upload-artifact@v3 with: name: tdlib-install-${{ env.PLATFORM }} path: td/example/ios/build/install-${{ env.PLATFORM }} if-no-files-found: error build-framework-iOS: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: [build-tdlib-iOS] env: PLATFORM: iOS steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Download Openssl uses: actions/download-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} - name: Download TDLib ${{ env.PLATFORM }} install uses: actions/download-artifact@v3 with: name: tdlib-install-${{ env.PLATFORM }} path: td/example/ios/build/install-${{ env.PLATFORM }} - name: Patch headers working-directory: ./builder run: ./patch-headers.sh - name: Generate project working-directory: ./builder run: TUIST_PLATFORM=$PLATFORM ../.tuist-bin/tuist generate - name: Build .framework working-directory: ./builder run: ./build-framework.sh $PLATFORM - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: xcarchive-${{ env.PLATFORM }} path: ./builder/build/${{ env.PLATFORM }}.xcarchive if-no-files-found: error build-framework-iOS-simulator: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: [build-tdlib-iOS-simulator] env: PLATFORM: iOS-simulator steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Download Openssl uses: actions/download-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} - name: Download TDLib ${{ env.PLATFORM }} install uses: actions/download-artifact@v3 with: name: tdlib-install-${{ env.PLATFORM }} path: td/example/ios/build/install-${{ env.PLATFORM }} - name: Patch headers working-directory: ./builder run: ./patch-headers.sh - name: Generate project working-directory: ./builder run: TUIST_PLATFORM=$PLATFORM ../.tuist-bin/tuist generate - name: Build .framework working-directory: ./builder run: ./build-framework.sh $PLATFORM - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: xcarchive-${{ env.PLATFORM }} path: ./builder/build/${{ env.PLATFORM }}.xcarchive if-no-files-found: error # macOS build-openssl-macOS: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 env: PLATFORM: macOS steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Patch Build script run: | cd td git apply ../builder/tdlib-patches/build-openssl.patch - name: Cache Openssl id: cache-openssl uses: actions/cache@v3 with: path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} key: openssl-v1-${{ env.PLATFORM }}-${{ hashFiles('td/example/ios/build-openssl.sh', 'td/example/ios/Python-Apple-support.patch', 'builder/tdlib-patches/build-openssl.patch') }} - name: Install deps if: steps.cache-openssl.outputs.cache-hit != 'true' run: brew install gperf cmake coreutils - name: Build Openssl if: steps.cache-openssl.outputs.cache-hit != 'true' run: | cd td/example/ios ./build-openssl.sh $PLATFORM - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} if-no-files-found: error build-tdlib-macOS: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: [build-openssl-macOS] env: PLATFORM: macOS steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Patch Build run: | cp builder/tdlib-patches/build.sh td/example/ios - name: Cache tdlib id: cache-tdlib uses: actions/cache@v3 with: path: td/example/ios/build/install-${{ env.PLATFORM }} key: tdlib-install-v1-${{ env.PLATFORM }}-${{ hashFiles('td', 'builder/tdlib-patches/build.sh') }} - name: Restore ccache cache if: steps.cache-tdlib.outputs.cache-hit != 'true' id: cache-ccache uses: actions/cache@v3 with: path: ~/Library/Caches/ccache key: tdlib-ccache-v1-${{ env.PLATFORM }}-${{ github.ref }}-${{ github.sha }} restore-keys: | tdlib-ccache-v1-${{ env.PLATFORM }}-${{ github.ref }}- tdlib-ccache-v1-${{ env.PLATFORM }}- - name: Install deps if: steps.cache-tdlib.outputs.cache-hit != 'true' run: brew install gperf cmake coreutils ccache - name: Download Artifacts if: steps.cache-tdlib.outputs.cache-hit != 'true' uses: actions/download-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} # Sources are pregenerated in build phase # - name: Pregenerate Sources # if: steps.cache-tdlib.outputs.cache-hit != 'true' # run: | # cd td # mkdir native-build # cd native-build # cmake .. # cmake --build . --target prepare_cross_compiling - name: Build TDLib if: steps.cache-tdlib.outputs.cache-hit != 'true' run: | cd td/example/ios ./build.sh $PLATFORM "$(python3 ../../../scripts/extract_os_version.py ${PLATFORM})" - name: Show ccache stats if: steps.cache-tdlib.outputs.cache-hit != 'true' run: ccache -s - name: Upload ${{ env.PLATFORM }} install artifacts uses: actions/upload-artifact@v3 with: name: tdlib-install-${{ env.PLATFORM }} path: td/example/ios/build/install-${{ env.PLATFORM }} if-no-files-found: error build-framework-macOS: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: [build-tdlib-macOS] env: PLATFORM: macOS steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Download Openssl uses: actions/download-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} - name: Download TDLib ${{ env.PLATFORM }} install uses: actions/download-artifact@v3 with: name: tdlib-install-${{ env.PLATFORM }} path: td/example/ios/build/install-${{ env.PLATFORM }} - name: Patch headers working-directory: ./builder run: ./patch-headers.sh - name: Generate project working-directory: ./builder run: TUIST_PLATFORM=$PLATFORM ../.tuist-bin/tuist generate - name: Build .framework working-directory: ./builder run: ./build-framework.sh $PLATFORM - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: xcarchive-${{ env.PLATFORM }} path: ./builder/build/${{ env.PLATFORM }}.xcarchive if-no-files-found: error # watchOS build-openssl-watchOS: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 env: PLATFORM: watchOS steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Patch Build script run: | cd td git apply ../builder/tdlib-patches/build-openssl.patch - name: Cache Openssl id: cache-openssl uses: actions/cache@v3 with: path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} key: openssl-v1-${{ env.PLATFORM }}-${{ hashFiles('td/example/ios/build-openssl.sh', 'td/example/ios/Python-Apple-support.patch', 'builder/tdlib-patches/build-openssl.patch') }} - name: Install deps if: steps.cache-openssl.outputs.cache-hit != 'true' run: brew install gperf cmake coreutils - name: Build Openssl if: steps.cache-openssl.outputs.cache-hit != 'true' run: | cd td/example/ios ./build-openssl.sh $PLATFORM - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} if-no-files-found: error build-tdlib-watchOS: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: [build-openssl-watchOS] env: PLATFORM: watchOS steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Patch Build run: | cp builder/tdlib-patches/build.sh td/example/ios - name: Cache tdlib id: cache-tdlib uses: actions/cache@v3 with: path: td/example/ios/build/install-${{ env.PLATFORM }} key: tdlib-install-v1-${{ env.PLATFORM }}-${{ hashFiles('td', 'builder/tdlib-patches/build.sh') }} - name: Restore ccache cache if: steps.cache-tdlib.outputs.cache-hit != 'true' id: cache-ccache uses: actions/cache@v3 with: path: ~/Library/Caches/ccache key: tdlib-ccache-v1-${{ env.PLATFORM }}-${{ github.ref }}-${{ github.sha }} restore-keys: | tdlib-ccache-v1-${{ env.PLATFORM }}-${{ github.ref }}- tdlib-ccache-v1-${{ env.PLATFORM }}- - name: Install deps if: steps.cache-tdlib.outputs.cache-hit != 'true' run: brew install gperf cmake coreutils ccache - name: Download Artifacts if: steps.cache-tdlib.outputs.cache-hit != 'true' uses: actions/download-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} - name: Pregenerate Sources if: steps.cache-tdlib.outputs.cache-hit != 'true' run: | cd td mkdir native-build cd native-build cmake .. cmake --build . --target prepare_cross_compiling - name: Build TDLib if: steps.cache-tdlib.outputs.cache-hit != 'true' run: | cd td/example/ios ./build.sh $PLATFORM "$(python3 ../../../scripts/extract_os_version.py ${PLATFORM})" - name: Show ccache stats if: steps.cache-tdlib.outputs.cache-hit != 'true' run: ccache -s - name: Upload ${{ env.PLATFORM }} install artifacts uses: actions/upload-artifact@v3 with: name: tdlib-install-${{ env.PLATFORM }} path: td/example/ios/build/install-${{ env.PLATFORM }} if-no-files-found: error build-openssl-watchOS-simulator: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 env: PLATFORM: watchOS-simulator steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Patch Build script run: | cd td git apply ../builder/tdlib-patches/build-openssl.patch - name: Cache Openssl id: cache-openssl uses: actions/cache@v3 with: path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} key: openssl-v1-${{ env.PLATFORM }}-${{ hashFiles('td/example/ios/build-openssl.sh', 'td/example/ios/Python-Apple-support.patch', 'builder/tdlib-patches/build-openssl.patch') }} - name: Install deps if: steps.cache-openssl.outputs.cache-hit != 'true' run: brew install gperf cmake coreutils - name: Build Openssl if: steps.cache-openssl.outputs.cache-hit != 'true' run: | cd td/example/ios ./build-openssl.sh $PLATFORM - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} if-no-files-found: error build-tdlib-watchOS-simulator: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: [build-openssl-watchOS-simulator] env: PLATFORM: watchOS-simulator steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Patch Build run: | cp builder/tdlib-patches/build.sh td/example/ios - name: Cache tdlib id: cache-tdlib uses: actions/cache@v3 with: path: td/example/ios/build/install-${{ env.PLATFORM }} key: tdlib-install-v1-${{ env.PLATFORM }}-${{ hashFiles('td', 'builder/tdlib-patches/build.sh') }} - name: Restore ccache cache if: steps.cache-tdlib.outputs.cache-hit != 'true' id: cache-ccache uses: actions/cache@v3 with: path: ~/Library/Caches/ccache key: tdlib-ccache-v1-${{ env.PLATFORM }}-${{ github.ref }}-${{ github.sha }} restore-keys: | tdlib-ccache-v1-${{ env.PLATFORM }}-${{ github.ref }}- tdlib-ccache-v1-${{ env.PLATFORM }}- - name: Install deps if: steps.cache-tdlib.outputs.cache-hit != 'true' run: brew install gperf cmake coreutils ccache - name: Download Artifacts if: steps.cache-tdlib.outputs.cache-hit != 'true' uses: actions/download-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} - name: Pregenerate Sources if: steps.cache-tdlib.outputs.cache-hit != 'true' run: | cd td mkdir native-build cd native-build cmake .. cmake --build . --target prepare_cross_compiling - name: Build TDLib if: steps.cache-tdlib.outputs.cache-hit != 'true' run: | cd td/example/ios ./build.sh $PLATFORM "$(python3 ../../../scripts/extract_os_version.py ${PLATFORM})" - name: Show ccache stats if: steps.cache-tdlib.outputs.cache-hit != 'true' run: ccache -s - name: Upload ${{ env.PLATFORM }} install artifacts uses: actions/upload-artifact@v3 with: name: tdlib-install-${{ env.PLATFORM }} path: td/example/ios/build/install-${{ env.PLATFORM }} if-no-files-found: error build-framework-watchOS: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: [build-tdlib-watchOS] env: PLATFORM: watchOS steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Download Openssl uses: actions/download-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} - name: Download TDLib ${{ env.PLATFORM }} install uses: actions/download-artifact@v3 with: name: tdlib-install-${{ env.PLATFORM }} path: td/example/ios/build/install-${{ env.PLATFORM }} - name: Patch headers working-directory: ./builder run: ./patch-headers.sh - name: Generate project working-directory: ./builder run: TUIST_PLATFORM=$PLATFORM ../.tuist-bin/tuist generate - name: Build .framework working-directory: ./builder run: ./build-framework.sh $PLATFORM - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: xcarchive-${{ env.PLATFORM }} path: ./builder/build/${{ env.PLATFORM }}.xcarchive if-no-files-found: error build-framework-watchOS-simulator: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: [build-tdlib-watchOS-simulator] env: PLATFORM: watchOS-simulator steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Download Openssl uses: actions/download-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} - name: Download TDLib ${{ env.PLATFORM }} install uses: actions/download-artifact@v3 with: name: tdlib-install-${{ env.PLATFORM }} path: td/example/ios/build/install-${{ env.PLATFORM }} - name: Patch headers working-directory: ./builder run: ./patch-headers.sh - name: Generate project working-directory: ./builder run: TUIST_PLATFORM=$PLATFORM ../.tuist-bin/tuist generate - name: Build .framework working-directory: ./builder run: ./build-framework.sh $PLATFORM - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: xcarchive-${{ env.PLATFORM }} path: ./builder/build/${{ env.PLATFORM }}.xcarchive if-no-files-found: error # tvOS build-openssl-tvOS: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 env: PLATFORM: tvOS steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Patch Build script run: | cd td git apply ../builder/tdlib-patches/build-openssl.patch - name: Cache Openssl id: cache-openssl uses: actions/cache@v3 with: path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} key: openssl-v1-${{ env.PLATFORM }}-${{ hashFiles('td/example/ios/build-openssl.sh', 'td/example/ios/Python-Apple-support.patch', 'builder/tdlib-patches/build-openssl.patch') }} - name: Install deps if: steps.cache-openssl.outputs.cache-hit != 'true' run: brew install gperf cmake coreutils - name: Build Openssl if: steps.cache-openssl.outputs.cache-hit != 'true' run: | cd td/example/ios ./build-openssl.sh $PLATFORM - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} if-no-files-found: error build-tdlib-tvOS: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: [build-openssl-tvOS] env: PLATFORM: tvOS steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Patch Build run: | cp builder/tdlib-patches/build.sh td/example/ios - name: Cache tdlib id: cache-tdlib uses: actions/cache@v3 with: path: td/example/ios/build/install-${{ env.PLATFORM }} key: tdlib-install-v1-${{ env.PLATFORM }}-${{ hashFiles('td', 'builder/tdlib-patches/build.sh') }} - name: Restore ccache cache if: steps.cache-tdlib.outputs.cache-hit != 'true' id: cache-ccache uses: actions/cache@v3 with: path: ~/Library/Caches/ccache key: tdlib-ccache-v1-${{ env.PLATFORM }}-${{ github.ref }}-${{ github.sha }} restore-keys: | tdlib-ccache-v1-${{ env.PLATFORM }}-${{ github.ref }}- tdlib-ccache-v1-${{ env.PLATFORM }}- - name: Install deps if: steps.cache-tdlib.outputs.cache-hit != 'true' run: brew install gperf cmake coreutils ccache - name: Download Artifacts if: steps.cache-tdlib.outputs.cache-hit != 'true' uses: actions/download-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} - name: Pregenerate Sources if: steps.cache-tdlib.outputs.cache-hit != 'true' run: | cd td mkdir native-build cd native-build cmake .. cmake --build . --target prepare_cross_compiling - name: Build TDLib if: steps.cache-tdlib.outputs.cache-hit != 'true' run: | cd td/example/ios ./build.sh $PLATFORM "$(python3 ../../../scripts/extract_os_version.py ${PLATFORM})" - name: Show ccache stats if: steps.cache-tdlib.outputs.cache-hit != 'true' run: ccache -s - name: Upload ${{ env.PLATFORM }} install artifacts uses: actions/upload-artifact@v3 with: name: tdlib-install-${{ env.PLATFORM }} path: td/example/ios/build/install-${{ env.PLATFORM }} if-no-files-found: error build-openssl-tvOS-simulator: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 env: PLATFORM: tvOS-simulator steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Patch Build script run: | cd td git apply ../builder/tdlib-patches/build-openssl.patch - name: Cache Openssl id: cache-openssl uses: actions/cache@v3 with: path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} key: openssl-v1-${{ env.PLATFORM }}-${{ hashFiles('td/example/ios/build-openssl.sh', 'td/example/ios/Python-Apple-support.patch', 'builder/tdlib-patches/build-openssl.patch') }} - name: Install deps if: steps.cache-openssl.outputs.cache-hit != 'true' run: brew install gperf cmake coreutils - name: Build Openssl if: steps.cache-openssl.outputs.cache-hit != 'true' run: | cd td/example/ios ./build-openssl.sh $PLATFORM - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} if-no-files-found: error build-tdlib-tvOS-simulator: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: [build-openssl-tvOS-simulator] env: PLATFORM: tvOS-simulator steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Patch Build run: | cp builder/tdlib-patches/build.sh td/example/ios - name: Cache tdlib id: cache-tdlib uses: actions/cache@v3 with: path: td/example/ios/build/install-${{ env.PLATFORM }} key: tdlib-install-v1-${{ env.PLATFORM }}-${{ hashFiles('td', 'builder/tdlib-patches/build.sh') }} - name: Restore ccache cache if: steps.cache-tdlib.outputs.cache-hit != 'true' id: cache-ccache uses: actions/cache@v3 with: path: ~/Library/Caches/ccache key: tdlib-ccache-v1-${{ env.PLATFORM }}-${{ github.ref }}-${{ github.sha }} restore-keys: | tdlib-ccache-v1-${{ env.PLATFORM }}-${{ github.ref }}- tdlib-ccache-v1-${{ env.PLATFORM }}- - name: Install deps if: steps.cache-tdlib.outputs.cache-hit != 'true' run: brew install gperf cmake coreutils ccache - name: Download Artifacts if: steps.cache-tdlib.outputs.cache-hit != 'true' uses: actions/download-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} - name: Pregenerate Sources if: steps.cache-tdlib.outputs.cache-hit != 'true' run: | cd td mkdir native-build cd native-build cmake .. cmake --build . --target prepare_cross_compiling - name: Build TDLib if: steps.cache-tdlib.outputs.cache-hit != 'true' run: | cd td/example/ios source ./build.sh $PLATFORM "$(python3 ../../../scripts/extract_os_version.py ${PLATFORM})" - name: Show ccache stats if: steps.cache-tdlib.outputs.cache-hit != 'true' run: ccache -s - name: Upload ${{ env.PLATFORM }} install artifacts uses: actions/upload-artifact@v3 with: name: tdlib-install-${{ env.PLATFORM }} path: td/example/ios/build/install-${{ env.PLATFORM }} if-no-files-found: error build-framework-tvOS: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: [build-tdlib-tvOS] env: PLATFORM: tvOS steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Download Openssl uses: actions/download-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} - name: Download TDLib ${{ env.PLATFORM }} install uses: actions/download-artifact@v3 with: name: tdlib-install-${{ env.PLATFORM }} path: td/example/ios/build/install-${{ env.PLATFORM }} - name: Patch headers working-directory: ./builder run: ./patch-headers.sh - name: Generate project working-directory: ./builder run: TUIST_PLATFORM=$PLATFORM ../.tuist-bin/tuist generate - name: Build .framework working-directory: ./builder run: ./build-framework.sh $PLATFORM - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: xcarchive-${{ env.PLATFORM }} path: ./builder/build/${{ env.PLATFORM }}.xcarchive if-no-files-found: error build-framework-tvOS-simulator: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: [build-tdlib-tvOS-simulator] env: PLATFORM: tvOS-simulator steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Download Openssl uses: actions/download-artifact@v3 with: name: openssl-${{ env.PLATFORM }} path: td/example/ios/third_party/openssl/${{ env.PLATFORM }} - name: Download TDLib ${{ env.PLATFORM }} install uses: actions/download-artifact@v3 with: name: tdlib-install-${{ env.PLATFORM }} path: td/example/ios/build/install-${{ env.PLATFORM }} - name: Patch headers working-directory: ./builder run: ./patch-headers.sh - name: Generate project working-directory: ./builder run: TUIST_PLATFORM=$PLATFORM ../.tuist-bin/tuist generate - name: Build .framework working-directory: ./builder run: ./build-framework.sh $PLATFORM - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: xcarchive-${{ env.PLATFORM }} path: ./builder/build/${{ env.PLATFORM }}.xcarchive if-no-files-found: error # Merge frameworks merge-xcframework: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: - build-framework-iOS - build-framework-iOS-simulator - build-framework-macOS - build-framework-watchOS - build-framework-watchOS-simulator - build-framework-tvOS - build-framework-tvOS-simulator steps: - name: Checkout uses: actions/checkout@v3 - name: Download iOS Framework uses: actions/download-artifact@v3 with: name: xcarchive-iOS path: ./builder/build/iOS.xcarchive - name: Download iOS-simulator Framework uses: actions/download-artifact@v3 with: name: xcarchive-iOS-simulator path: ./builder/build/iOS-simulator.xcarchive - name: Download macOS Framework uses: actions/download-artifact@v3 with: name: xcarchive-macOS path: ./builder/build/macOS.xcarchive - name: Download watchOS Framework uses: actions/download-artifact@v3 with: name: xcarchive-watchOS path: ./builder/build/watchOS.xcarchive - name: Download watchOS-simulator Framework uses: actions/download-artifact@v3 with: name: xcarchive-watchOS-simulator path: ./builder/build/watchOS-simulator.xcarchive - name: Download tvOS Framework uses: actions/download-artifact@v3 with: name: xcarchive-tvOS path: ./builder/build/tvOS.xcarchive - name: Download tvOS-simulator Framework uses: actions/download-artifact@v3 with: name: xcarchive-tvOS-simulator path: ./builder/build/tvOS-simulator.xcarchive - name: Merge Frameworks working-directory: ./builder run: ./merge-frameworks.sh "iOS iOS-simulator macOS watchOS watchOS-simulator tvOS tvOS-simulator" - name: Archive XCFramework working-directory: ./builder/build run: zip --symlinks -r TDLibFramework.zip TDLibFramework.xcframework - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: TDLibFramework.zip path: ./builder/build/TDLibFramework.zip if-no-files-found: error # Tests tests: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: [merge-xcframework] strategy: matrix: include: # https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#installed-sdks - platform: "macOS" - platform: "iOS-simulator" os_list: "16.2" device_name: "iPhone 14" - platform: "tvOS-simulator" os_list: "16.1" device_name: "Apple TV 4K (3rd generation) (at 1080p)" - platform: "watchOS-simulator" os_list: "9.1" device_name: "Apple Watch Series 8 (45mm)" steps: - name: Checkout uses: actions/checkout@v3 - name: Download XCFramework uses: actions/download-artifact@v3 with: name: TDLibFramework.zip path: ${{ env.ARTIFACT_DIR }} - name: Unpack framework working-directory: ${{ env.ARTIFACT_DIR }} run: unzip ${{ env.ARTIFACT_NAME }} - name: Update Package.swift with local .xcframework run: python3 scripts/swift_package_generator.py --path ${{ env.ARTIFACT_DIR }}/TDLibFramework.xcframework - name: Run Tests for ${{ matrix.platform }} run: ./scripts/test.sh ${{ matrix.platform }} "${{ matrix.os_list }}" "${{ matrix.device_name }}" || ./scripts/test.sh ${{ matrix.platform }} "${{ matrix.os_list }}" "${{ matrix.device_name }}" create-release: if: ${{ github.actor != 'dependabot[bot]' }} runs-on: macos-12 needs: [tests] steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Set Envs run: | ARTIFACT_PATH="./builder/build/${{ env.ARTIFACT_NAME }}" echo "ARTIFACT_PATH=$ARTIFACT_PATH" >> $GITHUB_ENV RELEASES_DOWNLOAD_URL=https://github.com/$GITHUB_REPOSITORY/releases/download echo "RELEASES_DOWNLOAD_URL=$RELEASES_DOWNLOAD_URL" >> $GITHUB_ENV TDLIB_COMMIT=$(cd td && git rev-parse --short=8 HEAD) echo "TDLIB_COMMIT=$TDLIB_COMMIT" >> $GITHUB_ENV TDLIB_VERSION=$(python3 scripts/extract_td_version.py td/CMakeLists.txt) echo "TDLIB_VERSION=$TDLIB_VERSION" >> $GITHUB_ENV TDLIB_COMMIT_URL=${{ env.TDLIB_REPO }}/tree/$TDLIB_COMMIT echo "TDLIB_COMMIT_URL=$TDLIB_COMMIT_URL" >> $GITHUB_ENV RELEASE_TAG=$TDLIB_VERSION-$TDLIB_COMMIT echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV - name: Download XCFramework uses: actions/download-artifact@v3 with: name: TDLibFramework.zip path: ${{ env.ARTIFACT_DIR }} - name: Get Checksum run: | ARTIFACT_CHECKSUM=$(swift package compute-checksum ${{ env.ARTIFACT_PATH }}) echo "ARTIFACT_CHECKSUM=$ARTIFACT_CHECKSUM" >> $GITHUB_ENV - name: Update Package.swift if: github.ref == 'refs/heads/main' run: | python3 scripts/swift_package_generator.py --url "${{ env.RELEASES_DOWNLOAD_URL }}/${{ env.RELEASE_TAG }}/${{ env.ARTIFACT_NAME }}" --checksum ${{ env.ARTIFACT_CHECKSUM }} git add Package.swift || true git commit -m "[no ci] Bump tdlib ${{ env.RELEASE_TAG }}" || true git push origin main || true - name: Remove previous release if: github.ref == 'refs/heads/main' uses: dev-drprasad/delete-tag-and-release@85fa8bcea0379a6ada9bbfdcb0a9d24d58e1a0d7 with: delete_release: true tag_name: ${{ env.RELEASE_TAG }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Release if: github.ref == 'refs/heads/main' uses: softprops/action-gh-release@9729932bfb75c05ad1f6e3a729294e05abaa7001 with: target_commitish: main tag_name: ${{ env.RELEASE_TAG }} files: ${{ env.ARTIFACT_PATH }} body: "XCFramework based on TDLib-${{ env.TDLIB_VERSION }} commit [${{ env.TDLIB_COMMIT }}](${{ env.TDLIB_COMMIT_URL }})\n\nZIP Checksum `${{ env.ARTIFACT_CHECKSUM }}`" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}