Skip to content

Commit

Permalink
[PM-15877] fix(ci): Xcode Version empty in AppStoreConnect release no…
Browse files Browse the repository at this point in the history
…tes (#1287)
  • Loading branch information
vvolkgang authored Jan 23, 2025
1 parent e7ea8b1 commit 96a598c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 29 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,16 @@ jobs:
name: version-info
path: version-info/version_info.json

- name: Read default Xcode version
- name: Read Xcode version from file if not provided
run: |
echo "_DEFAULT_XCODE_VERSION=$(cat .xcode-version | tr -d '\n')" >> "$GITHUB_ENV"
if [ -z "$_XCODE_VERSION" ]; then
echo "_XCODE_VERSION=$(cat .xcode-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 || env._DEFAULT_XCODE_VERSION }}
xcode-version: ${{ env._XCODE_VERSION }}

- name: Cache Mint packages
id: mint-cache
Expand Down Expand Up @@ -387,7 +389,7 @@ jobs:
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: Bitwarden iOS ${{ steps.version_info.outputs.version_name }} (${{ steps.version_info.outputs.version_number }}) ${{ env._BUILD_VARIANT }} ${{ env._XCODE_VERSION || env.DEFAULT_XCODE_VERSION }} ${{ env._BUILD_MODE }} ${{ env._COMPILER_FLAGS }}
name: Bitwarden iOS ${{ steps.version_info.outputs.version_name }} (${{ steps.version_info.outputs.version_number }}) ${{ env._BUILD_VARIANT }} ${{ env._XCODE_VERSION }} ${{ env._BUILD_MODE }} ${{ env._COMPILER_FLAGS }}
path: export
if-no-files-found: error

Expand All @@ -413,8 +415,8 @@ jobs:
run: |
CHANGELOG="$(git show -s --format=%s)
$GITHUB_REPOSITORY/$GITHUB_REF_NAME @ $GITHUB_SHA
Xcode ${{ env._XCODE_VERSION }}
Compiler Flags: ${{ inputs.compiler-flags }}
Xcode $_XCODE_VERSION
Compiler Flags: $_COMPILER_FLAGS
$_GITHUB_ACTION_RUN_URL"
fastlane upload_build \
Expand Down
47 changes: 24 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ on:
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 }}
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
_RESULT_BUNDLE_PATH: build/BitwardenTests.xcresult
_SIMULATOR_NAME: ${{ inputs.simulator-name }}
_SIMULATOR_VERSION: ${{ inputs.simulator-version }}
_XCODE_VERSION: ${{ inputs.xcode-version }}
_GITHUB_ACTION_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}

jobs:
Expand All @@ -62,16 +62,22 @@ jobs:
- name: Check out repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Read default Xcode version and simulator configuration
- name: Read Xcode version and simulator configuration from file if not provided
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"
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 || env.DEFAULT_XCODE_VERSION }}
xcode-version: ${{ env._XCODE_VERSION }}

- name: Configure Ruby
uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4 # v1.207.0
Expand Down Expand Up @@ -100,16 +106,13 @@ jobs:
./Scripts/bootstrap.sh
- name: Build and test
env:
_SIMULATOR_NAME: ${{ env.SIMULATOR_NAME || env.DEFAULT_SIMULATOR_NAME }}
_SIMULATOR_VERSION: ${{ env.SIMULATOR_VERSION || env.DEFAULT_SIMULATOR_VERSION }}
run: |
xcrun xcodebuild test \
-project Bitwarden.xcodeproj \
-scheme Bitwarden \
-configuration Debug \
-destination "platform=iOS Simulator,name=$_SIMULATOR_NAME,OS=$_SIMULATOR_VERSION" \
-resultBundlePath $RESULT_BUNDLE_PATH \
-resultBundlePath $_RESULT_BUNDLE_PATH \
-derivedDataPath build/DerivedData \
-test-timeouts-enabled yes \
-maximum-test-execution-time-allowance 1 \
Expand All @@ -118,15 +121,15 @@ jobs:
- name: Print Logs Summary
if: always()
run: |
xcresultparser -o cli "$RESULT_BUNDLE_PATH"
xcresultparser -o cli "$_RESULT_BUNDLE_PATH"
echo "# Test Summary" >> $GITHUB_STEP_SUMMARY
xcresultparser -f -o txt "$RESULT_BUNDLE_PATH" | grep "Number of" >> $GITHUB_STEP_SUMMARY
xcresultparser -f -o txt "$_RESULT_BUNDLE_PATH" | grep "Number of" >> $GITHUB_STEP_SUMMARY
- name: Convert coverage to Cobertura
run: |
set -o pipefail && \
xcresultparser --output-format cobertura \
"$RESULT_BUNDLE_PATH" > "$COVERAGE_PATH"
"$_RESULT_BUNDLE_PATH" > "$_COVERAGE_PATH"
- name: Upload test reports
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
Expand All @@ -135,10 +138,8 @@ jobs:
name: test-reports
compression-level: 9
path: |
${{ env.COVERAGE_PATH }}
${{ env.RESULT_BUNDLE_PATH }}
${{ env._COVERAGE_PATH }}
${{ env._RESULT_BUNDLE_PATH }}
report:
name: Process Test Reports
Expand Down

0 comments on commit 96a598c

Please sign in to comment.