[PM-17411] Pull simulator type/version from file for testing #17
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: Test | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
- "rc" | ||
- "hotfix-rc" | ||
pull_request: | ||
types: [opened, synchronize] | ||
workflow_dispatch: | ||
inputs: | ||
xcode-version: | ||
description: "Xcode version override - e.g. '15.2'" | ||
type: string | ||
simulator-name: | ||
description: "Simulator name override - e.g. 'iPhone 16 Pro'" | ||
type: string | ||
simulator-version: | ||
description: "Simulator iOS version override - e.g. '18.0.1'" | ||
type: string | ||
compiler-flags: | ||
description: "Compiler Flags - e.g. 'DEBUG_MENU FEATURE2'" | ||
type: string | ||
workflow_call: | ||
inputs: | ||
xcode-version: | ||
description: "Xcode version override - e.g. '15.2'" | ||
type: string | ||
simulator-name: | ||
description: "Simulator name override - e.g. 'iPhone 16 Pro'" | ||
type: string | ||
simulator-version: | ||
description: "Simulator iOS version override - e.g. '18.0.1'" | ||
type: string | ||
compiler-flags: | ||
description: "Compiler Flags - e.g. 'DEBUG_MENU FEATURE2'" | ||
type: string | ||
env: | ||
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer | ||
MINT_LINK_PATH: .mint/bin | ||
MINT_PATH: .mint/lib | ||
SIMULATOR_DESTINATION: platform=iOS Simulator,name=iPhone 15 Pro,OS=17.0.1 | ||
RESULT_BUNDLE_PATH: build/AuthenticatorTests.xcresult | ||
COVERAGE_PATH: build/coverage.xml | ||
XCODE_VERSION: 15.4 | ||
_SIMULATOR_NAME: ${{ inputs.simulator-name }} | ||
_SIMULATOR_VERSION: ${{ inputs.simulator-version }} | ||
_XCODE_VERSION: ${{ inputs.xcode-version }} | ||
_COMPILER_FLAGS: ${{ inputs.compiler-flags }} | ||
jobs: | ||
test: | ||
name: Test | ||
runs-on: macos-14-xlarge | ||
needs: check-run | ||
permissions: | ||
contents: read | ||
steps: | ||
- name: Log inputs to job summary | ||
run: | | ||
echo "<details><summary>Build Workflow Inputs</summary>" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
echo '```json' >> $GITHUB_STEP_SUMMARY | ||
echo '${{ toJson(inputs) }}' >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
echo "</details>" >> $GITHUB_STEP_SUMMARY | ||
- name: Check out repo | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Read Xcode version and simulator configuration from file if not provided | ||
run: | | ||
if [ -z "$_XCODE_VERSION" ]; then | ||
echo "_XCODE_VERSION=$(cat .xcode-version | tr -d '\n')" >> "$GITHUB_ENV" | ||
fi | ||
if [ -z "$_SIMULATOR_NAME" ]; then | ||
echo "_SIMULATOR_NAME=$(cat .test-simulator-device-name | tr -d '\n')" >> "$GITHUB_ENV" | ||
fi | ||
if [ -z "$_SIMULATOR_VERSION" ]; then | ||
echo "_SIMULATOR_VERSION=$(cat .test-simulator-ios-version | tr -d '\n')" >> "$GITHUB_ENV" | ||
fi | ||
- name: Set Xcode version | ||
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0 | ||
with: | ||
xcode-version: ${{ env._XCODE_VERSION }} | ||
- name: Configure Ruby | ||
uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4 # v1.207.0 | ||
with: | ||
bundler-cache: true | ||
- name: Cache Mint packages | ||
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | ||
with: | ||
path: .mint | ||
key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }} | ||
restore-keys: | | ||
${{ runner.os }}-mint- | ||
- name: Cache SPM packages | ||
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | ||
with: | ||
path: build/DerivedData/SourcePackages | ||
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | ||
restore-keys: | | ||
${{ runner.os }}-spm- | ||
- name: Update local config | ||
run: | | ||
./Scripts/update_test_local_config.sh "${{ env._COMPILER_FLAGS }}" | ||
- name: Install Mint and xcresultparser | ||
run: | | ||
brew install mint xcresultparser | ||
./Scripts-bwa/bootstrap.sh | ||
- name: Build and test | ||
run: | | ||
set -o pipefail && \ | ||
xcodebuild test \ | ||
-project Authenticator.xcodeproj \ | ||
-scheme Authenticator \ | ||
-configuration Debug \ | ||
-destination "${{ env.SIMULATOR_DESTINATION }}" \ | ||
-resultBundlePath ${{ env.RESULT_BUNDLE_PATH }} \ | ||
-derivedDataPath build/DerivedData \ | ||
-enableCodeCoverage YES \ | ||
| xcbeautify --renderer github-actions | ||
- name: Convert coverage to Cobertura | ||
run: | | ||
set -o pipefail && \ | ||
xcresultparser --output-format cobertura \ | ||
"$RESULT_BUNDLE_PATH" >"$COVERAGE_PATH" | ||
- name: Upload to codecov.io | ||
id: upload-to-codecov | ||
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2 | ||
continue-on-error: true | ||
with: | ||
plugin: xcode | ||
files: ${{ env.COVERAGE_PATH }} |