Skip to content

Fix non-deterministic JSON key order causing Swift Testing args to be misidentified #122

Fix non-deterministic JSON key order causing Swift Testing args to be misidentified

Fix non-deterministic JSON key order causing Swift Testing args to be misidentified #122

Workflow file for this run

name: Unit Tests
on:
pull_request:
branches-ignore:
- 'release-*'
- 'release/*'
workflow_dispatch:
workflow_call:
jobs:
unit:
name: ${{ matrix.xcode }} / ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
xcode: ["Xcode_26.2", "Xcode_26.4"]
platform: ["macOS", "iOSsim", "tvOSsim", "watchOSsim", "visionOSsim"]
runs-on: macos-26
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup ${{ matrix.xcode }}
id: xcode
uses: ./.github/actions/setup-xcode
with:
version: ${{ matrix.xcode }}
- name: Unit tests
run: >-
make XC_LOG=unit
IOS_SIMULATOR="${{ steps.xcode.outputs.ios-simulator }}"
TVOS_SIMULATOR="${{ steps.xcode.outputs.tvos-simulator }}"
WATCHOS_SIMULATOR="${{ steps.xcode.outputs.watchos-simulator }}"
VISIONOS_SIMULATOR="${{ steps.xcode.outputs.visionos-simulator }}"
tests/unit/${{ matrix.platform }}
- name: Attach Xcode logs
if: '!cancelled()'
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{ matrix.xcode }}-${{ matrix.platform }}-unit-logs
path: "*-unit.log"
# The SDK can't instrument its own test run, so report unit-test results to
# Datadog by uploading the JUnit reports xcbeautify produced. Runs on failure
# too — failing tests are exactly what we want reported.
- name: Upload test results to Datadog
if: '!cancelled()'
env:
DD_API_KEY: '${{ secrets.DD_API_KEY }}'
run: |
if [ -z "$DD_API_KEY" ]; then
echo "DD_API_KEY not set (likely a fork PR); skipping test results upload."
exit 0
fi
npx --yes @datadog/datadog-ci junit upload \
--service dd-sdk-swift-testing \
--env ci \
--tags "test.xcode:${{ matrix.xcode }}" \
--tags "test.platform:${{ matrix.platform }}" \
build/reports