Merge pull request #556 from rudderlabs/master #785
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: 'Tests & Coverage' | |
on: | |
workflow_dispatch: | |
push: | |
branches: ['master', 'develop'] | |
pull_request: | |
branches: ['master', 'develop'] | |
types: ['opened', 'reopened', 'synchronize'] | |
jobs: | |
cancel_previous: | |
name: 'Cancel previous Tests & Coverage' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: styfle/[email protected] | |
with: | |
workflow_id: ${{ github.event.workflow.id }} | |
build: | |
name: 'Tests & Coverage' | |
needs: cancel_previous | |
runs-on: macos-latest-large | |
env: | |
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install sonar-scanner and build-wrapper | |
uses: SonarSource/sonarcloud-github-c-cpp@v2 | |
- name: Install xcpretty | |
run: gem install xcpretty | |
- name: Install Cocoapods | |
run: gem install cocoapods | |
- name: Pod install | |
run: pod install --repo-update | |
- name: Run build-wrapper | |
run: | | |
build-wrapper-macosx-x86 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} xcodebuild -workspace Rudder.xcworkspace -scheme Rudder_iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' | xcpretty | |
- name: Run tests(iOS) | |
run: | | |
xcodebuild -workspace Rudder.xcworkspace -scheme RudderTests-iOS test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -enableCodeCoverage YES -derivedDataPath build | xcpretty | |
- name: Run tests(tvOS) | |
run: | | |
xcodebuild -workspace Rudder.xcworkspace -scheme RudderTests-tvOS test -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV' -enableCodeCoverage YES -derivedDataPath build | xcpretty | |
- name: Run tests(watchOS) | |
run: | | |
xcodebuild -workspace Rudder.xcworkspace -scheme RudderTests-watchOS test -sdk watchsimulator -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 (45mm)' -enableCodeCoverage YES -derivedDataPath build | xcpretty | |
- name: Collect coverage into one XML report | |
run: | | |
bash xccov-to-generic.sh build/Logs/Test/*.xcresult/ > generic-coverage.xml | |
- name: SonarCloud Scan | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar-scanner -Dsonar.host.url=https://sonarcloud.io |