WIP feat: add watchOS support #2099
Workflow file for this run
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
name: CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: macos-latest | |
env: | |
DERIVED_DATA: $HOME/.DerivedData | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Install sonar-scanner and build-wrapper | |
uses: sonarsource/sonarcloud-github-c-cpp@v2 | |
- name: Cache cocoapods | |
uses: actions/cache@v3 | |
with: | |
path: ./Example/Pods | |
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pods- | |
- name: Pod Install | |
run: cd Example && pod install && cd .. | |
- name: Run tests to generate coverage statistics # https://sonarsource.atlassian.net/browse/CPP-3987 | |
run: | | |
mkdir -p ${{ env.DERIVED_DATA }} | |
xcodebuild test -workspace Example/GrowingAnalytics.xcworkspace \ | |
-scheme GrowingAnalyticsTests \ | |
-testPlan GrowingAnalyticsTests \ | |
-destination 'platform=iOS Simulator,name=iPhone 14' \ | |
-enableCodeCoverage YES \ | |
-derivedDataPath ${{ env.DERIVED_DATA }} \ | |
OTHER_CFLAGS="\$(inherited) -gen-cdb-fragment-path ${{ env.DERIVED_DATA }}/compilation-database" | |
pushd ${{ env.DERIVED_DATA }}/compilation-database | |
sed -e '1s/^/[\'$'\n''/' -e '$s/,$/\'$'\n'']/' *.json > ${{ env.DERIVED_DATA }}/compile_commands.json | |
popd | |
- name: Brew Install Xcresultparser | |
run: | | |
brew tap a7ex/homebrew-formulae | |
brew install xcresultparser | |
- name: Parse xcresult to Cobertura xml | |
run: | | |
xcresultparser -o cobertura ${{ env.DERIVED_DATA }}/Logs/Test/*.xcresult/ \ | |
> ${{ env.DERIVED_DATA }}/cobertura-coverage.xml | |
pwd | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
files: /Users/runner/.DerivedData/cobertura-coverage.xml | |
- name: Parse xcresult to Sonarqube xml | |
run: | | |
xcresultparser -c -o xml ${{ env.DERIVED_DATA }}/Logs/Test/*.xcresult/ \ | |
> ${{ env.DERIVED_DATA }}/sonar-coverage.xml | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar-scanner \ | |
-Dsonar.cfamily.compile-commands="${{ env.DERIVED_DATA }}/compile_commands.json" \ | |
-Dsonar.coverageReportPaths="${{ env.DERIVED_DATA }}/sonar-coverage.xml" | |
# https://github.com/sonarsource-cfamily-examples/macos-xcode-coverage-gh-actions-sc/blob/main/.github/workflows/build.yml | |
# https://github.com/SonarSource/sonarcloud-github-c-cpp |