bump sersoft-gmbh/swifty-docs-action from 2 to 3 #247
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: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test-spm: | |
strategy: | |
matrix: | |
os: [ macos-12 ] | |
swift-version: [ '' ] | |
xcode-version: [ '^13.4' ] | |
include: | |
- os: macos-12 | |
swift-version: '' | |
xcode-version: '^14.1' | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: maxim-lobanov/setup-xcode@v1 | |
if: ${{ runner.os == 'macOS' }} | |
with: | |
xcode-version: ${{ matrix.xcode-version }} | |
- uses: swift-actions/[email protected] | |
if: ${{ runner.os == 'Linux' }} | |
id: swift-setup-linux | |
with: | |
swift-version: ${{matrix.swift-version}} | |
# Workaround for https://github.com/swift-actions/setup-swift/issues/406 | |
- uses: sersoft-gmbh/swift-version-action@v2 | |
if: ${{ runner.os == 'macOS' }} | |
id: swift-setup-macos | |
- id: swift-setup | |
env: | |
RUNNER_OS: ${{ runner.os }} | |
MACOS_SWIFT_VERSION: ${{ steps.swift-setup-macos.outputs.swift-version }} | |
LINUX_SWIFT_VERSION: ${{ steps.swift-setup-linux.outputs.swift-version }} | |
run: | | |
if [ "${RUNNER_OS}" == 'macOS' ]; then | |
echo "version=${MACOS_SWIFT_VERSION}" >> "${GITHUB_OUTPUT}" | |
else | |
echo "version=${LINUX_SWIFT_VERSION}" >> "${GITHUB_OUTPUT}" | |
fi | |
- name: Read OS Version | |
uses: sersoft-gmbh/os-version-action@v2 | |
id: os-version | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v3 | |
with: | |
path: .build | |
key: ${{ runner.os }}-${{ steps.os-version.outputs.version }}-spm-${{ steps.swift-version.outputs.version }}-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-${{ steps.os-version.outputs.version }}-spm-${{ steps.swift-version.outputs.version }}- | |
- name: Build & Test | |
run: swift test -v --parallel --enable-code-coverage | |
- name: Generate Coverage Files | |
uses: sersoft-gmbh/swift-coverage-action@v3 | |
id: coverage-files | |
- uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }} | |
fail_ci_if_error: true | |
test-xcode: | |
runs-on: macos-12 | |
strategy: | |
matrix: | |
platform: | |
- macOS | |
- iOS | |
- iPadOS | |
- tvOS | |
- watchOS | |
env: | |
XCODE_SCHEME: app-groups | |
steps: | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: ^14.1 | |
- name: Read OS Version | |
uses: sersoft-gmbh/os-version-action@v2 | |
id: os-version | |
- name: Read Swift Version | |
uses: sersoft-gmbh/swift-version-action@v2 | |
id: swift-version | |
- 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 13 Pro';; | |
'iPadOS') DESTINATION='platform=iOS Simulator,OS=latest,name=iPad Pro (11-inch) (3rd generation)';; | |
'tvOS') DESTINATION='platform=tvOS Simulator,OS=latest,name=Apple TV 4K (2nd generation)';; | |
'watchOS') DESTINATION='platform=watchOS Simulator,OS=latest,name=Apple Watch Series 7 (45mm)';; | |
*) echo "::error title=Unknown platform!::Unknown platform: ${PLATFORM}" && exit 1;; | |
esac | |
echo "xcode=${DESTINATION}" >> "${GITHUB_OUTPUT}" | |
- uses: actions/checkout@v4 | |
# PIF ISSUES: https://github.com/apple/swift-package-manager/issues/5767 | |
- uses: actions/cache@v3 | |
with: | |
path: .build | |
key: ${{ runner.os }}-${{ steps.os-version.outputs.version }}-spm-${{ steps.swift-version.outputs.version }}-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-${{ steps.os-version.outputs.version }}-spm-${{ steps.swift-version.outputs.version }}- | |
- name: Work around PIF issues | |
env: | |
DESTINATION: ${{ steps.destination.outputs.xcode }} | |
run: | | |
swift package dump-pif > /dev/null | |
ATTEMPT=0 | |
while [ -z "${SUCCESS}" ] && [ "${ATTEMPT}" -le 5 ]; do | |
xcodebuild clean -scheme "${XCODE_SCHEME}" -destination "${DESTINATION}" | grep -q "CLEAN SUCCEEDED" && SUCCESS=true | |
ATTEMPT=$((ATTEMPT + 1)) | |
done | |
# END PIF ISSUES | |
- uses: actions/cache@v3 | |
with: | |
path: .derived-data | |
key: ${{ runner.os }}-${{ steps.os-version.outputs.version }}-xcode-${{ steps.swift-version.outputs.version }}-${{ matrix.platform }}-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-${{ steps.os-version.outputs.version }}-xcode-${{ steps.swift-version.outputs.version }}-${{ matrix.platform }}- | |
- uses: sersoft-gmbh/xcodebuild-action@v2 | |
with: | |
spm-package: './' | |
scheme: ${{ env.XCODE_SCHEME }} | |
destination: ${{ steps.destination.outputs.xcode }} | |
action: test | |
parallel-testing-enabled: ${{ matrix.platform != 'watchOS' }} | |
enable-code-coverage: true | |
derived-data-path: .derived-data | |
- uses: sersoft-gmbh/swift-coverage-action@v3 | |
id: coverage-files | |
with: | |
search-paths: | | |
./.build | |
./.derived-data | |
$HOME/Library/Developer/Xcode/DerivedData | |
- uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }} | |
fail_ci_if_error: true |