name: CI # Controls when the workflow will run on: push: branches: [main] paths: - "version" # on version updates - "Package.swift" - "Package.resolved" - "Tests/**" - .github/workflows/ci.yml - "scripts/**" pull_request: branches: [main] schedule: - cron: '0 */12 * * *' # Every 12 hours # Allows you to run this workflow manually from the Actions tab workflow_dispatch: concurrency: group: ci-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true env: TDLIB_REPO: https://github.com/tdlib/td DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer permissions: contents: write jobs: update: runs-on: macos-14 steps: - name: Checkout uses: actions/checkout@v4 - name: Update package run: ./scripts/update.py env: GH_TOKEN: ${{ github.token }} - run: rm -rf .git - name: Upload Workspace uses: actions/upload-artifact@v4 with: name: TDLibKit-${{ github.sha }} path: . if-no-files-found: error test: runs-on: macos-14 needs: [update] strategy: matrix: include: - platform: "macOS" - platform: "iOS-simulator" os_list: "17.0.1" device_name: "iPhone 14" - platform: "tvOS-simulator" os_list: "17.0" device_name: "Apple TV 4K (3rd generation) (at 1080p)" # Became much slower on CI with macos-14 images, while working fine locally # - platform: "watchOS-simulator" # os_list: "9.4" # device_name: "Apple Watch Series 8 (45mm)" - platform: "visionOS-simulator" os_list: "1.0" device_name: "Apple Vision Pro" steps: - name: Download Workspace uses: actions/download-artifact@v4 with: name: TDLibKit-${{ github.sha }} path: . - name: Tests (${{ matrix.platform }}) run: | chmod +x ./scripts/test.sh ./scripts/test.sh ${{ matrix.platform }} "${{ matrix.os_list }}" "${{ matrix.device_name }}" || ./scripts/test.sh ${{ matrix.platform }} "${{ matrix.os_list }}" "${{ matrix.device_name }}" release: if: ${{ github.ref == 'refs/heads/main' }} runs-on: macos-14 needs: [test] steps: - name: Setup Git uses: actions/checkout@v4 - name: Download Workspace uses: actions/download-artifact@v4 with: name: TDLibKit-${{ github.sha }} path: . - name: Commit Files run: | git config user.name github-actions git config user.email github-actions@github.com git add . || true git commit -m "[no ci] Version $(python3 -c 'import json; print(json.load(open("versions.json"))["package"])')" || true - name: Push update run: git push origin main || true - name: Release run: | chmod +x ./scripts/* ./scripts/release.py env: GH_TOKEN: ${{ github.token }}