Skip to content

Simplify SonarCloud configuration #177

Simplify SonarCloud configuration

Simplify SonarCloud configuration #177

Workflow file for this run

name: Build
on:
push:
pull_request_target:
types: [labeled]
jobs:
build:
name: Build and test
runs-on: [self-hosted, macOS, ARM64]
env:
DERIVED_DATA_PATH: 'DerivedData'
DEVICE: 'iPhone 15 Pro'
steps:
- uses: actions/checkout@v3
with:
# Disable shallow clone for SonarCloud analysis
# https://docs.sonarsource.com/sonarqube-cloud/advanced-setup/ci-based-analysis/github-actions-for-sonarcloud
fetch-depth: 0
- uses: actions/cache@v3
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Run process.sh script
run: |
./Scripts/process.sh
exit $?
- name: Build and test
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -scheme 'CryptomatorCryptoLib' -destination "name=$DEVICE" -derivedDataPath $DERIVED_DATA_PATH -enableCodeCoverage YES clean test | xcbeautify
- name: Generate coverage report
run: |
xcresult_path=$(find $DERIVED_DATA_PATH/Logs/Test -name "*.xcresult" | head -n 1)
bash Scripts/xccov-to-sonarqube-generic.sh "$xcresult_path" > sonarqube-generic-coverage.xml
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@v6.0.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
continue-on-error: true
release:
name: Deploy and draft a release
runs-on: macos-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Draft release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
:construction: Work in Progress
draft: true
prerelease: false