[BITAU-194] Fix issue with unit tests failing occasionally; Add tests for NotifcationCenterService #4111
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_target: | |
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 | |
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 | |
env: | |
COVERAGE_PATH: build/coverage.xml | |
MINT_LINK_PATH: .mint/bin | |
MINT_PATH: .mint/lib | |
RESULT_BUNDLE_PATH: build/BitwardenTests.xcresult | |
SIMULATOR_NAME: ${{ inputs.simulator-name }} | |
SIMULATOR_VERSION: ${{ inputs.simulator-version }} | |
XCODE_VERSION: ${{ inputs.xcode-version }} | |
jobs: | |
check-run: | |
name: Check PR run | |
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main | |
test: | |
name: Test | |
runs-on: macos-15-xlarge | |
needs: check-run | |
permissions: | |
contents: read | |
issues: write | |
pull-requests: write | |
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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Read default Xcode version and simulator configuration | |
run: | | |
echo "DEFAULT_XCODE_VERSION=$(cat .xcode-version | tr -d '\n')" >> "$GITHUB_ENV" | |
echo "DEFAULT_SIMULATOR_NAME=$(cat .test-simulator-device-name | tr -d '\n')" >> "$GITHUB_ENV" | |
echo "DEFAULT_SIMULATOR_VERSION=$(cat .test-simulator-ios-version | tr -d '\n')" >> "$GITHUB_ENV" | |
- name: Set Xcode version | |
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0 | |
with: | |
xcode-version: ${{ env.XCODE_VERSION || env.DEFAULT_XCODE_VERSION }} | |
- name: Configure Ruby | |
uses: ruby/setup-ruby@f26937343756480a8cb3ae1f623b9c8d89ed6984 # v1.196.0 | |
with: | |
bundler-cache: true | |
- name: Cache Mint packages | |
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 | |
with: | |
path: .mint | |
key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }} | |
restore-keys: | | |
${{ runner.os }}-mint- | |
- name: Cache SPM packages | |
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 | |
with: | |
path: build/DerivedData/SourcePackages | |
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-spm- | |
- name: Install yeetd | |
run: | | |
wget https://github.com/biscuitehh/yeetd/releases/download/1.0/yeetd-normal.pkg | |
sudo installer -pkg yeetd-normal.pkg -target / | |
yeetd & | |
- name: Install Mint, xcbeautify, and xcresultparser | |
run: | | |
brew install mint xcbeautify a7ex/homebrew-formulae/xcresultparser | |
./Scripts/bootstrap.sh | |
- name: Build and test | |
run: | | |
set -o pipefail && \ | |
xcrun xcodebuild test \ | |
-project Bitwarden.xcodeproj \ | |
-scheme Bitwarden \ | |
-configuration Debug \ | |
-destination "platform=iOS Simulator,name=${{ env.SIMULATOR_NAME || env.DEFAULT_SIMULATOR_NAME }},OS=${{ env.SIMULATOR_VERSION || env.DEFAULT_SIMULATOR_VERSION }}" \ | |
-resultBundlePath ${{ env.RESULT_BUNDLE_PATH }} \ | |
-derivedDataPath build/DerivedData \ | |
| 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 | |
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 | |
with: | |
plugin: xcode | |
file: ${{ env.COVERAGE_PATH }} | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |