Skip to content

Commit

Permalink
Create a test target for FlareUI library
Browse files Browse the repository at this point in the history
  • Loading branch information
nik3212 committed Feb 28, 2024
1 parent aba0de1 commit e720307
Show file tree
Hide file tree
Showing 14 changed files with 457 additions and 30 deletions.
35 changes: 30 additions & 5 deletions .github/workflows/ci.yml → .github/workflows/flare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ on:
paths:
- '.swiftlint.yml'
- ".github/workflows/**"
- "Package@swift-5.7.swift"
- "Package@swift-5.8.swift"
- "Package.swift"
- "Source/**"
- "Source/Flare/**"
- "Tests/**"

jobs:
Expand Down Expand Up @@ -49,7 +51,12 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "Flare" -destination "platform=macOS" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
run: |
xcodebuild clean build-for-testing \
-scheme "Flare" \
-destination "platform=macOS" \
-enableCodeCoverage YES \
-resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3.1.0
with:
Expand Down Expand Up @@ -86,7 +93,13 @@ jobs:
- name: Generate project
run: make generate
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "Flare" -destination "${{ matrix.destination }}" -testPlan AllTests clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
run: |
xcodebuild clean build-for-testing \
-scheme "Flare" \
-destination "${{ matrix.destination }}" \
-testPlan AllTests \
-enableCodeCoverage YES \
-resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
Expand Down Expand Up @@ -117,7 +130,13 @@ jobs:
- name: Generate project
run: make generate
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "Flare" -destination "${{ matrix.destination }}" -testPlan AllTests clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
run: |
xcodebuild clean build-for-testing \
-scheme "Flare" \
-destination "${{ matrix.destination }}" \
-testPlan AllTests \
-enableCodeCoverage YES \
-resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3.1.0
with:
Expand Down Expand Up @@ -158,7 +177,13 @@ jobs:
- name: Generate project
run: make generate
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "Flare" -destination "${{ matrix.destination }}" -testPlan UnitTests clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
run: |
xcodebuild clean build-for-testing \
-scheme "Flare" \
-destination "${{ matrix.destination }}" \
-testPlan UnitTests \
-enableCodeCoverage YES \
-resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3.1.0
with:
Expand Down
265 changes: 265 additions & 0 deletions .github/workflows/flare_ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
name: "flare-ui"

on:
push:
branches:
- main
- dev
pull_request:
paths:
- '.swiftlint.yml'
- ".github/workflows/**"
- "Package@swift-5.7.swift"
- "Package@swift-5.8.swift"
- "Package.swift"
- "Source/FlareUI/**"
- "Tests/**"

jobs:
SwiftLint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: GitHub Action for SwiftLint
uses: norio-nomura/action-swiftlint@3.2.1
with:
args: --strict
env:
DIFF_BASE: ${{ github.base_ref }}
macOS:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
env:
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- xcode: "Xcode_15.0"
runsOn: macos-13
name: "macOS 13, Xcode 15.0, Swift 5.9.0"
- xcode: "Xcode_14.3.1"
runsOn: macos-13
name: "macOS 13, Xcode 14.3.1, Swift 5.8.0"
- xcode: "Xcode_14.2"
runsOn: macOS-12
name: "macOS 12, Xcode 14.2, Swift 5.7.2"
- xcode: "Xcode_14.1"
runsOn: macOS-12
name: "macOS 12, Xcode 14.1, Swift 5.7.1"
steps:
- uses: actions/checkout@v3
- name: ${{ matrix.name }}
run: |
xcodebuild clean build-for-testing \
-scheme "FlareUI" \
-destination "platform=macOS" \
-testPlan FlareUI \
-enableCodeCoverage YES \
-resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: test_output/${{ matrix.name }}.xcresult
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: test_output

iOS:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
env:
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- destination: "OS=17.0.1,name=iPhone 14 Pro"
name: "iOS 17.0.1"
xcode: "Xcode_15.0"
runsOn: macos-13
- destination: "OS=16.4,name=iPhone 14 Pro"
name: "iOS 16.4"
xcode: "Xcode_14.3.1"
runsOn: macos-13
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: make setup_build_tools
- name: Generate project
run: make generate
- name: ${{ matrix.name }}
run: |
xcodebuild clean build-for-testing \
-scheme "FlareUI" \
-destination "${{ matrix.destination }}" \
-testPlan FlareUI \
-enableCodeCoverage YES \
-resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: test_output

tvOS:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
env:
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- destination: "OS=17.0,name=Apple TV"
name: "tvOS 17.0"
xcode: "Xcode_15.0"
runsOn: macos-13
- destination: "OS=16.4,name=Apple TV"
name: "tvOS 16.4"
xcode: "Xcode_14.3.1"
runsOn: macos-13
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: make setup_build_tools
- name: Generate project
run: make generate
- name: ${{ matrix.name }}
run: |
xcodebuild clean build-for-testing \
-scheme "FlareUI" \
-destination "${{ matrix.destination }}" \
-testPlan FlareUI \
-enableCodeCoverage YES \
-resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: test_output/${{ matrix.name }}.xcresult
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: test_output

watchOS:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
env:
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- destination: "OS=10.0,name=Apple Watch Series 9 (45mm)"
name: "watchOS 10.0"
xcode: "Xcode_15.0"
runsOn: macos-13
- destination: "OS=9.4,name=Apple Watch Series 8 (45mm)"
name: "watchOS 9.4"
xcode: "Xcode_14.3.1"
runsOn: macos-13
- destination: "OS=8.5,name=Apple Watch Series 7 (45mm)"
name: "watchOS 8.5"
xcode: "Xcode_14.3.1"
runsOn: macos-13
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: make setup_build_tools
- name: Generate project
run: make generate
- name: ${{ matrix.name }}
run: |
xcodebuild clean build-for-testing \
-scheme "FlareUI" \
-destination "${{ matrix.destination }}" \
-testPlan FlareUI \
-enableCodeCoverage YES \
-resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: test_output/${{ matrix.name }}.xcresult
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: test_output

spm:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
env:
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- name: "Xcode 15"
xcode: "Xcode_15.0"
runsOn: macos-13
- name: "Xcode 14"
xcode: "Xcode_14.3.1"
runsOn: macos-13
steps:
- uses: actions/checkout@v3
- name: ${{ matrix.name }}
run: swift build -c release --target FlareUI

merge-test-reports:
needs: [iOS, macOS, watchOS, tvOS]
runs-on: macos-13
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: test_output
- run: xcrun xcresulttool merge test_output/**/*.xcresult --output-path test_output/final/final.xcresult
- name: Upload Merged Artifact
uses: actions/upload-artifact@v4
with:
name: MergedResult
path: test_output/final

discover-typos:
name: Discover Typos
runs-on: macOS-12
env:
DEVELOPER_DIR: /Applications/Xcode_14.1.app/Contents/Developer
steps:
- uses: actions/checkout@v2
- name: Discover typos
run: |
export PATH="$PATH:/Library/Frameworks/Python.framework/Versions/3.11/bin"
python3 -m pip install --upgrade pip
python3 -m pip install codespell
codespell --ignore-words-list="hart,inout,msdos,sur" --skip="./.build/*,./.git/*"
# Beta:
# name: ${{ matrix.name }}
# runs-on: firebreak
# env:
# DEVELOPER_DIR: "/Applications/Xcode_15.0.app/Contents/Developer"
# timeout-minutes: 10
# strategy:
# fail-fast: false
# matrix:
# include:
# - destination: "OS=1.0,name=Apple Vision Pro"
# name: "visionOS 1.0"
# scheme: "Flare"
# steps:
# - uses: actions/checkout@v3
# - name: ${{ matrix.name }}
# run: xcodebuild test -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" clean || exit 1
6 changes: 6 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,11 @@ let package = Package(
.product(name: "TestConcurrency", package: "concurrency"),
]
),
.testTarget(
name: "FlareUITests",
dependencies: [
"Flare",
]
),
]
)
6 changes: 6 additions & 0 deletions Package@swift-5.7.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,11 @@ let package = Package(
.product(name: "TestConcurrency", package: "concurrency"),
]
),
.testTarget(
name: "FlareUITests",
dependencies: [
"Flare",
]
),
]
)
6 changes: 6 additions & 0 deletions Package@swift-5.8.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,11 @@ let package = Package(
.product(name: "TestConcurrency", package: "concurrency"),
]
),
.testTarget(
name: "FlareUITests",
dependencies: [
"Flare",
]
),
]
)
Loading

0 comments on commit e720307

Please sign in to comment.