Skip to content

refactor: refactoring autotrack core in sdk 4.x #1939

refactor: refactoring autotrack core in sdk 4.x

refactor: refactoring autotrack core in sdk 4.x #1939

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: macos-latest
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: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Pod Install
run: pod install
- name: Run tests to generate coverage statistics # https://sonarsource.atlassian.net/browse/CPP-3987
run: |
mkdir -p .DerivedData
mkdir -p .DerivedData/compilation-database
xcodebuild test -workspace GrowingAnalytics.xcworkspace \
-scheme GrowingAnalyticsTests \
-testPlan GrowingAnalyticsTests \
-destination 'platform=iOS Simulator,name=iPhone 13' \
-enableCodeCoverage YES \
-derivedDataPath .DerivedData \
OTHER_CFLAGS="\$(inherited) -gen-cdb-fragment-path .DerivedData/compilation-database"
pushd .DerivedData/compilation-database
sed -e '1s/^/[\'$'\n''/' -e '$s/,$/\'$'\n'']/' *.json > .DerivedData/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 .DerivedData/Logs/Test/*.xcresult/ \
> .DerivedData/cobertura-coverage.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: .DerivedData/cobertura-coverage.xml
- name: Parse xcresult to Sonarqube xml
run: |
xcresultparser -c -o xml .DerivedData/Logs/Test/*.xcresult/ \
> .DerivedData/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=".DerivedData/compile_commands.json" \
-Dsonar.coverageReportPaths=".DerivedData/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