Skip to content

Instantly share code, notes, and snippets.

@ricardopereira
Created June 30, 2020 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricardopereira/10198e68f27c14601d77ebc7a8352da1 to your computer and use it in GitHub Desktop.
Save ricardopereira/10198e68f27c14601d77ebc7a8352da1 to your computer and use it in GitHub Desktop.
GitHub Action example running Xcode tests and caches dependencies
on:
push:
branches:
- develop
name: Build
jobs:
iOS:
name: Unit Tests
runs-on: macOS-latest
strategy:
matrix:
destination: ['platform=iOS Simulator,OS=13.5,name=iPhone 11']
steps:
- name: Checkout
uses: actions/checkout@v1
- uses: actions/cache@v2
id: carthage-cache
with:
path: Carthage
key: ${{ runner.os }}-carthage-${{ hashFiles('**/Cartfile.resolved') }}
restore-keys: |
${{ runner.os }}-carthage-
- uses: actions/cache@v2
id: cocoapods-cache
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Carthage
if: steps.carthage-cache.outputs.cache-hit != 'true'
run: |
carthage bootstrap --no-use-binaries --platform iOS --cache-builds
rm -rf ./Carthage/Build/iOS/*.dSYM
- name: CocoaPods
if: steps.cocoapods-cache.outputs.cache-hit != 'true'
run: |
pod install
- name: Build
run: |
mv Optimize/Secrets.swift.example Optimize/Secrets.swift
xcodebuild build test -workspace ./Optimize.xcworkspace -scheme Optimize -destination "${destination}"
env:
destination: ${{ matrix.destination }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment