Skip to content

Commit

Permalink
Update ci.yml to run iOS unit tests in CI (#17)
Browse files Browse the repository at this point in the history
Also add a comment for the right command to successfully run tests.

Based on https://qualitycoding.org/github-actions-ci-xcode/
Uses git restore to clean up Podfile.lock changes after build completes.
  • Loading branch information
emerssso authored Jan 30, 2025
1 parent 4273c99 commit 2ac6aab
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: macos-latest

steps:
- uses: actions/checkout@v4
Expand All @@ -37,7 +37,7 @@ jobs:
with:
java-version: 17
distribution: 'temurin'

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4

Expand All @@ -62,6 +62,26 @@ jobs:

- name: Run Android unit tests
run: cd example/android && gradle test

- name: Install Dependencies
run: cd example/ios && pod install

- name: Run iOS unit tests
run: |
cd example/ios && \
xcodebuild test \
-workspace Runner.xcworkspace \
-scheme Runner \
-configuration Debug \
-sdk iphonesimulator \
-disableAutomaticPackageResolution \
-destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' \
CODE_SIGNING_ALLOWED='NO'
# Revert the file that get's mutated by pod install
# to avoid angering flutter pub publish
- name: iOS Cleanup
run: git restore example/ios/Podfile.lock

- name: Test docs generation
run: dart doc --dry-run
Expand Down
8 changes: 4 additions & 4 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
FullStory: 621fce986e63959bc29a8864dfc05ea6a3fe6403
fullstory_flutter: 76898492c1a251f9628bd52beca0b53db808f981
integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
webview_flutter_wkwebview: 0982481e3d9c78fd5c6f62a002fcd24fc791f1e4
fullstory_flutter: 82276b0edaf3d683dc45991adb0c39c0196a2a9e
integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586e
webview_flutter_wkwebview: 44d4dee7d7056d5ad185d25b38404436d56c547c

PODFILE CHECKSUM: 9c46fd01abff66081b39f5fa5767b3f1d0b11d76

COCOAPODS: 1.15.2
COCOAPODS: 1.16.2
3 changes: 2 additions & 1 deletion example/ios/RunnerTests/RunnerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import XCTest
// This demonstrates a simple unit test of the Swift portion of this plugin's implementation.
//
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.

// Run with:
// xcodebuild test -workspace Runner.xcworkspace -scheme Runner -configuration Debug -destination 'platform=iOS Simulator,name=iPhone 16,OS=latest'
class RunnerTests: XCTestCase {

func testGetFsVersion() {
Expand Down

0 comments on commit 2ac6aab

Please sign in to comment.