changeset 41:6337272f1dee

Update swift.yml committer: GitHub <noreply@github.com>
author Dennis C. M. <dennis@denniscm.com>
date Sat, 01 May 2021 11:20:52 +0200
parents 80ba8b8f0fcc
children c606924b2dd2
files .github/workflows/swift.yml
diffstat 1 files changed, 21 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/.github/workflows/swift.yml	Sat May 01 11:11:18 2021 +0200
+++ b/.github/workflows/swift.yml	Sat May 01 11:20:52 2021 +0200
@@ -1,19 +1,28 @@
-name: Swift
+name: Unit Test
 
-on:
-  push:
-    branches: [ main ]
-  pull_request:
-    branches: [ main ]
+# We will trigger this workflow whenever someone pushes to the repo.
+on: [push]
 
 jobs:
   build:
 
-    runs-on: macos-latest
+    # We want our unit tests to be run on the latest available version of
+    # macOS that Github Actions supports.
+    runs-on: macOS-latest
 
     steps:
-    - uses: actions/checkout@v2
-    - name: Build for iOS
-      run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild build-for-testing -scheme StockCharts -destination "platform=iOS Simulator,OS=latest,name=iPhone 12" | xcpretty
-    - name: Run iOS tests
-      run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild test-without-building -scheme StockCharts -destination "platform=iOS Simulator,OS=latest,name=iPhone 12" | xcpretty
+    - uses: actions/checkout@v1
+    # Github Actions' machines do in fact have recent versions of Xcode,
+    # but you may have to explicitly switch to them.  We explicitly want
+    # to use Xcode 11, so we use xcode-select to switch to it.
+    - name: Switch to Xcode 11
+      run: sudo xcode-select --switch /Applications/Xcode_11.1.app
+    # Since we want to be running our tests from Xcode, we need to
+    # generate an .xcodeproj file.  Luckly, Swift Package Manager has
+    # build in functionality to do so.
+    - name: Generate xcodeproj
+      run: swift package generate-xcodeproj
+    # Finally, we invoke xcodebuild to run the tests on an iPhone 11
+    # simulator.
+    - name: Run tests
+      run: xcodebuild test -destination 'name=iPhone 11' -scheme 'StockCharts'