Restore discovery of libsndfile on Ubuntu (#1454) #868
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 | |
paths-ignore: | |
- '.azure/**' | |
- '.circleci/**' | |
- '.github/workflows/linux.yml' | |
- '.cirrus.yml' | |
- 'README.md' | |
pull_request: | |
types: [opened, synchronize, reopened] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
# Use Debug build for better code coverage results | |
BUILD_TYPE: Debug | |
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed | |
name: SonarCloud Workflow | |
jobs: | |
sonarcloud: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# Disabling shallow clone is recommended for improving relevancy of reporting | |
fetch-depth: 0 | |
- name: Add apt-get repositories | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test | |
- name: Update apt | |
run: sudo apt-get update -y | |
- name: Install Dependencies | |
run: sudo -E apt-get -yq --no-install-suggests --no-install-recommends install cmake-data cmake libglib2.0-0 libsndfile-dev libasound2-dev libjack-dev portaudio19-dev libsdl2-dev libpulse-dev libdbus-1-dev libsystemd-dev libinstpatch-dev libreadline-dev lcov gcovr | |
- name: Create Build Environment | |
# Some projects don't allow in-source building, so create a separate build directory | |
# We'll use this as our working directory for all subsequent commands | |
run: | | |
cmake -E make_directory ${{github.workspace}}/build | |
echo $PATH | |
- name: Get Sonar Build Wrapper | |
shell: bash | |
working-directory: ${{github.workspace}}/build | |
run: | | |
set -ex | |
wget https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip | |
unzip build-wrapper-linux-x86.zip | |
mv build-wrapper-linux-x86/* . | |
- name: Configure CMake | |
# Use a bash shell so we can use the same syntax for environment variable | |
# access regardless of the host operating system | |
shell: bash | |
working-directory: ${{github.workspace}}/build | |
run: cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -Werror=dev -Denable-portaudio=1 -Denable-ladspa=1 -Denable-coverage=1 -DNO_GUI=1 $GITHUB_WORKSPACE | |
- name: Install sonar-scanner and build-wrapper | |
uses: SonarSource/sonarcloud-github-c-cpp@v2 | |
- name: Build | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
# Execute the build. You can specify a specific target with "--target <NAME>" | |
run: | | |
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
# Execute tests defined by the CMake configuration. | |
run: | | |
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make coverage | |
# sonar-scanner does not like utf8 filenames | |
- name: Prepare for Sonar | |
run: | | |
rm -rf ${{ github.workspace }}/sf2 | |
gcovr --version | |
gcovr --help | |
ls -la ${{ github.workspace }} | |
ls -la ${{ github.workspace }}/build | |
ls -la ${{ github.workspace }}/build/coverage | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar-scanner \ | |
-Dsonar.cfamily.build-wrapper-output="${{github.workspace}}/build/${{ env.BUILD_WRAPPER_OUT_DIR }}" \ | |
-Dsonar.coverageReportPaths=${{github.workspace}}/build/coverage/sonarqube.report |