Skip to content

ci: update workflow, version, toolchain settings #17

ci: update workflow, version, toolchain settings

ci: update workflow, version, toolchain settings #17

Workflow file for this run

name: "Analysis"
on: [push, pull_request, workflow_dispatch]
jobs:
sonarcloud:
name: "SonarCloud"
runs-on: macos-13
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: mobiledevops/xcode-select-version-action@v1
with:
xcode-select-version: "15.2.0"
- uses: swift-actions/setup-swift@v2
with:
swift-version: "6.0.2"
- uses: ConorMacBride/install-package@v1.1.0
with:
brew: ninja
- uses: SonarSource/sonarcloud-github-c-cpp@v3.2.0
- name: "Setup metal-cpp"
run: ./setup-metal-cpp.ps1 -Folder "externals" -FileName "metal-cpp_macOS15.2_iOS18.2.zip"
shell: pwsh
- uses: lukka/get-cmake@v4.0.0
with:
cmakeVersion: "~4.0.0"
- uses: lukka/run-vcpkg@v11.5
with:
vcpkgDirectory: "${{ runner.tool_cache }}/vcpkg"
vcpkgGitCommitId: b02e341c927f16d991edbd915d8ea43eac52096c # 2025.03.19
vcpkgJsonGlob: "**/vcpkg.json"
vcpkgConfigurationJsonGlob: "**/vcpkg-configuration.json"
runVcpkgInstall: true
- uses: lukka/run-cmake@v10.7
with:
configurePreset: "x64-osx-analysis"
- name: Run build-wrapper
run: |
build-wrapper-macosx-x86 --out-dir bw-output cmake --build --preset x64-osx-analysis
- name: "Run xcodebuild(build)"
run: |
xcodebuild -workspace . -list
xcodebuild -workspace . -scheme "Baguette-Package" -derivedDataPath DerivedData \
-destination "${{ env.DESTINATION }}" -configuration "${{ env.CONFIGURATION }}" \
build
shell: bash
env:
DESTINATION: "generic/platform=macOS"
CONFIGURATION: "Debug"
- name: "Run xcodebuild(test)"
run: |
xcodebuild -workspace . -scheme "Baguette-Package" -derivedDataPath DerivedData \
-destination "${{ env.DESTINATION }}" -configuration "${{ env.CONFIGURATION }}" \
-enableCodeCoverage YES \
test
shell: bash
env:
DESTINATION: "platform=macOS"
CONFIGURATION: "Debug"
- name: "Run xccov-to-sonarqube-generic.sh"
id: xcresult
run: |
xcresult_path=$(find DerivedData/Logs/Test/ -maxdepth 1 -name "Test*.xcresult" | tail -n 1)
echo "path=$xcresult_path" >> "$GITHUB_OUTPUT"
bash ./scripts/xccov-to-sonarqube-generic.sh $xcresult_path > docs/coverage.xml
shell: bash
- uses: kishikawakatsumi/xcresulttool@v1.7.1
with:
path: "${{ steps.xcresult.outputs.path }}"
- name: "Run xcrun(llvm-cov)"
run: |
profdata_path=$(find "DerivedData/Build/ProfileData" -name "Coverage.profdata" | tail -n 1)
xctest_path="DerivedData/Build/Products/Debug/BaguetteBridgeTests.xctest/Contents/MacOS/BaguetteBridgeTests"
xcrun --run llvm-cov show -instr-profile=$profdata_path $xctest_path > docs/coverage.report
shell: bash
- name: "Run sonar-scanner"
run: |
sonar-scanner \
--define sonar.links.ci=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \
--define sonar.cfamily.llvm-cov.reportPath=docs/coverage.report \
--define sonar.coverageReportPaths=docs/coverage.xml
# --define sonar.swift.coverage.reportPaths=docs/coverage.report
# --define sonar.cfamily.build-wrapper-output="${{ github.workspace }}/bw-output" \
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}