Also run tests when action.yml changes #223
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: | |
branches: [ master ] | |
paths: | |
- 'dist/*.js' | |
- 'action.yml' | |
- '.github/workflows/tests.yml' | |
pull_request: | |
branches: [ master ] | |
jobs: | |
test-project: | |
name: Test Project Build | |
runs-on: macos-12 | |
strategy: | |
matrix: | |
destination: | |
- platform=macOS | |
- platform=iOS Simulator,OS=latest,name=iPhone 14 Pro | |
skip-testing: | |
- | | |
TestProjectTests/FailingTests/testFailing1 | |
TestProjectTests/FailingTests/testFailing2 | |
action: [ test ] | |
output-formatter: [ 'xcpretty --color', '' ] | |
include: | |
- destination: platform=watchOS Simulator,OS=latest,name=Apple Watch Series 8 (45mm) | |
skip-testing: '' | |
action: build | |
output-formatter: xcpretty --color | |
- destination: platform=watchOS Simulator,OS=latest,name=Apple Watch Series 8 (45mm) | |
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.0 | |
- uses: actions/checkout@v3 | |
- name: Generate action code | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: ./.github/actions/generate-action-code | |
- uses: sersoft-gmbh/xcodebuild-action@master | |
if: ${{ github.event_name == 'push' }} | |
with: | |
project: ${{ env.INPUT_PROJECT }} | |
scheme: ${{ env.INPUT_SCHEME }} | |
destination: ${{ matrix.destination }} | |
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: ${{ matrix.destination }} | |
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-12 | |
strategy: | |
matrix: | |
destination: | |
- platform=macOS | |
- platform=iOS Simulator,OS=latest,name=iPhone 14 Pro | |
skip-testing: | |
- | | |
TestProjectTests/FailingTests/testFailing1 | |
TestProjectTests/FailingTests/testFailing2 | |
action: [ test ] | |
output-formatter: [ 'xcpretty --color', '' ] | |
include: | |
- destination: platform=watchOS Simulator,OS=latest,name=Apple Watch Series 8 (45mm) | |
skip-testing: '' | |
action: build | |
output-formatter: xcpretty --color | |
- destination: platform=watchOS Simulator,OS=latest,name=Apple Watch Series 8 (45mm) | |
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.0 | |
- uses: actions/checkout@v3 | |
- name: Generate action code | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: ./.github/actions/generate-action-code | |
- uses: sersoft-gmbh/xcodebuild-action@master | |
if: ${{ github.event_name == 'push' }} | |
with: | |
workspace: ${{ env.INPUT_WORKSPACE }} | |
scheme: ${{ env.INPUT_SCHEME }} | |
destination: ${{ matrix.destination }} | |
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: ${{ matrix.destination }} | |
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-12 | |
strategy: | |
matrix: | |
destination: | |
- platform=macOS | |
- platform=iOS Simulator,OS=latest,name=iPhone 14 Pro | |
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.0 | |
- uses: actions/checkout@v3 | |
- name: Generate action code | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: ./.github/actions/generate-action-code | |
- uses: sersoft-gmbh/xcodebuild-action@master | |
if: ${{ github.event_name == 'push' }} | |
with: | |
spm-package: ${{ env.INPUT_SPM_PACKAGE }} | |
scheme: ${{ env.INPUT_SCHEME }} | |
destination: ${{ matrix.destination }} | |
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: ${{ matrix.destination }} | |
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@v3 | |
- name: Generate action code | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: ./.github/actions/generate-action-code | |
- uses: sersoft-gmbh/xcodebuild-action@master | |
if: ${{ github.event_name == 'push' }} | |
id: xcodebuild-master | |
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-master.outputs.unprocessed-command }} | |
BRANCH_EXECUTED_COMMAND: ${{ steps.xcodebuild-master.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@v3 | |
- name: Generate action code | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: ./.github/actions/generate-action-code | |
- uses: sersoft-gmbh/xcodebuild-action@master | |
if: ${{ github.event_name == 'push' }} | |
id: xcodebuild-master | |
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-master.outputs.unprocessed-command }} | |
BRANCH_EXECUTED_COMMAND: ${{ steps.xcodebuild-master.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@v3 | |
- name: Generate action code | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: ./.github/actions/generate-action-code | |
- uses: sersoft-gmbh/xcodebuild-action@master | |
if: ${{ github.event_name == 'push' }} | |
id: xcodebuild-master | |
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-master.outputs.unprocessed-command }} | |
BRANCH_EXECUTED_COMMAND: ${{ steps.xcodebuild-master.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 |