Skip to content

Update SDK to 7de7263 (1.0.0-3328-a8a19d3) #1484

Update SDK to 7de7263 (1.0.0-3328-a8a19d3)

Update SDK to 7de7263 (1.0.0-3328-a8a19d3) #1484

Workflow file for this run

name: Test Authenticator
on:
# push:
# branches:
# - "main"
# - "rc"
# - "hotfix-rc"
pull_request:
types: [opened, synchronize]
paths-ignore:
- Bitwarden/**
- BitwardenActionExtension/**
- BitwardenAutoFillExtension/**
- BitwardenShared/**
- BitwardenShareExtension/**
- BitwardenWatchApp/**
- BitwardenWatchWidgetExtension/**
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:
MINT_LINK_PATH: .mint/bin # used by mint in bootstrap.sh
MINT_PATH: .mint/lib # used by mint in bootstrap.sh
_COVERAGE_PATH: build/coverage.xml
_BUILD_RESULT_BUNDLE_PATH: build/bwa-build.xcresult
_TESTS_RESULT_BUNDLE_PATH: build/bwa-tests.xcresult
_SIMULATOR_NAME: ${{ inputs.simulator-name }}
_SIMULATOR_VERSION: ${{ inputs.simulator-version }}
_XCODE_VERSION: ${{ inputs.xcode-version }}
_COMPILER_FLAGS: ${{ inputs.compiler-flags }}
_GITHUB_ACTION_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}
jobs:
test:
name: Test
runs-on: macos-26
timeout-minutes: 50
permissions:
contents: read
steps:
- name: Log inputs to job summary
uses: bitwarden/ios/.github/actions/log-inputs@main
with:
inputs: "${{ toJson(inputs) }}"
- name: Check out repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Optimize macOS Runner
uses: ./.github/actions/macos-runner-tuneup
- 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@44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0
with:
bundler-cache: true
- name: Cache Mint packages
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: .mint
key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }}
restore-keys: |
${{ runner.os }}-mint-
- name: Cache SPM packages
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: build/DerivedData/SourcePackages
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Update local config
run: |
./Scripts-bwa/update_test_local_config.sh "${_COMPILER_FLAGS}"
- name: Install Homebrew Dependencies and run bootstrap.sh
run: |
brew update
brew bundle
./Scripts/bootstrap.sh
- name: Boot Simulator
id: boot-simulator
uses: ./.github/actions/boot-simulator
with:
simulator-name: ${{ env._SIMULATOR_NAME }}
simulator-version: ${{ env._SIMULATOR_VERSION }}
- name: Build
env:
_SIMULATOR_ID: ${{ steps.boot-simulator.outputs.simulator-id }}
run: |
python Scripts/pyeetd/main.py & PYEETD_PID=$!
xcrun xcodebuild build-for-testing \
-workspace Bitwarden.xcworkspace \
-scheme Authenticator \
-configuration Debug \
-destination "platform=iOS Simulator,id=$_SIMULATOR_ID" \
-derivedDataPath build/DerivedData \
-resultBundlePath "$_BUILD_RESULT_BUNDLE_PATH" \
-quiet
kill "$PYEETD_PID"
- name: Test
env:
_SIMULATOR_ID: ${{ steps.boot-simulator.outputs.simulator-id }}
run: |
python Scripts/pyeetd/main.py & PYEETD_PID=$!
xcrun xcodebuild test-without-building \
-workspace Bitwarden.xcworkspace \
-scheme Authenticator \
-configuration Debug \
-destination "platform=iOS Simulator,id=$_SIMULATOR_ID" \
-resultBundlePath "$_TESTS_RESULT_BUNDLE_PATH" \
-derivedDataPath build/DerivedData \
-test-timeouts-enabled yes \
-maximum-test-execution-time-allowance 1 \
-quiet
kill "$PYEETD_PID"
- name: Print Logs Summary
if: always()
run: |
xcresultparser -o cli "$_TESTS_RESULT_BUNDLE_PATH"
echo "# Test Summary" >> "$GITHUB_STEP_SUMMARY"
xcresultparser -f -o txt "$_TESTS_RESULT_BUNDLE_PATH" | grep "Number of" >> "$GITHUB_STEP_SUMMARY"
- name: Convert coverage to Cobertura
run: |
set -o pipefail && \
xcresultparser --output-format cobertura \
"$_TESTS_RESULT_BUNDLE_PATH" > "$_COVERAGE_PATH"
- name: Upload test reports
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
if: always()
with:
name: test-reports
compression-level: 9
path: |
${{ env._COVERAGE_PATH }}
${{ env._TESTS_RESULT_BUNDLE_PATH }}
${{ env._BUILD_RESULT_BUNDLE_PATH }}
report:
name: Process Test Reports
needs: test
runs-on: ubuntu-24.04
permissions:
issues: write
pull-requests: write
if: success()
steps:
- name: Check out repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
sparse-checkout: .github/codecov.yml
sparse-checkout-cone-mode: false
persist-credentials: false
- name: Download test artifacts
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: test-reports
- name: Upload to codecov.io
id: upload-to-codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
continue-on-error: true
with:
files: coverage.xml
fail_ci_if_error: true
version: v11.2.3 # Do not bump until this is fixed: https://github.com/getsentry/prevent-cli/issues/101
- name: Comment PR if tests failed
if: steps.upload-to-codecov.outcome == 'failure'
env:
PR_NUMBER: ${{ github.event.number }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUN_ACTOR: ${{ github.triggering_actor }}
run: |
echo "> [!WARNING]" >> "$GITHUB_STEP_SUMMARY"
echo "> Uploading code coverage report failed. Please check the \"Upload to codecov.io\" step of \"Process Test Reports\" job for more details." >> "$GITHUB_STEP_SUMMARY"
if [ ! -z "$PR_NUMBER" ]; then
message=$'> [!WARNING]\n> @'$RUN_ACTOR' Uploading code coverage report failed. Please check the "Upload to codecov.io" step of [Process Test Reports job]('$_GITHUB_ACTION_RUN_URL') for more details.'
gh pr comment --repo "$GITHUB_REPOSITORY" "$PR_NUMBER" --body "$message"
fi