CI #2471
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.2" | |
device_name: "iPhone 15" | |
- platform: "tvOS-simulator" | |
os_list: "17.2" | |
device_name: "Apple TV 4K (3rd generation) (at 1080p)" | |
# Became much slower on CI with macos-14 images, while working fine locally | |
# we will only build them | |
- platform: "watchOS-simulator" | |
os_list: "10.2" | |
device_name: "Apple Watch Series 9 (45mm)" | |
action: "build" | |
- platform: "visionOS-simulator" | |
os_list: "1.0" | |
device_name: "Apple Vision Pro" | |
action: "build" | |
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 }}" "${{ matrix.action }}" || ./scripts/test.sh ${{ matrix.platform }} "${{ matrix.os_list }}" "${{ matrix.device_name }}" "${{ matrix.action }}" | |
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 [email protected] | |
git add . || true | |
export COMMIT_VERSION=$(python3 <<EOF | |
import json | |
import os | |
with open("versions.json") as f: | |
versions = json.load(f) | |
print(f"{versions["package"]}-tdlib-{versions['tdlib_version']}-{versions['tdlib_commit']}", end="") | |
EOF | |
) | |
git commit -m "[no ci] Version ${COMMIT_VERSION}" || true | |
- name: Push update | |
run: git push origin main || true | |
- name: Release | |
run: | | |
chmod +x ./scripts/* | |
./scripts/release.py | |
env: | |
GH_TOKEN: ${{ github.token }} |