Skip to content

Add more inputs

Add more inputs #245

Workflow file for this run

name: Tests
on:
push:
branches: [ main ]
paths:
- 'dist/*.js'
- 'action.yml'
- '.github/workflows/tests.yml'
pull_request:
branches: [ main ]
jobs:
test-project:
name: Test Project Build
runs-on: macos-13
strategy:
matrix:
platform:
- macOS
- iOS
skip-testing:
- |
TestProjectTests/FailingTests/testFailing1
TestProjectTests/FailingTests/testFailing2
action: [ test ]
output-formatter: [ 'xcpretty --color', '' ]
include:
- platform: watchOS
skip-testing: ''
action: build
output-formatter: xcpretty --color
- platform: watchOS
skip-testing: ''
action: build
output-formatter: ''
env:
INPUT_PROJECT: __test__/TestProject/TestProject.xcodeproj
INPUT_SCHEME: TestProject
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ^14.3
- name: Select destination
id: destination
env:
PLATFORM: ${{ matrix.platform }}
run: |
DESTINATION=''
case "${PLATFORM}" in
'macOS') DESTINATION='platform=macOS';;
'iOS') DESTINATION='platform=iOS Simulator,OS=latest,name=iPhone 14 Pro';;
'iPadOS') DESTINATION='platform=iOS Simulator,OS=latest,name=iPad Pro (11-inch) (4th generation)';;
'tvOS') DESTINATION='platform=tvOS Simulator,OS=latest,name=Apple TV 4K (3rd generation)';;
'watchOS') DESTINATION='platform=watchOS Simulator,OS=latest,name=Apple Watch Series 8 (45mm)';;
*) echo "::error title=Unknown platform!::Unknown platform: ${PLATFORM}" && exit 1;;
esac
echo "xcode=${DESTINATION}" >> "${GITHUB_OUTPUT}"
- uses: actions/checkout@v4
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/generate-action-code
- uses: sersoft-gmbh/xcodebuild-action@main
if: ${{ github.event_name == 'push' }}
with:
project: ${{ env.INPUT_PROJECT }}
scheme: ${{ env.INPUT_SCHEME }}
destination: ${{ steps.destination.outputs.xcode }}
skip-testing: ${{ matrix.skip-testing }}
action: ${{ matrix.action }}
output-formatter: ${{ matrix.output-formatter }}
- uses: './'
if: ${{ github.event_name == 'pull_request' }}
with:
project: ${{ env.INPUT_PROJECT }}
scheme: ${{ env.INPUT_SCHEME }}
destination: ${{ steps.destination.outputs.xcode }}
skip-testing: ${{ matrix.skip-testing }}
action: ${{ matrix.action }}
output-formatter: ${{ matrix.output-formatter }}
- name: Check for derived data
run: ls ~/Library/Developer/Xcode/DerivedData/ | grep -q '^TestProject.*'
test-workspace:
name: Test Workspace Build
runs-on: macos-13
strategy:
matrix:
platform:
- macOS
- iOS
skip-testing:
- |
TestProjectTests/FailingTests/testFailing1
TestProjectTests/FailingTests/testFailing2
action: [ test ]
output-formatter: [ 'xcpretty --color', '' ]
include:
- platform: watchOS
skip-testing: ''
action: build
output-formatter: xcpretty --color
- platform: watchOS
skip-testing: ''
action: build
output-formatter: ''
env:
INPUT_WORKSPACE: __test__/TestProject/TestProject.xcworkspace
INPUT_SCHEME: TestProject
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ^14.3
- name: Select destination
id: destination
env:
PLATFORM: ${{ matrix.platform }}
run: |
DESTINATION=''
case "${PLATFORM}" in
'macOS') DESTINATION='platform=macOS';;
'iOS') DESTINATION='platform=iOS Simulator,OS=latest,name=iPhone 14 Pro';;
'iPadOS') DESTINATION='platform=iOS Simulator,OS=latest,name=iPad Pro (11-inch) (4th generation)';;
'tvOS') DESTINATION='platform=tvOS Simulator,OS=latest,name=Apple TV 4K (3rd generation)';;
'watchOS') DESTINATION='platform=watchOS Simulator,OS=latest,name=Apple Watch Series 8 (45mm)';;
*) echo "::error title=Unknown platform!::Unknown platform: ${PLATFORM}" && exit 1;;
esac
echo "xcode=${DESTINATION}" >> "${GITHUB_OUTPUT}"
- uses: actions/checkout@v4
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/generate-action-code
- uses: sersoft-gmbh/xcodebuild-action@main
if: ${{ github.event_name == 'push' }}
with:
workspace: ${{ env.INPUT_WORKSPACE }}
scheme: ${{ env.INPUT_SCHEME }}
destination: ${{ steps.destination.outputs.xcode }}
skip-testing: ${{ matrix.skip-testing }}
action: ${{ matrix.action }}
output-formatter: ${{ matrix.output-formatter }}
- uses: './'
if: ${{ github.event_name == 'pull_request' }}
with:
workspace: ${{ env.INPUT_WORKSPACE }}
scheme: ${{ env.INPUT_SCHEME }}
destination: ${{ steps.destination.outputs.xcode }}
skip-testing: ${{ matrix.skip-testing }}
action: ${{ matrix.action }}
output-formatter: ${{ matrix.output-formatter }}
- name: Check for derived data
run: ls ~/Library/Developer/Xcode/DerivedData/ | grep -q '^TestProject.*'
test-package:
name: Test SPM Package Build
runs-on: macos-13
strategy:
matrix:
platform:
- macOS
- iOS
output-formatter: [ 'xcpretty --color', '' ]
env:
INPUT_SPM_PACKAGE: __test__/TestPackage
INPUT_SCHEME: TestPackage
INPUT_ACTION: test
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ^14.3
- name: Select destination
id: destination
env:
PLATFORM: ${{ matrix.platform }}
run: |
DESTINATION=''
case "${PLATFORM}" in
'macOS') DESTINATION='platform=macOS';;
'iOS') DESTINATION='platform=iOS Simulator,OS=latest,name=iPhone 14 Pro';;
'iPadOS') DESTINATION='platform=iOS Simulator,OS=latest,name=iPad Pro (11-inch) (4th generation)';;
'tvOS') DESTINATION='platform=tvOS Simulator,OS=latest,name=Apple TV 4K (3rd generation)';;
'watchOS') DESTINATION='platform=watchOS Simulator,OS=latest,name=Apple Watch Series 8 (45mm)';;
*) echo "::error title=Unknown platform!::Unknown platform: ${PLATFORM}" && exit 1;;
esac
echo "xcode=${DESTINATION}" >> "${GITHUB_OUTPUT}"
- uses: actions/checkout@v4
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/generate-action-code
- uses: sersoft-gmbh/xcodebuild-action@main
if: ${{ github.event_name == 'push' }}
with:
spm-package: ${{ env.INPUT_SPM_PACKAGE }}
scheme: ${{ env.INPUT_SCHEME }}
destination: ${{ steps.destination.outputs.xcode }}
action: ${{ env.INPUT_ACTION }}
output-formatter: ${{ matrix.output-formatter }}
- uses: './'
if: ${{ github.event_name == 'pull_request' }}
with:
spm-package: ${{ env.INPUT_SPM_PACKAGE }}
scheme: ${{ env.INPUT_SCHEME }}
destination: ${{ steps.destination.outputs.xcode }}
action: ${{ env.INPUT_ACTION }}
output-formatter: ${{ matrix.output-formatter }}
- name: Check for derived data
run: ls ~/Library/Developer/Xcode/DerivedData/ | grep -q '^TestPackage.*'
test-dry-run-project:
name: Dry Run Project Build
runs-on: ubuntu-latest
strategy:
matrix:
output-formatter: [ 'xcpretty --color', '' ]
env:
INPUT_PROJECT: TestProject.xcodeproj
INPUT_TARGET: SomeTarget
INPUT_DESTINATION: platform=macOS
INPUT_CONFIGURATION: Debug
INPUT_SDK: SomeSDK
INPUT_ARCH: arm64
INPUT_XCCONFIG: /SomeConfig.xcconfig
INPUT_JOBS: 42
INPUT_RESULT_BUNDLE_PATH: /here/and/there.bundle
INPUT_RESULT_BUNDLE_VERSION: 3
INPUT_DERIVED_DATA_PATH: /there/and/here
INPUT_XCROOT: /this/and/that.xcroot
INPUT_XCTESTRUN: /this/and/that.xctestrun
INPUT_TEST_PLAN: SomeTestPlan
INPUT_SKIP_TESTING_0: this
INPUT_SKIP_TESTING_1: that
INPUT_BUILD_SETTINGS: ABC=DEF
INPUT_ACTION: action
steps:
- if: ${{ github.event_name == 'pull_request' && env.RUNNER_DEBUG != 1 }}
run: echo 'RUNNER_DEBUG=1' >> "${GITHUB_ENV}"
- if: ${{ github.event_name == 'pull_request' }}
run: test "${RUNNER_DEBUG}" == "1"
- if: ${{ github.event_name == 'push' }}
env:
DEBUG_ENABLED: ${{ secrets.ACTIONS_STEP_DEBUG }}
run: test "${DEBUG_ENABLED}" == 'true'
- uses: actions/checkout@v4
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/generate-action-code
- uses: sersoft-gmbh/xcodebuild-action@main
if: ${{ github.event_name == 'push' }}
id: xcodebuild-main
with:
project: ${{ env.INPUT_PROJECT }}
target: ${{ env.INPUT_TARGET }}
destination: ${{ env.INPUT_DESTINATION }}
configuration: ${{ env.INPUT_CONFIGURATION }}
sdk: ${{ env.INPUT_SDK }}
arch: ${{ env.INPUT_ARCH }}
xcconfig: ${{ env.INPUT_XCCONFIG }}
jobs: ${{ env.INPUT_JOBS }}
parallelize-targets: true
enable-code-coverage: true
parallel-testing-enabled: true
quiet: true
hide-shell-script-environment: true
enable-address-sanitizer: false
enable-thread-sanitizer: false
enable-undefined-behavior-sanitizer: false
result-bundle-path: ${{ env.INPUT_RESULT_BUNDLE_PATH }}
result-bundle-version: ${{ env.INPUT_RESULT_BUNDLE_VERSION }}
derived-data-path: ${{ env.INPUT_DERIVED_DATA_PATH }}
xcroot: ${{ env.INPUT_XCROOT }}
xctestrun: ${{ env.INPUT_XCTESTRUN }}
test-plan: ${{ env.INPUT_TEST_PLAN }}
skip-testing: |
${{ env.INPUT_SKIP_TESTING_0 }}
${{ env.INPUT_SKIP_TESTING_1 }}
skip-unavailable-actions: true
allow-provisioning-updates: true
allow-provisioning-device-registration: true
build-settings: ${{ env.INPUT_BUILD_SETTINGS }}
action: ${{ env.INPUT_ACTION }}
output-formatter: ${{ matrix.output-formatter }}
dry-run: true
- uses: './'
if: ${{ github.event_name == 'pull_request' }}
id: xcodebuild-local
with:
project: ${{ env.INPUT_PROJECT }}
target: ${{ env.INPUT_TARGET }}
destination: ${{ env.INPUT_DESTINATION }}
configuration: ${{ env.INPUT_CONFIGURATION }}
sdk: ${{ env.INPUT_SDK }}
arch: ${{ env.INPUT_ARCH }}
xcconfig: ${{ env.INPUT_XCCONFIG }}
jobs: ${{ env.INPUT_JOBS }}
parallelize-targets: true
enable-code-coverage: true
parallel-testing-enabled: true
quiet: true
hide-shell-script-environment: true
enable-address-sanitizer: false
enable-thread-sanitizer: false
enable-undefined-behavior-sanitizer: false
result-bundle-path: ${{ env.INPUT_RESULT_BUNDLE_PATH }}
result-bundle-version: ${{ env.INPUT_RESULT_BUNDLE_VERSION }}
derived-data-path: ${{ env.INPUT_DERIVED_DATA_PATH }}
xcroot: ${{ env.INPUT_XCROOT }}
xctestrun: ${{ env.INPUT_XCTESTRUN }}
test-plan: ${{ env.INPUT_TEST_PLAN }}
skip-testing: |
${{ env.INPUT_SKIP_TESTING_0 }}
${{ env.INPUT_SKIP_TESTING_1 }}
skip-unavailable-actions: true
allow-provisioning-updates: true
allow-provisioning-device-registration: true
build-settings: ${{ env.INPUT_BUILD_SETTINGS }}
action: ${{ env.INPUT_ACTION }}
output-formatter: ${{ matrix.output-formatter }}
dry-run: true
- id: xcodebuild
env:
EVENT_NAME: ${{ github.event_name }}
BRANCH_UNPROCESSED_COMMAND: ${{ steps.xcodebuild-main.outputs.unprocessed-command }}
BRANCH_EXECUTED_COMMAND: ${{ steps.xcodebuild-main.outputs.executed-command }}
LOCAL_UNPROCESSED_COMMAND: ${{ steps.xcodebuild-local.outputs.unprocessed-command }}
LOCAL_EXECUTED_COMMAND: ${{ steps.xcodebuild-local.outputs.executed-command }}
run: |
if [ "${EVENT_NAME}" == 'push' ]; then
echo "unprocessed-command=${BRANCH_UNPROCESSED_COMMAND}" >> "${GITHUB_OUTPUT}"
echo "executed-command=${BRANCH_EXECUTED_COMMAND}" >> "${GITHUB_OUTPUT}"
else
echo "unprocessed-command=${LOCAL_UNPROCESSED_COMMAND}" >> "${GITHUB_OUTPUT}"
echo "executed-command=${LOCAL_EXECUTED_COMMAND}" >> "${GITHUB_OUTPUT}"
fi
- name: Check executed command
env:
OUTPUT_FORMATTER: ${{ matrix.output-formatter }}
UNPROCESSED_COMMAND: ${{ steps.xcodebuild.outputs.unprocessed-command }}
EXECUTED_COMMAND: ${{ steps.xcodebuild.outputs.executed-command }}
run: |
EXPECTED_COMMAND="xcodebuild \
-project ${INPUT_PROJECT} \
-target ${INPUT_TARGET} \
-destination ${INPUT_DESTINATION} \
-configuration ${INPUT_CONFIGURATION} \
-sdk ${INPUT_SDK} \
-arch ${INPUT_ARCH} \
-xcconfig ${INPUT_XCCONFIG} \
-jobs ${INPUT_JOBS} \
-parallelizeTargets \
-enableCodeCoverage YES \
-parallel-testing-enabled YES \
-quiet \
-hideShellScriptEnvironment \
-enableAddressSanitizer NO \
-enableThreadSanitizer NO \
-enableUndefinedBehaviorSanitizer NO \
-resultBundlePath ${INPUT_RESULT_BUNDLE_PATH} \
-resultBundleVersion ${INPUT_RESULT_BUNDLE_VERSION} \
-derivedDataPath ${INPUT_DERIVED_DATA_PATH} \
-xcroot ${INPUT_XCROOT} \
-xctestrun ${INPUT_XCTESTRUN} \
-testPlan ${INPUT_TEST_PLAN} \
-skip-testing ${INPUT_SKIP_TESTING_0} \
-skip-testing ${INPUT_SKIP_TESTING_1} \
-skipUnavailableActions \
-allowProvisioningUpdates \
-allowProvisioningDeviceRegistration \
${INPUT_BUILD_SETTINGS} \
${INPUT_ACTION}"
if [ -n "${OUTPUT_FORMATTER}" ]; then
EXPECTED_COMMAND="${EXPECTED_COMMAND} | ${OUTPUT_FORMATTER}"
fi
ACTUAL_COMMAND="${UNPROCESSED_COMMAND}"
if [ "${EXPECTED_COMMAND}" != "${ACTUAL_COMMAND}" ]; then
printf "::error::Executed command did not match expectations!\nExecuted: ${ACTUAL_COMMAND}\nExpected: ${EXPECTED_COMMAND}\n"
exit 1
fi
test-dry-run-workspace:
name: Dry Run Workspace Build
runs-on: ubuntu-latest
strategy:
matrix:
output-formatter: [ 'xcpretty --color', '' ]
env:
INPUT_WORKSPACE: TestWorkspace.xcworkspace
INPUT_SCHEME: TestScheme
INPUT_TARGET: SomeTarget
INPUT_DESTINATION: platform=macOS
INPUT_CONFIGURATION: Debug
INPUT_SDK: SomeSDK
INPUT_ARCH: arm64
INPUT_XCCONFIG: /SomeConfig.xcconfig
INPUT_JOBS: 42
INPUT_RESULT_BUNDLE_PATH: /here/and/there.bundle
INPUT_RESULT_BUNDLE_VERSION: 3
INPUT_DERIVED_DATA_PATH: /there/and/here
INPUT_XCROOT: /this/and/that.xcroot
INPUT_XCTESTRUN: /this/and/that.xctestrun
INPUT_TEST_PLAN: SomeTestPlan
INPUT_SKIP_TESTING_0: this
INPUT_SKIP_TESTING_1: that
INPUT_BUILD_SETTINGS: ABC=DEF
INPUT_ACTION: action
steps:
- if: ${{ github.event_name == 'pull_request' && env.RUNNER_DEBUG != 1 }}
run: echo 'RUNNER_DEBUG=1' >> "${GITHUB_ENV}"
- if: ${{ github.event_name == 'pull_request' }}
run: test "${RUNNER_DEBUG}" == "1"
- if: ${{ github.event_name == 'push' }}
env:
DEBUG_ENABLED: ${{ secrets.ACTIONS_STEP_DEBUG }}
run: test "${DEBUG_ENABLED}" == 'true'
- uses: actions/checkout@v4
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/generate-action-code
- uses: sersoft-gmbh/xcodebuild-action@main
if: ${{ github.event_name == 'push' }}
id: xcodebuild-main
with:
workspace: ${{ env.INPUT_WORKSPACE }}
scheme: ${{ env.INPUT_SCHEME }}
target: ${{ env.INPUT_TARGET }}
destination: ${{ env.INPUT_DESTINATION }}
configuration: ${{ env.INPUT_CONFIGURATION }}
sdk: ${{ env.INPUT_SDK }}
arch: ${{ env.INPUT_ARCH }}
xcconfig: ${{ env.INPUT_XCCONFIG }}
jobs: ${{ env.INPUT_JOBS }}
parallelize-targets: true
enable-code-coverage: true
parallel-testing-enabled: true
quiet: true
hide-shell-script-environment: true
enable-address-sanitizer: false
enable-thread-sanitizer: false
enable-undefined-behavior-sanitizer: false
result-bundle-path: ${{ env.INPUT_RESULT_BUNDLE_PATH }}
result-bundle-version: ${{ env.INPUT_RESULT_BUNDLE_VERSION }}
derived-data-path: ${{ env.INPUT_DERIVED_DATA_PATH }}
xcroot: ${{ env.INPUT_XCROOT }}
xctestrun: ${{ env.INPUT_XCTESTRUN }}
test-plan: ${{ env.INPUT_TEST_PLAN }}
skip-testing: |
${{ env.INPUT_SKIP_TESTING_0 }}
${{ env.INPUT_SKIP_TESTING_1 }}
skip-unavailable-actions: true
allow-provisioning-updates: true
allow-provisioning-device-registration: true
build-settings: ${{ env.INPUT_BUILD_SETTINGS }}
action: ${{ env.INPUT_ACTION }}
output-formatter: ${{ matrix.output-formatter }}
dry-run: true
- uses: './'
if: ${{ github.event_name == 'pull_request' }}
id: xcodebuild-local
with:
workspace: ${{ env.INPUT_WORKSPACE }}
scheme: ${{ env.INPUT_SCHEME }}
target: ${{ env.INPUT_TARGET }}
destination: ${{ env.INPUT_DESTINATION }}
configuration: ${{ env.INPUT_CONFIGURATION }}
sdk: ${{ env.INPUT_SDK }}
arch: ${{ env.INPUT_ARCH }}
xcconfig: ${{ env.INPUT_XCCONFIG }}
jobs: ${{ env.INPUT_JOBS }}
parallelize-targets: true
enable-code-coverage: true
parallel-testing-enabled: true
quiet: true
hide-shell-script-environment: true
enable-address-sanitizer: false
enable-thread-sanitizer: false
enable-undefined-behavior-sanitizer: false
result-bundle-path: ${{ env.INPUT_RESULT_BUNDLE_PATH }}
result-bundle-version: ${{ env.INPUT_RESULT_BUNDLE_VERSION }}
derived-data-path: ${{ env.INPUT_DERIVED_DATA_PATH }}
xcroot: ${{ env.INPUT_XCROOT }}
xctestrun: ${{ env.INPUT_XCTESTRUN }}
test-plan: ${{ env.INPUT_TEST_PLAN }}
skip-testing: |
${{ env.INPUT_SKIP_TESTING_0 }}
${{ env.INPUT_SKIP_TESTING_1 }}
skip-unavailable-actions: true
allow-provisioning-updates: true
allow-provisioning-device-registration: true
build-settings: ${{ env.INPUT_BUILD_SETTINGS }}
action: ${{ env.INPUT_ACTION }}
output-formatter: ${{ matrix.output-formatter }}
dry-run: true
- id: xcodebuild
env:
EVENT_NAME: ${{ github.event_name }}
BRANCH_UNPROCESSED_COMMAND: ${{ steps.xcodebuild-main.outputs.unprocessed-command }}
BRANCH_EXECUTED_COMMAND: ${{ steps.xcodebuild-main.outputs.executed-command }}
LOCAL_UNPROCESSED_COMMAND: ${{ steps.xcodebuild-local.outputs.unprocessed-command }}
LOCAL_EXECUTED_COMMAND: ${{ steps.xcodebuild-local.outputs.executed-command }}
run: |
if [ "${EVENT_NAME}" == 'push' ]; then
echo "unprocessed-command=${BRANCH_UNPROCESSED_COMMAND}" >> "${GITHUB_OUTPUT}"
echo "executed-command=${BRANCH_EXECUTED_COMMAND}" >> "${GITHUB_OUTPUT}"
else
echo "unprocessed-command=${LOCAL_UNPROCESSED_COMMAND}" >> "${GITHUB_OUTPUT}"
echo "executed-command=${LOCAL_EXECUTED_COMMAND}" >> "${GITHUB_OUTPUT}"
fi
- name: Check executed command
env:
OUTPUT_FORMATTER: ${{ matrix.output-formatter }}
UNPROCESSED_COMMAND: ${{ steps.xcodebuild.outputs.unprocessed-command }}
EXECUTED_COMMAND: ${{ steps.xcodebuild.outputs.executed-command }}
run: |
EXPECTED_COMMAND="xcodebuild \
-workspace ${INPUT_WORKSPACE} \
-scheme ${INPUT_SCHEME} \
-target ${INPUT_TARGET} \
-destination ${INPUT_DESTINATION} \
-configuration ${INPUT_CONFIGURATION} \
-sdk ${INPUT_SDK} \
-arch ${INPUT_ARCH} \
-xcconfig ${INPUT_XCCONFIG} \
-jobs ${INPUT_JOBS} \
-parallelizeTargets \
-enableCodeCoverage YES \
-parallel-testing-enabled YES \
-quiet \
-hideShellScriptEnvironment \
-enableAddressSanitizer NO \
-enableThreadSanitizer NO \
-enableUndefinedBehaviorSanitizer NO \
-resultBundlePath ${INPUT_RESULT_BUNDLE_PATH} \
-resultBundleVersion ${INPUT_RESULT_BUNDLE_VERSION} \
-derivedDataPath ${INPUT_DERIVED_DATA_PATH} \
-xcroot ${INPUT_XCROOT} \
-xctestrun ${INPUT_XCTESTRUN} \
-testPlan ${INPUT_TEST_PLAN} \
-skip-testing ${INPUT_SKIP_TESTING_0} \
-skip-testing ${INPUT_SKIP_TESTING_1} \
-skipUnavailableActions \
-allowProvisioningUpdates \
-allowProvisioningDeviceRegistration \
${INPUT_BUILD_SETTINGS} \
${INPUT_ACTION}"
if [ -n "${OUTPUT_FORMATTER}" ]; then
EXPECTED_COMMAND="${EXPECTED_COMMAND} | ${OUTPUT_FORMATTER}"
fi
ACTUAL_COMMAND="${UNPROCESSED_COMMAND}"
if [ "${EXPECTED_COMMAND}" != "${ACTUAL_COMMAND}" ]; then
printf "::error::Executed command did not match expectations!\nExecuted: ${ACTUAL_COMMAND}\nExpected: ${EXPECTED_COMMAND}\n"
exit 1
fi
test-dry-run-package:
name: Dry Run SPM Package Build
runs-on: ubuntu-latest
strategy:
matrix:
output-formatter: [ 'xcpretty --color', '' ]
env:
INPUT_SPM_PACKAGE: /path/to/TestPackage
INPUT_SCHEME: TestScheme
INPUT_TARGET: SomeTarget
INPUT_DESTINATION: platform=macOS
INPUT_CONFIGURATION: Debug
INPUT_SDK: SomeSDK
INPUT_ARCH: arm64
INPUT_XCCONFIG: /SomeConfig.xcconfig
INPUT_JOBS: 42
INPUT_RESULT_BUNDLE_PATH: /here/and/there.bundle
INPUT_RESULT_BUNDLE_VERSION: 3
INPUT_DERIVED_DATA_PATH: /there/and/here
INPUT_XCROOT: /this/and/that.xcroot
INPUT_XCTESTRUN: /this/and/that.xctestrun
INPUT_TEST_PLAN: SomeTestPlan
INPUT_SKIP_TESTING_0: this
INPUT_SKIP_TESTING_1: that
INPUT_BUILD_SETTINGS: ABC=DEF
INPUT_ACTION: action
steps:
- if: ${{ github.event_name == 'pull_request' && env.RUNNER_DEBUG != 1 }}
run: echo 'RUNNER_DEBUG=1' >> "${GITHUB_ENV}"
- if: ${{ github.event_name == 'pull_request' }}
run: test "${RUNNER_DEBUG}" == "1"
- if: ${{ github.event_name == 'push' }}
env:
DEBUG_ENABLED: ${{ secrets.ACTIONS_STEP_DEBUG }}
run: test "${DEBUG_ENABLED}" == 'true'
- uses: actions/checkout@v4
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/generate-action-code
- uses: sersoft-gmbh/xcodebuild-action@main
if: ${{ github.event_name == 'push' }}
id: xcodebuild-main
with:
spm-package: ${{ env.INPUT_SPM_PACKAGE }}
scheme: ${{ env.INPUT_SCHEME }}
target: ${{ env.INPUT_TARGET }}
destination: ${{ env.INPUT_DESTINATION }}
configuration: ${{ env.INPUT_CONFIGURATION }}
sdk: ${{ env.INPUT_SDK }}
arch: ${{ env.INPUT_ARCH }}
xcconfig: ${{ env.INPUT_XCCONFIG }}
jobs: ${{ env.INPUT_JOBS }}
parallelize-targets: true
enable-code-coverage: true
parallel-testing-enabled: true
quiet: true
hide-shell-script-environment: true
enable-address-sanitizer: false
enable-thread-sanitizer: false
enable-undefined-behavior-sanitizer: false
result-bundle-path: ${{ env.INPUT_RESULT_BUNDLE_PATH }}
result-bundle-version: ${{ env.INPUT_RESULT_BUNDLE_VERSION }}
derived-data-path: ${{ env.INPUT_DERIVED_DATA_PATH }}
xcroot: ${{ env.INPUT_XCROOT }}
xctestrun: ${{ env.INPUT_XCTESTRUN }}
test-plan: ${{ env.INPUT_TEST_PLAN }}
skip-testing: |
${{ env.INPUT_SKIP_TESTING_0 }}
${{ env.INPUT_SKIP_TESTING_1 }}
skip-unavailable-actions: true
allow-provisioning-updates: true
allow-provisioning-device-registration: true
build-settings: ${{ env.INPUT_BUILD_SETTINGS }}
action: ${{ env.INPUT_ACTION }}
output-formatter: ${{ matrix.output-formatter }}
dry-run: true
- uses: './'
if: ${{ github.event_name == 'pull_request' }}
id: xcodebuild-local
with:
spm-package: ${{ env.INPUT_SPM_PACKAGE }}
scheme: ${{ env.INPUT_SCHEME }}
target: ${{ env.INPUT_TARGET }}
destination: ${{ env.INPUT_DESTINATION }}
configuration: ${{ env.INPUT_CONFIGURATION }}
sdk: ${{ env.INPUT_SDK }}
arch: ${{ env.INPUT_ARCH }}
xcconfig: ${{ env.INPUT_XCCONFIG }}
jobs: ${{ env.INPUT_JOBS }}
parallelize-targets: true
enable-code-coverage: true
parallel-testing-enabled: true
quiet: true
hide-shell-script-environment: true
enable-address-sanitizer: false
enable-thread-sanitizer: false
enable-undefined-behavior-sanitizer: false
result-bundle-path: ${{ env.INPUT_RESULT_BUNDLE_PATH }}
result-bundle-version: ${{ env.INPUT_RESULT_BUNDLE_VERSION }}
derived-data-path: ${{ env.INPUT_DERIVED_DATA_PATH }}
xcroot: ${{ env.INPUT_XCROOT }}
xctestrun: ${{ env.INPUT_XCTESTRUN }}
test-plan: ${{ env.INPUT_TEST_PLAN }}
skip-testing: |
${{ env.INPUT_SKIP_TESTING_0 }}
${{ env.INPUT_SKIP_TESTING_1 }}
skip-unavailable-actions: true
allow-provisioning-updates: true
allow-provisioning-device-registration: true
build-settings: ${{ env.INPUT_BUILD_SETTINGS }}
action: ${{ env.INPUT_ACTION }}
output-formatter: ${{ matrix.output-formatter }}
dry-run: true
- id: xcodebuild
env:
EVENT_NAME: ${{ github.event_name }}
BRANCH_UNPROCESSED_COMMAND: ${{ steps.xcodebuild-main.outputs.unprocessed-command }}
BRANCH_EXECUTED_COMMAND: ${{ steps.xcodebuild-main.outputs.executed-command }}
LOCAL_UNPROCESSED_COMMAND: ${{ steps.xcodebuild-local.outputs.unprocessed-command }}
LOCAL_EXECUTED_COMMAND: ${{ steps.xcodebuild-local.outputs.executed-command }}
run: |
if [ "${EVENT_NAME}" == 'push' ]; then
echo "unprocessed-command=${BRANCH_UNPROCESSED_COMMAND}" >> "${GITHUB_OUTPUT}"
echo "executed-command=${BRANCH_EXECUTED_COMMAND}" >> "${GITHUB_OUTPUT}"
else
echo "unprocessed-command=${LOCAL_UNPROCESSED_COMMAND}" >> "${GITHUB_OUTPUT}"
echo "executed-command=${LOCAL_EXECUTED_COMMAND}" >> "${GITHUB_OUTPUT}"
fi
- name: Check executed command
env:
OUTPUT_FORMATTER: ${{ matrix.output-formatter }}
UNPROCESSED_COMMAND: ${{ steps.xcodebuild.outputs.unprocessed-command }}
EXECUTED_COMMAND: ${{ steps.xcodebuild.outputs.executed-command }}
run: |
EXPECTED_COMMAND="pushd ${INPUT_SPM_PACKAGE} && \
xcodebuild \
-scheme ${INPUT_SCHEME} \
-target ${INPUT_TARGET} \
-destination ${INPUT_DESTINATION} \
-configuration ${INPUT_CONFIGURATION} \
-sdk ${INPUT_SDK} \
-arch ${INPUT_ARCH} \
-xcconfig ${INPUT_XCCONFIG} \
-jobs ${INPUT_JOBS} \
-parallelizeTargets \
-enableCodeCoverage YES \
-parallel-testing-enabled YES \
-quiet \
-hideShellScriptEnvironment \
-enableAddressSanitizer NO \
-enableThreadSanitizer NO \
-enableUndefinedBehaviorSanitizer NO \
-resultBundlePath ${INPUT_RESULT_BUNDLE_PATH} \
-resultBundleVersion ${INPUT_RESULT_BUNDLE_VERSION} \
-derivedDataPath ${INPUT_DERIVED_DATA_PATH} \
-xcroot ${INPUT_XCROOT} \
-xctestrun ${INPUT_XCTESTRUN} \
-testPlan ${INPUT_TEST_PLAN} \
-skip-testing ${INPUT_SKIP_TESTING_0} \
-skip-testing ${INPUT_SKIP_TESTING_1} \
-skipUnavailableActions \
-allowProvisioningUpdates \
-allowProvisioningDeviceRegistration \
${INPUT_BUILD_SETTINGS} \
${INPUT_ACTION}"
if [ -n "${OUTPUT_FORMATTER}" ]; then
EXPECTED_COMMAND="${EXPECTED_COMMAND} | ${OUTPUT_FORMATTER}"
fi
EXPECTED_COMMAND="${EXPECTED_COMMAND} ; popd"
ACTUAL_COMMAND="${UNPROCESSED_COMMAND}"
if [ "${EXPECTED_COMMAND}" != "${ACTUAL_COMMAND}" ]; then
printf "::error::Executed command did not match expectations!\nExecuted: ${ACTUAL_COMMAND}\nExpected: ${EXPECTED_COMMAND}\n"
exit 1
fi
test-dry-run-basic:
name: Dry Run Basic Build
runs-on: ubuntu-latest
env:
INPUT_PROJECT: TestProject.xcodeproj
INPUT_SCHEME: TestScheme
steps:
- if: ${{ github.event_name == 'pull_request' && env.RUNNER_DEBUG != 1 }}
run: echo 'RUNNER_DEBUG=1' >> "${GITHUB_ENV}"
- if: ${{ github.event_name == 'pull_request' }}
run: test "${RUNNER_DEBUG}" == "1"
- if: ${{ github.event_name == 'push' }}
env:
DEBUG_ENABLED: ${{ secrets.ACTIONS_STEP_DEBUG }}
run: test "${DEBUG_ENABLED}" == 'true'
- uses: actions/checkout@v4
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/generate-action-code
- uses: sersoft-gmbh/xcodebuild-action@main
if: ${{ github.event_name == 'push' }}
id: xcodebuild-main
with:
project: ${{ env.INPUT_PROJECT }}
scheme: ${{ env.INPUT_SCHEME }}
dry-run: true
- uses: './'
if: ${{ github.event_name == 'pull_request' }}
id: xcodebuild-local
with:
project: ${{ env.INPUT_PROJECT }}
scheme: ${{ env.INPUT_SCHEME }}
dry-run: true
- id: xcodebuild
env:
EVENT_NAME: ${{ github.event_name }}
BRANCH_UNPROCESSED_COMMAND: ${{ steps.xcodebuild-main.outputs.unprocessed-command }}
BRANCH_EXECUTED_COMMAND: ${{ steps.xcodebuild-main.outputs.executed-command }}
LOCAL_UNPROCESSED_COMMAND: ${{ steps.xcodebuild-local.outputs.unprocessed-command }}
LOCAL_EXECUTED_COMMAND: ${{ steps.xcodebuild-local.outputs.executed-command }}
run: |
if [ "${EVENT_NAME}" == 'push' ]; then
echo "unprocessed-command=${BRANCH_UNPROCESSED_COMMAND}" >> "${GITHUB_OUTPUT}"
echo "executed-command=${BRANCH_EXECUTED_COMMAND}" >> "${GITHUB_OUTPUT}"
else
echo "unprocessed-command=${LOCAL_UNPROCESSED_COMMAND}" >> "${GITHUB_OUTPUT}"
echo "executed-command=${LOCAL_EXECUTED_COMMAND}" >> "${GITHUB_OUTPUT}"
fi
- name: Check executed command
env:
UNPROCESSED_COMMAND: ${{ steps.xcodebuild.outputs.unprocessed-command }}
EXECUTED_COMMAND: ${{ steps.xcodebuild.outputs.executed-command }}
run: |
EXPECTED_COMMAND="xcodebuild -project ${INPUT_PROJECT} -scheme ${INPUT_SCHEME} test | xcpretty --color"
ACTUAL_COMMAND="${UNPROCESSED_COMMAND}"
if [ "${EXPECTED_COMMAND}" != "${ACTUAL_COMMAND}" ]; then
printf "::error::Executed command did not match expectations!\nExecuted: ${ACTUAL_COMMAND}\nExpected: ${EXPECTED_COMMAND}\n"
exit 1
fi