Focus Tests #1
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: "Focus Smoke Tests" | |
on: | |
workflow_dispatch: | |
env: | |
browser: focus-ios | |
xcode_version: 15.4 | |
ios_version: 17.5 | |
ios_simulator_default: iPhone 15 | |
xcodebuild_test_plan: SmokeTest | |
xcodebuild_scheme: Focus | |
xcodebuild_target: XCUITest | |
test_results_directory: /Users/runner/tmp | |
jobs: | |
compile: | |
name: Compile | |
runs-on: macos-14-large | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4.1.7 | |
- name: Setup Xcode | |
id: xcode | |
run: | | |
sudo rm -rf /Applications/Xcode.app | |
sudo xcode-select -s /Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer | |
xcodebuild -version | |
./checkout.sh | |
./bootstrap.sh --force | |
- name: Compile source code | |
id: compile | |
run: | | |
xcodebuild \ | |
-resolvePackageDependencies \ | |
-onlyUsePackageVersionsFromResolvedFile | |
xcodebuild \ | |
build-for-testing \ | |
-scheme ${{ env.xcodebuild_scheme }} \ | |
-target ${{ env.xcodebuild_target }} \ | |
-derivedDataPath ~/DerivedData \ | |
-destination 'platform=iOS Simulator,name=${{ env.ios_simulator_default }},OS=${{ env.ios_version }}' | |
working-directory: ${{ env.browser }} | |
- name: Save Derived Data | |
id: upload-derived-data | |
uses: actions/upload-artifact@v4.3.3 | |
with: | |
name: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }} | |
path: ~/DerivedData/Build/Products | |
retention-days: 2 | |
run-tests: | |
name: Run tests | |
runs-on: macos-14-large | |
needs: compile | |
strategy: | |
fail-fast: false | |
matrix: | |
ios_simulator: [ 'iPhone 15', 'iPad Pro (12.9-inch) (6th generation)'] | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4.1.7 | |
- name: Install packages | |
id: packages | |
run: | | |
brew update | |
brew install xctesthtmlreport | |
- name: Setup Xcode | |
id: xcode | |
run: | | |
sudo rm -rf /Applications/Xcode.app | |
sudo xcode-select -s /Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer | |
xcodebuild -version | |
./checkout.sh | |
./bootstrap.sh --force | |
- name: Get derived data | |
id: download-derived-data | |
uses: actions/download-artifact@v4 | |
with: | |
name: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }} | |
path: ~/DerivedData/Build/Products | |
- name: Run tests | |
id: run-tests | |
run: | | |
xcodebuild \ | |
test-without-building \ | |
-scheme ${{ env.xcodebuild_scheme }} \ | |
-target ${{ env.xcodebuild_target }} \ | |
-derivedDataPath ~/DerivedData \ | |
-destination 'platform=iOS Simulator,name=${{ matrix.ios_simulator }},OS=${{ env.ios_version }}' \ | |
-testPlan ${{ env.xcodebuild_test_plan }} \ | |
-resultBundlePath ${{ env.test_results_directory }}/results | |
working-directory: ${{ env.browser }} | |
continue-on-error: true | |
- name: Prettyprint test report | |
id: test-report | |
run: | | |
xchtmlreport ${{ env.test_results_directory }}/results.xcresult | |
- name: Upload xcresult file to Github | |
id: upload-github | |
uses: actions/upload-artifact@v4.3.3 | |
with: | |
name: ${{ env.browser }}-${{ env.xcodebuild_test_plan }}-${{ matrix.ios_simulator }}-${{ github.run_number }} | |
path: ${{ env.test_results_directory }}/index.html | |
retention-days: 90 | |
- name: Report to Slack | |
id: slack | |
uses: slackapi/slack-github-action@v1.26.0 | |
with: | |
payload-file-path: "./test-fixtures/ci/slack-notification-xcuitest.json" | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
ios_simulator: ${{ matrix.ios_simulator }} | |
pass_fail: ${{ steps.run-tests.outcome == 'success' && ':white_check_mark:' || ':x:' }} | |
ref_name: ${{ github.ref_name }} | |
repository: ${{ github.repository }} | |
run_id: ${{ github.run_id }} | |
server_url: ${{ github.server_url }} | |
- name: Return fail status if a test fails | |
run: | | |
exit ${{ steps.run-tests.outcome == 'success' && '0' || '1' }} |