WIP #437
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: Tests | |
on: | |
push: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
unit-tests: | |
name: Unit Tests (${{ matrix.build.sdk }}) | |
runs-on: ${{ matrix.build.runs-on }} | |
timeout-minutes: 30 | |
strategy: | |
matrix: | |
build: | |
[ | |
{ | |
sdk: "iphonesimulator", | |
destination: "platform=iOS Simulator,OS=18.0,name=iPhone 16 Pro", | |
action: "test", | |
runs-on: "macos-14", | |
}, | |
{ | |
sdk: "xros", | |
destination: "platform=visionOS Simulator,OS=2.1,name=Apple Vision Pro", | |
action: "build", | |
runs-on: "macos-15", | |
}, | |
] | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Check environment | |
run: | | |
set -ex | |
xcodebuild -version | |
swift --version | |
xcrun simctl list | |
- name: Run Tests | |
run: | | |
set -o pipefail && \ | |
env NSUnbufferedIO=YES \ | |
xcodebuild -workspace . \ | |
-scheme "TPPDF" \ | |
-sdk "${{ matrix.build.sdk }}" \ | |
-destination "${{ matrix.build.destination }}" \ | |
-configuration Debug \ | |
${{ matrix.build.action == 'test' && '-enableCodeCoverage YES' || '' }} \ | |
-derivedDataPath /tmp/DerivedData \ | |
-resultBundlePath test_output \ | |
CODE_SIGNING_ALLOWED="NO" \ | |
${{ matrix.build.action }} 2>&1 | tee test.log | xcbeautify | |
- name: Upload test log file on error | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: test.log | |
path: test.log | |
- name: Generate code coverage reports | |
if: matrix.build.action == 'test' | |
run: | | |
PROFDATA_PATH=$(find /tmp/DerivedData -name "*.profdata") | |
echo "Detected profdata at path: $PROFDATA_PATH" | |
xcrun llvm-cov export \ | |
/tmp/DerivedData/Build/Products/Debug-iphonesimulator/TPPDFTests.xctest/TPPDFTests \ | |
--instr-profile $PROFDATA_PATH \ | |
--format="lcov" > unit-tests.coverage.lcov | |
xcrun llvm-cov export \ | |
/tmp/DerivedData/Build/Products/Debug-iphonesimulator/TPPDFIntegrationTests.xctest/TPPDFIntegrationTests \ | |
--instr-profile $PROFDATA_PATH \ | |
--format="lcov" > integration-tests.coverage.lcov | |
macos-unit-tests: | |
name: Unit Tests (macos) | |
runs-on: macos-14 | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Check environment | |
run: | | |
set -ex | |
xcodebuild -version | |
swift --version | |
xcrun simctl list | |
- name: Run tests | |
run: swift test --parallel --enable-code-coverage | |
- name: Generate code coverage reports | |
run: | | |
xcrun llvm-cov export \ | |
.build/debug/TPPDFPackageTests.xctest/Contents/MacOS/TPPDFPackageTests \ | |
--instr-profile .build/debug/codecov/default.profdata \ | |
--format="lcov" > coverage.lcov |