Swift CI #1465
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: Swift CI | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
push: | |
branches: [ '*' ] | |
paths-ignore: | |
- '**.md' | |
tags: [ '[0-9]+.[0-9]+.[0-9]+' ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
env: | |
DEVELOPER_DIR: /Applications/Xcode_15.4.app | |
jobs: | |
test-ios: | |
runs-on: macos-14 | |
strategy: | |
matrix: | |
include: | |
- destination: platform=iOS Simulator,name=iPhone 8 | |
platform: iphone | |
- destination: platform=tvOS Simulator,name=Apple TV | |
platform: appletv | |
- destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm) | |
platform: watch | |
- destination: platform=visionOS Simulator,name=Apple Vision Pro | |
platform: watch | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Tests | |
run: | | |
set -o pipefail | |
xcodebuild build-for-testing -project ConfigCat.xcodeproj -scheme "ConfigCat" -destination "${{ matrix.destination }}" CODE_SIGNING_REQUIRED=NO -quiet | |
xcodebuild test-without-building -project ConfigCat.xcodeproj -scheme "ConfigCat" -destination "${{ matrix.destination }}" CODE_SIGNING_REQUIRED=NO -resultBundlePath tests/${{ matrix.platform }}.xcresult | |
- name: Archive results | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: tests | |
test-osx: | |
runs-on: macos-14 | |
strategy: | |
matrix: | |
include: | |
- sdk: macosx14.5 | |
destination: arch=x86_64 | |
platform: macos | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Tests | |
run: | | |
set -o pipefail | |
xcodebuild build-for-testing -sdk ${{ matrix.sdk }} -project ConfigCat.xcodeproj -scheme "ConfigCat" -destination "${{ matrix.destination }}" -quiet | |
xcodebuild test-without-building -sdk ${{ matrix.sdk }} -project ConfigCat.xcodeproj -scheme "ConfigCat" -destination "${{ matrix.destination }}" -resultBundlePath tests/${{ matrix.platform }}.xcresult | |
- name: Archive results | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: tests | |
coverage: | |
needs: [test-ios, test-osx] | |
runs-on: macos-14 | |
strategy: | |
matrix: | |
include: | |
- sdk: macosx14.5 | |
destination: arch=x86_64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Slather | |
run: | | |
gem install slather | |
brew install sonar-scanner | |
- name: Execute Coverage | |
run: | | |
set -o pipefail | |
xcodebuild build-for-testing -sdk ${{ matrix.sdk }} -project ConfigCat.xcodeproj -scheme "ConfigCat Coverage" -destination "${{ matrix.destination }}" -quiet | |
xcodebuild test-without-building -sdk ${{ matrix.sdk }} -project ConfigCat.xcodeproj -scheme "ConfigCat Coverage" -destination "${{ matrix.destination }}" -quiet | |
slather | |
- name: Run Sonar | |
run: | | |
git fetch --unshallow --no-tags | |
sonar-scanner -Dsonar.token=${{ secrets.SONAR_TOKEN }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
pod-lint: | |
needs: coverage | |
runs-on: macos-14 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Cocoapods | |
run: gem install cocoapods | |
- name: Enable VisionOS | |
run: | | |
defaults write com.apple.dt.Xcode AllowUnsupportedVisionOSHost -bool YES | |
defaults write com.apple.CoreSimulator AllowUnsupportedVisionOSHost -bool YES | |
xcodebuild -downloadPlatform visionOS | |
- name: Lint | |
run: pod lib lint | |
publish: | |
needs: pod-lint | |
runs-on: macos-14 | |
if: startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Cocoapods | |
run: gem install cocoapods | |
- name: Publish | |
run: pod trunk push | |
env: | |
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} | |
# Prevent GitHub from suspending your cronjob based triggers due to repository inactivity | |
keepalive: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: gautamkrishnar/keepalive-workflow@v2 | |