Skip to content

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

refactor: refactoring autotrack core in sdk 4.x

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

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: |
xcodebuild test -workspace GrowingAnalytics.xcworkspace \
-scheme GrowingAnalyticsTests \
-testPlan GrowingAnalyticsTests \
-destination 'platform=iOS Simulator,name=iPhone 13' \
-enableCodeCoverage YES \
-derivedDataPath ./derivedData \
-resultBundlePath build/result.xcresult \
OTHER_CFLAGS="\$(inherited) -gen-cdb-fragment-path $(TARGET_BUILD_DIR)/build/compilation-database"
pushd build/compilation-database
sed -e '1s/^/[\'$'\n''/' -e '$s/,$/\'$'\n'']/' *.json > build/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 build/result.xcresult/ \
> build/cobertura-coverage.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: build/cobertura-coverage.xml
- name: Parse xcresult to Sonarqube xml
run: |
xcresultparser -c -o xml build/result.xcresult/ \
> build/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="build/compile_commands.json" \
-Dsonar.coverageReportPaths="build/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