Merge pull request #11 from PAYONE-GmbH/feature/support-cocoapods #110
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
# This workflow will build a Swift project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift | |
name: Swift | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main", "develop" ] | |
jobs: | |
build: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: swift-actions/[email protected] | |
with: | |
swift-version: "5.10.1" | |
- name: Install SwiftLint | |
run: brew install swiftlint | |
- name: Build | |
run: xcodebuild -scheme 'PCPClient-Package' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=17.0' | |
- name: Run SwiftLint | |
run: | | |
set -o pipefail | |
swiftlint lint --strict --quiet | sed -E 's/^(.*):([0-9]+):([0-9]+): (warning|error|[^:]+): (.*)/::\4 title=Lint error,file=\1,line=\2,col=\3::\5\n\1:\2:\3/' | |
- name: Run tests | |
run: xcodebuild -scheme 'PCPClient-Package' -destination 'platform=iOS Simulator,name=iPhone 15 Pro' -skipPackagePluginValidation -derivedDataPath Build/ -enableCodeCoverage YES clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -resultBundlePath Coverage.xcresult test | |
- name: Make Sonar Compatible Code Coverage Report | |
run: bash xccov-to-sonarqube-generic.sh Coverage.xcresult >Coverage.xml | |
- name: Upload Coverage XML | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Coverage | |
path: Coverage.xml | |
retention-days: 1 | |
sonarcloud: | |
name: SonarCloud | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Download Coverage XML | |
uses: actions/download-artifact@v4 | |
with: | |
name: Coverage | |
- name: Update Paths for SonarCloud | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: "/Users/runner/work/PCP-client-iOS-SDK/PCP-client-iOS-SDK/" | |
replace: "" | |
regex: false | |
include: "Coverage.xml" | |
- name: Run SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
with: | |
args: > | |
-Dsonar.coverageReportPaths=Coverage.xml | |
-Dsonar.verbose=true | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |