Skip to content

chore(deps): bump actions/setup-node from 4 to 5 #48

chore(deps): bump actions/setup-node from 4 to 5

chore(deps): bump actions/setup-node from 4 to 5 #48

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
release:
types: [ created ]
env:
SWIFT_VERSION: '5.9'
XCODE_VERSION: '15.0'
IOS_DEPLOYMENT_TARGET: '16.0'
jobs:
# Lint and Format Check
lint:
name: SwiftLint
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Install SwiftLint
run: brew install swiftlint
- name: Run SwiftLint
run: swiftlint --strict --reporter github-actions-logging
# Unit Tests
test:
name: Unit Tests
runs-on: macos-13
strategy:
matrix:
destination:
- 'platform=iOS Simulator,OS=17.0,name=iPhone 15 Pro'
- 'platform=iOS Simulator,OS=16.0,name=iPhone 14'
- 'platform=iOS Simulator,OS=16.0,name=iPad Pro (12.9-inch) (6th generation)'
steps:
- uses: actions/checkout@v4
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app
- name: Build and Test
run: |
xcodebuild clean test \
-scheme WidgetDevelopmentKit \
-destination '${{ matrix.destination }}' \
-enableCodeCoverage YES \
-resultBundlePath TestResults \
| xcpretty --test --color
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-results
path: TestResults
# Code Coverage
coverage:
name: Code Coverage
runs-on: macos-13
needs: test
steps:
- uses: actions/checkout@v4
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app
- name: Build for Testing
run: |
xcodebuild build-for-testing \
-scheme WidgetDevelopmentKit \
-destination 'platform=iOS Simulator,OS=17.0,name=iPhone 15 Pro' \
-enableCodeCoverage YES
- name: Run Tests with Coverage
run: |
xcodebuild test-without-building \
-scheme WidgetDevelopmentKit \
-destination 'platform=iOS Simulator,OS=17.0,name=iPhone 15 Pro' \
-enableCodeCoverage YES
- name: Generate Coverage Report
run: |
xcrun llvm-cov export \
-format="lcov" \
-instr-profile=$(find . -name "*.profdata") \
$(find . -name "*.app") > coverage.lcov
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.lcov
flags: unittests
name: codecov-umbrella
# Security Scan
security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Trivy Security Scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
scan-ref: '.'
format: 'sarif'
output: 'trivy-results.sarif'
- name: Upload Trivy Results
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'
# Build Framework
build:
name: Build Framework
runs-on: macos-13
needs: [lint, test]
strategy:
matrix:
configuration: [Debug, Release]
steps:
- uses: actions/checkout@v4
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app
- name: Build Framework
run: |
xcodebuild build \
-scheme WidgetDevelopmentKit \
-configuration ${{ matrix.configuration }} \
-destination 'generic/platform=iOS' \
-archivePath build/WidgetDevelopmentKit.xcarchive \
archive
- name: Create XCFramework
if: matrix.configuration == 'Release'
run: |
xcodebuild -create-xcframework \
-archive build/WidgetDevelopmentKit.xcarchive \
-framework WidgetDevelopmentKit.framework \
-output build/WidgetDevelopmentKit.xcframework
- name: Upload XCFramework
if: matrix.configuration == 'Release'
uses: actions/upload-artifact@v4
with:
name: WidgetDevelopmentKit.xcframework
path: build/WidgetDevelopmentKit.xcframework
# Documentation
documentation:
name: Generate Documentation
runs-on: macos-13
needs: build
steps:
- uses: actions/checkout@v4
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app
- name: Build Documentation
run: |
xcodebuild docbuild \
-scheme WidgetDevelopmentKit \
-destination 'generic/platform=iOS' \
-derivedDataPath build
- name: Process Documentation
run: |
$(xcrun --find docc) process-archive \
transform-for-static-hosting \
build/Build/Products/Debug-iphoneos/WidgetDevelopmentKit.doccarchive \
--output-path docs \
--hosting-base-path iOS-Widget-Development-Kit
- name: Upload Documentation
uses: actions/upload-artifact@v4
with:
name: documentation
path: docs
# SwiftPM Validation
swiftpm:
name: SwiftPM Validation
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app
- name: Resolve Dependencies
run: swift package resolve
- name: Build Package
run: swift build -c release
- name: Run Package Tests
run: swift test
# Performance Benchmarks
benchmark:
name: Performance Benchmarks
runs-on: macos-13
needs: build
steps:
- uses: actions/checkout@v4
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app
- name: Run Benchmarks
run: |
xcodebuild test \
-scheme WidgetDevelopmentKit-Benchmarks \
-destination 'platform=iOS Simulator,OS=17.0,name=iPhone 15 Pro' \
-only-testing:WidgetDevelopmentKitBenchmarks
- name: Upload Benchmark Results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: BenchmarkResults
# Release
release:
name: Release
runs-on: macos-13
needs: [build, documentation, security]
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
- name: Download XCFramework
uses: actions/download-artifact@v3
with:
name: WidgetDevelopmentKit.xcframework
path: build
- name: Create Release Archive
run: |
zip -r WidgetDevelopmentKit-${{ github.event.release.tag_name }}.xcframework.zip build/WidgetDevelopmentKit.xcframework
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./WidgetDevelopmentKit-${{ github.event.release.tag_name }}.xcframework.zip
asset_name: WidgetDevelopmentKit-${{ github.event.release.tag_name }}.xcframework.zip
asset_content_type: application/zip
# Deploy Documentation
deploy-docs:
name: Deploy Documentation
runs-on: ubuntu-latest
needs: documentation
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Download Documentation
uses: actions/download-artifact@v3
with:
name: documentation
path: docs
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
cname: widgets.yourdomain.com