Add build.yml with POC actions #1
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
on: | |
# Trigger analysis when pushing in master or pull requests, and when creating | |
# a pull request. | |
push: | |
branches: | |
- master | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened] | |
name: Main Workflow | |
jobs: | |
sonarqube: | |
runs-on: ubuntu-latest | |
env: | |
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# Disabling shallow clone is recommended for improving relevancy of reporting | |
fetch-depth: 0 | |
- name: Install sonar-scanner and build-wrapper | |
uses: claire-villard-sonarsource/sonarqube-github-c-cpp@v1 | |
env: | |
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
- name: Run build-wrapper | |
run: | | |
#here goes your compilation wrapped with build-wrapper; See https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/languages/c-family/#using-build-wrapper for more information | |
# build-preparation steps | |
# build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} build-command | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
run: sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" #Consult https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scanners/sonarscanner/ for more information and options |