Development of Version 3 (#30) #345
This file contains hidden or 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
# This workflow will build a Swift project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift | |
name: Build | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: macos-15 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Select Xcode | |
run: sudo xcode-select -switch /Applications/Xcode_16.app && /usr/bin/xcodebuild -version | |
# https://github.com/actions/runner-images/blob/main/images/macos/macos-15-arm64-Readme.md | |
- name: Boot iOS Simulator | |
run: > | |
xcrun simctl boot "iPhone 16" | |
- name: Run tests | |
run: > | |
xcodebuild | |
-scheme SearchOpsUnitTests | |
-destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' | |
-resultBundlePath TestResult/ | |
-enableCodeCoverage YES | |
-derivedDataPath "${RUNNER_TEMP}/Build/DerivedData" | |
clean build test | |
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | |
| xcpretty -r junit && exit ${PIPESTATUS[0]} | |
- name: Convert coverage report to sonarqube format | |
run: > | |
bash ./.github/workflows/xccov-to-sonarqube-generic.sh *.xcresult/ > sonarqube-generic-coverage.xml | |
- name: Upload coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
path: sonarqube-generic-coverage.xml | |
retention-days: 1 # Artifact will be available only for 5 days. | |
sonar-scan: | |
name: Sonar scan | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout repository on branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.HEAD_REF }} | |
fetch-depth: 0 | |
- name: Download all workflow run artifacts | |
uses: actions/download-artifact@v4 | |
- name: Unpack Artifact | |
run: > | |
ls -l ./ | |
- name: Run sonar-scanner | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
with: | |
args: > | |
-Dsonar.projectKey=mccaffers_SearchOps | |
-Dsonar.organization=mccaffers | |
-Dsonar.coverageReportPaths=artifact/sonarqube-generic-coverage.xml |