Integ all #146
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
name: SonarCloud | |
on: | |
release: | |
types: [published] | |
pull_request: | |
types: [opened, synchronize, reopened] | |
workflow_dispatch: | |
inputs: | |
LIBHTTPSERVER_VERSION: | |
type: string | |
required: no | |
default: default | |
description: Libhttpserver git version | |
jobs: | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
env: | |
TLS: OPENSSL | |
DEPENDENCIES: libjansson-dev libconfig-dev libssl-dev libsqlite3-dev | |
BUILD_WRAPPER_OUT_DIR: bw-output | |
LIBHTTPSERVER_VERSION: ${{ inputs.LIBHTTPSERVER_VERSION }} | |
SONARCLOUD_OPTIONS: > | |
-D sonar.host.url=https://sonarcloud.io | |
-D sonar.organization=${{ vars.SONARCLOUD_ORGANIZATION }} | |
-D sonar.projectKey=${{ vars.SONARCLOUD_PROJECTKEY }} | |
-D sonar.sources=${{ vars.SONARCLOUD_SOURCES }} | |
-D sonar.cfamily.gcov.reportsPath=. | |
-D sonar.cfamily.cache.enabled=false | |
-D sonar.sourceEncoding=UTF-8 | |
-D sonar.scm.exclusions.disabled=true | |
steps: | |
- name: install dependencies | |
run: | | |
sudo apt update | |
sudo apt install $DEPENDENCIES | |
- name: checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: change libhttpserver version | |
if: github.event_name == 'workflow_dispatch' && 'default' != inputs.LIBHTTPSERVER_VERSION | |
run: | | |
cd libhttpserver | |
git pull origin ${{ inputs.LIBHTTPSERVER_VERSION }} | |
- name: libhttpserver version | |
run: | | |
git log -1 | |
- name: sonar-scanner and build-wrapper | |
id: sonarcloud | |
uses: SonarSource/sonarcloud-github-c-cpp@v2 | |
- name: configure | |
run: | | |
cat configs/sonarcloud_defconfig | |
make prefix=/usr sysconfdir=/etc/ouistiti sonarcloud_defconfig | |
- name: version | |
id: version | |
run: | | |
echo "VERSION=$(make version | awk '{print $2}')" >> "$GITHUB_OUTPUT" | |
- name: build hosttools | |
run: | | |
make hosttools | |
- name: build | |
run: | | |
${{ steps.sonarcloud.outputs.build-wrapper-binary }} --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make DEBUG=y G=1 | |
- name: run tests | |
run: | | |
sudo chmod a+w /tmp | |
./tests/run.sh -A || cat /tmp/ouistiti.test | |
- name: gcov | |
run: | | |
make DEBUG=y gcov | |
find . -name "*.gcov" -empty -delete | |
- name: options | |
id: options | |
run: > | |
echo "OPTIONS=${{ env.SONARCLOUD_OPTIONS }} -D sonar.projectVersion=${{ env.GITHUB_REF_NAME }}" >> "$GITHUB_OUTPUT" | |
- name: scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
${{ steps.sonarcloud.outputs.sonar-scanner-binary }} -D sonar.cfamily.build-wrapper-output=${{ env.BUILD_WRAPPER_OUT_DIR }} ${{ steps.options.outputs.OPTIONS }} |