Skip to content

Commit

Permalink
Update RadiantKit.yml (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
leogdion authored Jan 9, 2025
1 parent 3f783b8 commit 530619a
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 99 deletions.
159 changes: 82 additions & 77 deletions .github/workflows/RadiantKit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ on:
push:
branches-ignore:
- '*WIP'
env:
PACKAGE_NAME: RadiantKit

jobs:
build-ubuntu:
name: Build on Ubuntu
Expand All @@ -13,7 +12,7 @@ jobs:
if: "!contains(github.event.head_commit.message, 'ci skip')"
runs-on: ubuntu-latest
container:
image: swift:6.0.1-noble
image: swift:6.0
steps:
- uses: actions/checkout@v4
- name: Cache swift package modules
Expand All @@ -40,102 +39,108 @@ jobs:
flags: swift-${{ matrix.swift-version }},ubuntu
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }}
files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }}
build-macos:
name: Build on macOS
runs-on: ${{ matrix.os }}
env:
PACKAGE_NAME: RadiantKit
runs-on: ${{ matrix.runs-on }}
if: "!contains(github.event.head_commit.message, 'ci skip')"
strategy:
fail-fast: false
matrix:
include:
- xcode: "/Applications/Xcode_16.1.app"
os: macos-14
iOSVersion: "18.1"
watchOSVersion: "11.0"
watchName: "Apple Watch Series 9 (41mm)"
iPhoneName: "iPhone 15"
# SPM Build Matrix
- runs-on: macos-15
xcode: "/Applications/Xcode_16.1.app"
- runs-on: macos-15
xcode: "/Applications/Xcode_16.2.app"

# iOS Build Matrix
- type: ios
runs-on: macos-15
xcode: "/Applications/Xcode_16.1.app"
deviceName: "iPhone 16"
osVersion: "18.1"
- type: ios
runs-on: macos-15
xcode: "/Applications/Xcode_16.2.app"
deviceName: "iPhone 16 Pro"
osVersion: "18.2"

# watchOS Build Matrix
- type: watchos
runs-on: macos-15
xcode: "/Applications/Xcode_16.1.app"
deviceName: "Apple Watch Ultra 2 (49mm)"
osVersion: "11.1"
- type: watchos
runs-on: macos-15
xcode: "/Applications/Xcode_16.2.app"
deviceName: "Apple Watch Ultra 2 (49mm)"
osVersion: "11.2"

- type: visionos
runs-on: macos-15
xcode: "/Applications/Xcode_16.2.app"
deviceName: "Apple Vision Pro"
osVersion: "2.1"

steps:
- uses: actions/checkout@v4

- name: Set Xcode Name
run: echo "XCODE_NAME=$(basename -- ${{ matrix.xcode }} | sed 's/\.[^.]*$//' | cut -d'_' -f2)" >> $GITHUB_ENV

- name: Setup Xcode
run: sudo xcode-select -s ${{ matrix.xcode }}/Contents/Developer

# SPM Cache Step
- name: Cache swift package modules
id: cache-spm-macos
uses: actions/cache@v4
env:
cache-name: cache-spm
with:
path: .build
key: ${{ matrix.os }}-build-${{ env.cache-name }}-${{ matrix.xcode }}-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ matrix.os }}-build-${{ env.cache-name }}-${{ matrix.xcode }}-
- name: Cache mint
if: startsWith(matrix.xcode,'/Applications/Xcode_16.1')
id: cache-mint
uses: actions/cache@v4
env:
cache-name: cache-mint
with:
path: .mint
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Mintfile') }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Set Xcode Name
run: echo "XCODE_NAME=$(basename -- ${{ matrix.xcode }} | sed 's/\.[^.]*$//' | cut -d'_' -f2)" >> $GITHUB_ENV
- name: Setup Xcode
run: sudo xcode-select -s ${{ matrix.xcode }}/Contents/Developer || (sudo ls -1 /Applications | grep "Xcode")
- name: Build SPM
if: "!matrix.type"
run: swift build

- name: Run Swift Package tests
if: "!matrix.type"
run: swift test -v --enable-code-coverage

- name: Enable Swift Testing
run: |
mkdir -p ~/Library/org.swift.swiftpm/security/
cp macros.json ~/Library/org.swift.swiftpm/security/
- name: Install mint
if: startsWith(matrix.xcode,'/Applications/Xcode_16.1')
run: |
brew update
brew install mint
- name: Build
run: swift build
- name: Run Swift Package tests
run: swift test --enable-code-coverage
- uses: sersoft-gmbh/swift-coverage-action@v4
id: coverage-files-spm
with:
fail-on-empty-output: true
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
cp macros.json ~/Library/org.swift.swiftpm/security/
# Common iOS/watchOS Test Steps
- name: Run Device Tests
if: matrix.type
run: >
xcodebuild test
-scheme ${{ env.PACKAGE_NAME }}-Package
-sdk ${{ matrix.type == 'ios' && 'iphonesimulator' || matrix.type == 'watchos' && 'watchsimulator' || 'xrsimulator' }}
-destination 'platform=${{ matrix.type == 'ios' && 'iOS Simulator' || matrix.type == 'watchos' && 'watchOS Simulator' || 'visionOS Simulator' }},name=${{ matrix.deviceName }},OS=${{ matrix.osVersion }}'
-enableCodeCoverage YES
build test
# Common Coverage Steps
- name: Process Coverage
uses: sersoft-gmbh/swift-coverage-action@v4
with:
files: ${{ join(fromJSON(steps.coverage-files-spm.outputs.files), ',') }}
token: ${{ secrets.CODECOV_TOKEN }}
flags: macOS,${{ env.XCODE_NAME }},${{ matrix.runs-on }}
- name: Clean up spm build directory
run: rm -rf .build
- name: Lint
run: ./scripts/lint.sh
if: startsWith(matrix.xcode,'/Applications/Xcode_16.1')
- name: Run iOS target tests
run: xcodebuild test -scheme ${{ env.PACKAGE_NAME }}-Package -destination 'platform=iOS Simulator,name=${{ matrix.iPhoneName }},OS=${{ matrix.iOSVersion }}' -enableCodeCoverage YES build test
- uses: sersoft-gmbh/swift-coverage-action@v4
id: coverage-files-iOS
with:
fail-on-empty-output: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ join(fromJSON(steps.coverage-files-iOS.outputs.files), ',') }}
flags: iOS,iOS${{ matrix.iOSVersion }},macOS,${{ env.XCODE_NAME }}
- name: Run watchOS target tests
run: xcodebuild test -scheme ${{ env.PACKAGE_NAME }}-Package -destination 'platform=watchOS Simulator,name=${{ matrix.watchName }},OS=${{ matrix.watchOSVersion }}' -enableCodeCoverage YES build test
- uses: sersoft-gmbh/swift-coverage-action@v4
id: coverage-files-watchOS
with:
fail-on-empty-output: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4

- name: Upload Coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ join(fromJSON(steps.coverage-files-watchOS.outputs.files), ',') }}
flags: watchOS,watchOS${{ matrix.watchOSVersion }},macOS,${{ env.XCODE_NAME }}
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ matrix.type && format('{0}{1}', matrix.type, matrix.osVersion) || 'spm' }}
20 changes: 1 addition & 19 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "0cd2dcc1e220681712709df5bd794ab7f349d718bc63840353fae6e361bc50c4",
"originHash" : "362c175ebdbfb2ba6f4dc6fdad5774fc749aaa570da46652b8854a9d305e25ce",
"pins" : [
{
"identity" : "swift-log",
Expand All @@ -9,24 +9,6 @@
"revision" : "9cb486020ebf03bfa5b5df985387a14a98744537",
"version" : "1.6.1"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-syntax.git",
"state" : {
"revision" : "515f79b522918f83483068d99c68daeb5116342d",
"version" : "600.0.0-prerelease-2024-09-04"
}
},
{
"identity" : "swift-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-testing.git",
"state" : {
"revision" : "c55848b2aa4b29a4df542b235dfdd792a6fbe341",
"version" : "0.12.0"
}
}
],
"version" : 3
Expand Down
4 changes: 1 addition & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ let package = Package(
)
],
dependencies: [
.package(url: "https://github.com/swiftlang/swift-testing.git", from: "0.12.0"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
],
targets: [
Expand Down Expand Up @@ -78,8 +77,7 @@ let package = Package(
.testTarget(
name: "RadiantKitTests",
dependencies: [
"RadiantKit",
.product(name: "Testing", package: "swift-testing")
"RadiantKit"
]
)
]
Expand Down

0 comments on commit 530619a

Please sign in to comment.