Add iPhone 14 Devices via new SnapshotTestingExtensions target (#241) #1220
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: Swift | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer | |
SWIFT_STRICT_CONCURRENCY: complete | |
jobs: | |
swift: | |
name: Swift | |
runs-on: macos-13 | |
env: | |
SIMULATOR: iPhone 14 | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
- name: Validate excluded snapshots | |
run: | | |
SNAPSHOTS=$(find Tests -type d -name "__Snapshots__" | sort) | |
EXCLUDED=$(swift package dump-package | jq -r '.targets[] | select(.type == "test") | "Tests/" + .name + "/" + .exclude[]' | sort) | |
UNEXCLUDED=$(comm -23 <(echo "$SNAPSHOTS") <(echo "$EXCLUDED")) | |
if test -n "$UNEXCLUDED" | |
then | |
echo "::error::Snapshot directories must be excluded from Swift package:" >&2 | |
echo "$UNEXCLUDED" >&2 | |
exit 1 | |
fi | |
- name: Download swiftlint binary | |
run: swift package resolve | |
- name: Lint | |
run: | | |
DIRECTORY_NAME=$(echo "${PWD##*/}" | tr '[:upper:]' '[:lower:]') | |
"$(find ".build/artifacts/${DIRECTORY_NAME}" -type f -name swiftlint -perm +111 -print -quit)" \ | |
lint --strict --reporter github-actions-logging | |
- name: Resolve package dependencies | |
run: xcodebuild -resolvePackageDependencies | |
- name: Build | |
run: > | |
xcodebuild | |
build-for-testing | |
-scheme "Layout-Package" | |
-destination "name=$SIMULATOR,OS=latest" | |
SWIFT_TREAT_WARNINGS_AS_ERRORS=YES | |
- name: Test | |
run: > | |
xcodebuild | |
test-without-building | |
-scheme "Layout-Package" | |
-destination "name=$SIMULATOR,OS=latest" | |
- name: Delete snapshots | |
run: make delete-snapshots | |
- name: Record snapshots | |
run: > | |
xcodebuild | |
test-without-building | |
-scheme "Layout-Package" | |
-destination "name=$SIMULATOR,OS=latest" | |
continue-on-error: true | |
- name: Validate recorded snapshots | |
run: test -z "$(git status --porcelain)" |