[EMBR-4464] Hook Swift tests up to CI #20
Workflow file for this run
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: packages/core/ios Unit Test | |
on: | |
pull_request: | |
branches: | |
- 5.0 # TBD update branch name | |
jobs: | |
build: | |
strategy: | |
matrix: | |
node-version: [18.x] | |
os: [macos-latest] | |
swift: ["5.3"] | |
runs-on: ${{ matrix.os }} | |
env: | |
OS: 17.5 | |
PLATFORM: "iOS Simulator" | |
DEVICE: "iPhone 15 Pro" | |
TEST_PROJECT_PATH: packages/core/test-project | |
WORKSPACE: "RNEmbraceTestProject" | |
SCHEME: "RNEmbraceTests" | |
XCPRETTY_JSON_FILE_OUTPUT: reports/tests.json | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
- name: Enables corepack | |
run: corepack enable | |
- name: Yarn dependencies | Global | |
run: yarn install --immutable | |
- name: Yarn dependencies | Test Project | |
run: | | |
cd ${{ env.TEST_PROJECT_PATH }} | |
yarn install | |
- name: Cache CocoaPods | |
id: cache-cocoapods | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ env.TEST_PROJECT_PATH }}/ios/Pods | |
${{ env.TEST_PROJECT_PATH }}/ios/Podfile.lock | |
key: ${{ runner.os }}-pods-${{ hashFiles('${{ env.TEST_PROJECT_PATH }}/ios/Podfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pods- | |
- name: Install CocoaPods | |
run: | | |
cd ${{ env.TEST_PROJECT_PATH }}/ios | |
sudo gem install cocoapods | |
pod install | |
if: steps.cache-cocoapods.outputs.cache-hit != 'true' | |
- name: Cache Derived Data | |
uses: actions/cache@v3 | |
with: | |
path: ~/Library/Developer/Xcode/DerivedData | |
key: derived-data-${{ runner.os }}-${{ hashFiles('**/*.xcodeproj/project.pbxproj') }}-${{ hashFiles('Podfile.lock') }} | |
restore-keys: | | |
derived-data-${{ runner.os }}- | |
- name: Run iOS unit tests | |
run: | | |
cd ${{ env.TEST_PROJECT_PATH }} | |
xcodebuild test -workspace ios/${{ env.WORKSPACE }}.xcworkspace -scheme ${{ env.SCHEME }} -destination "platform=${{ env.PLATFORM }},name=${{ env.DEVICE }},OS=${{ env.OS }}" \ | |
OTHER_SWIFT_FLAGS="-Wno-documentation" | xcpretty --test --color | |
env: | |
XCPRETTY_JSON_FILE_OUTPUT: ${{ env.XCPRETTY_JSON_FILE_OUTPUT }} | |
continue-on-error: true | |
- name: Upload Unit Test Results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: unit-test-report | |
path: ${{ env.XCPRETTY_JSON_FILE_OUTPUT }} |