Create build
workflow to test code with Swift 5 and 6
#1
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: build | |
on: | |
push: | |
pull_request: | |
branches: [ 'main' ] | |
permissions: | |
contents: read | |
checks: write | |
jobs: | |
build-swift: | |
strategy: | |
fail-fast: false | |
matrix: | |
swift: ['swift6', 'swift5'] | |
include: | |
- swift: 'swift6' | |
xcode-path: '/Applications/Xcode_16.0.0.app' | |
macos: 'macos-15' | |
- swift: 'swift5' | |
xcode-path: '/Applications/Xcode_15.4.0.app' | |
macos: 'macos-14' | |
env: | |
DEVELOPER_DIR: ${{ matrix.xcode-path }} | |
runs-on: ${{ matrix.macos }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: swift version | |
run: swift --version | |
- name: build | |
run: swift build -v | |
- name: run tests | |
continue-on-error: true | |
run: swift test --parallel --xunit-output 'TestReport.xml' | |
- name: report unit test results | |
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 # 1.9.1 | |
if: always() | |
id: results-swift-tests | |
with: | |
name: 'results-swift-tests-${{ matrix.swift }}' | |
path: 'TestReport.xml' | |
reporter: swift-xunit | |
fail-on-error: true | |
- name: summary | |
if: always() | |
run: | | |
{ | |
echo "# Test Summary Report" | |
echo "" | |
echo "System details" | |
echo "" | |
echo "Swift: \`${{ matrix.swift }}\` " | |
echo "macOS: \`${{ matrix.macos }}\` " | |
echo "Xcode: \`${{ matrix.xcode-path }}\` " | |
echo "" | |
echo "Unit Tests Conclusion: \`${{ steps.results-swift-tests.outputs.conclusion }}\` " | |
echo "Unit Tests Report: <${{ steps.results-swift-tests.outputs.url_html }}>" | |
} >> $GITHUB_STEP_SUMMARY |