xcbeautify #16
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: Unit Tests | |
on: | |
pull_request: | |
branches: | |
- 'main' | |
merge_group: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
SCHEME: "DBThreadSafe" | |
jobs: | |
unit-tests-spm: | |
runs-on: 'macos-13' | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
DESTINATION: ["platform=iOS Simulator,name=iPhone 15", "platform=OS X", "platform=tvOS Simulator,name=Apple TV", "platform=watchOS Simulator,name=Apple Watch Ultra (49mm)"] | |
steps: | |
- name: Get source code | |
uses: actions/checkout@v3 | |
- name: Prepare Environment for App Build | |
uses: ./.github/actions/prepare_env_app_build | |
- name: Resolve Dependencies | |
run: > | |
set -o pipefail && xcodebuild -resolvePackageDependencies | |
-scheme ${{ env.SCHEME }} | |
-destination '${{ matrix.DESTINATION }}' | |
| xcbeautify --renderer github-actions | |
- name: Build | |
run: > | |
set -o pipefail && xcodebuild build-for-testing | |
-scheme ${{ env.SCHEME }} | |
-destination '${{ matrix.DESTINATION }}' | |
| xcbeautify --renderer github-actions | |
- name: Test | |
id: tests | |
run: | | |
resultBundlePath="${{ env.SCHEME }}-${{ matrix.DESTINATION }}-${{ github.run_number }}-${{ github.run_attempt }}.xcresult" | |
set -o pipefail && xcodebuild test-without-building \ | |
-scheme ${{ env.SCHEME }} \ | |
-destination '${{ matrix.DESTINATION }}' \ | |
-resultBundlePath "$resultBundlePath" \ | |
| xcbeautify --renderer github-actions | |
echo "resultBundlePath=$resultBundlePath">> $GITHUB_OUTPUT | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.tests.outputs.resultBundlePath }} | |
path: ${{ steps.tests.outputs.resultBundlePath }} | |
if: success() || failure() | |
# This allows us to have a branch protection rule for tests and deploys with matrix | |
status-for-matrix: | |
runs-on: 'macos-latest' | |
needs: ['unit-tests-spm'] | |
if: always() | |
steps: | |
- name: Successful deploy | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: Failing deploy | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 |