Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @417-72KI
34 changes: 34 additions & 0 deletions .github/create-matrix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -euo pipefail

while getopts "f:" opt; do
case "$opt" in
f) FILE="$OPTARG" ;;
\?) exit 1 ;;
esac
done
shift $((OPTIND - 1))

matrix_file="${FILE:-$(git rev-parse --show-toplevel)/.github/matrix.yml}"
mode=$(echo "${1:-macOS}" | tr 'A-Z' 'a-z')

if [ "$mode" = "macos" ]; then
yq -o=json -I=0 '[
.macos_runners
| to_entries[] as $runner
| $runner.value.xcode
| to_entries[] as $xcode
| $xcode.value.destination[]
| {
"runner": $runner.key,
"xcode": $xcode.key,
"destination": .
}
]' "$matrix_file"
elif [ "$mode" = "linux" ]; then
yq -o=json -I=0 '.linux_runner.swift_versions' "$matrix_file"
else
echo "Unsupported mode: $mode" >&2
exit 1
fi
16 changes: 0 additions & 16 deletions .github/matrix.json

This file was deleted.

33 changes: 33 additions & 0 deletions .github/matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
macos_runners:
xcode-27: # ref: https://github.com/actions/runner-images/blob/main/images/macos/xcode-27-arm64-Readme.md
xcode:
"27.0": # Swift 6.4
destination:
- platform=macOS
- platform=iOS Simulator,name=iPhone 18 Pro
- platform=tvOS Simulator,name=Apple TV 4K (3rd generation)
macos-26: # ref: https://github.com/actions/runner-images/blob/main/images/macos/macos-26-arm64-Readme.md
xcode:
"26.6": # Swift 6.3
destination:
- platform=macOS
- platform=iOS Simulator,name=iPhone 17 Pro
- platform=tvOS Simulator,name=Apple TV 4K (3rd generation)
"26.3": # Swift 6.2
destination:
- platform=macOS
- platform=iOS Simulator,name=iPhone 17 Pro
- platform=tvOS Simulator,name=Apple TV 4K (3rd generation)
macos-15: # ref: https://github.com/actions/runner-images/blob/main/images/macos/macos-15-arm64-Readme.md
xcode:
"16.4": # Swift 6.1
destination:
- platform=macOS
- platform=iOS Simulator,name=iPhone 16 Pro
- platform=tvOS Simulator,name=Apple TV 4K (3rd generation)
linux_runner:
swift_versions:
- "6.4"
- "6.3"
- "6.2"
- "6.1"
20 changes: 0 additions & 20 deletions .github/workflows/danger.yml

This file was deleted.

156 changes: 156 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: Pull Request
on:
pull_request:
types: [opened, synchronize, reopened, edited]
permissions:
contents: read
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
extract-matrix:
name: Create matrix
runs-on: ubuntu-latest
outputs:
macos-versions: ${{ steps.extract-matrix.outputs.macos-versions }}
linux-swift-versions: ${{ steps.extract-matrix.outputs.linux-swift-versions }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- id: extract-matrix
run: |
echo "macos-versions=$(.github/create-matrix.sh macOS)" >> $GITHUB_OUTPUT
echo "linux-swift-versions=$(.github/create-matrix.sh Linux)" >> $GITHUB_OUTPUT
test-macos:
name: Test(macOS)
needs: extract-matrix
strategy:
matrix:
include: ${{ fromJson(needs.extract-matrix.outputs.macos-versions) }}
fail-fast: false
runs-on: ${{ matrix.runner }}
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- id: create-destination-key
name: Create destination key for cache
run: echo "destination-key=$(echo "xcode_${{ matrix.xcode }}-${{ matrix.destination }}" | sed 's/[, ]/_/g')" >> $GITHUB_OUTPUT
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: |
.build/SourcePackages
key: ${{ runner.os }}-${{ matrix.xcode }}-${{ steps.create-destination-key.outputs.destination-key }}-${{ hashFiles('Package.swift') }}
restore-keys: |
${{ runner.os }}-${{ matrix.xcode }}-${{ steps.create-destination-key.outputs.destination-key }}-
${{ runner.os }}-${{ matrix.xcode }}-
- name: Enable macro and plugin
run: |
defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES
defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
- name: List available simulators
run: |
xcrun simctl list
- name: Set up test package when repository is a template
if: ${{ github.event.repository.is_template }}
run: swift package init
- name: Preboot iPhone 18 Pro simulator # Ref: https://github.com/actions/runner-images/issues/12777
if: ${{ startsWith(matrix.xcode, '27') && endsWith(matrix.destination, 'name=iPhone 18 Pro') }}
run: |
xcrun simctl boot "iPhone 18 Pro" || true
xcrun simctl bootstatus "iPhone 18 Pro"
- name: test
run: |
defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
set -o pipefail && \
xcrun xcodebuild \
-enableCodeCoverage YES \
-scheme "$(xcodebuild -list -json | jq -rc '.workspace.schemes[0] // .workspace.name')" \
-destination "${{ matrix.destination }}" \
-derivedDataPath '.build' \
-resultBundlePath 'test_output/TestResult.xcresult' \
clean test | xcbeautify
- name: Upload test result
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
if: success() || failure()
with:
name: ${{ steps.create-destination-key.outputs.destination-key }}
path: test_output
if-no-files-found: error
retention-days: 1
merge-xcresult:
name: Merge xcresult
needs: test-macos
if: always() && !cancelled()
runs-on: macos-latest
steps:
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
path: test_output
- name: Merge
run: |
xcrun xcresulttool merge --output-path 'TestResult.xcresult' test_output/**/TestResult.xcresult
xcrun xcresulttool get test-results tests --path 'TestResult.xcresult' > 'result.json'
- name: Upload test result
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: merged-test-result
path: |
TestResult.xcresult
result.json
if-no-files-found: error
retention-days: 30
test-linux:
name: Test(Linux)
needs: extract-matrix
runs-on: ubuntu-latest
container: swift:${{ matrix.swift }}
strategy:
matrix:
swift: ${{ fromJson(needs.extract-matrix.outputs.linux-swift-versions) }}
fail-fast: false
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: |
.build/artifacts
.build/checkouts
.build/repositories
key: ${{ runner.os }}-${{ matrix.swift }}-${{ hashFiles('Package.swift') }}
restore-keys: |
${{ runner.os }}-${{ matrix.swift }}-
- name: Set up libxml if needed
run: |
# ref: https://discourse.ubuntu.com/t/psa-ubuntu-25-10-features-a-libxml2-version-with-api-breaking-changes/71783/2
libxml2_paths=$(ldconfig -p | grep libxml2 | sed -E 's/(.*) => (.*)/\2/g')
if [ -z "$(echo "$libxml2_paths" | grep '.so.2')" ] && [ -n "$(echo "$libxml2_paths" | grep '.so.16')" ]; then
libxml2_16_path="$(echo "$libxml2_paths" | grep '.so.16')"
libxml2_2_path="$(echo "$libxml2_16_path" | sed 's/\.so\.16/\.so\.2/')"
ln -s "$libxml2_16_path" "$libxml2_2_path"
fi
- name: Set up test package when repository is a template
if: ${{ github.event.repository.is_template }}
run: swift package init
- name: test
run: swift test
danger:
name: Danger
needs: merge-xcresult
if: ${{ always() && !cancelled() }}
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
issues: write
statuses: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
Comment thread
Copilot marked this conversation as resolved.
Resolved
continue-on-error: true
with:
name: merged-test-result
path: test_output
- name: Run Danger
uses: 417-72KI/danger-swiftlint@e0eee1ddb70909a05eb326714b269d7499d28ab8 # v6.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126 changes: 0 additions & 126 deletions .github/workflows/test.yml

This file was deleted.

Loading
Loading