diff --git a/.github/workflows/sonarqube-scan.yml b/.github/workflows/sonarqube-scan.yml new file mode 100644 index 00000000..34f6936d --- /dev/null +++ b/.github/workflows/sonarqube-scan.yml @@ -0,0 +1,37 @@ +name: SonarQube Scan +on: + pull_request: + push: + branches: [ master ] + workflow_dispatch: +jobs: + sonarQube: + name: SonarQube-Job + runs-on: ubuntu-latest + steps: + + - name: Checkout source repo + uses: actions/checkout@v1 + with: + ref: '${{ github.head_ref }}' + + - name: Checkout GitHub Action Repo + uses: actions/checkout@master + with: + repository: EnterpriseDB/edb-github-actions.git + ref: master + token: ${{ secrets.GH_SLONIK }} + path: .github/actions/edb-github-actions + + - name: SonarQube Scan + uses: ./.github/actions/edb-github-actions/sonarqube + with: + REPO_NAME: '${{github.event.repository.name}}' + SONAR_PROJECT_KEY: EnterpriseDB_repmgr + SONAR_URL: '${{secrets.SONARQUBE_URL}}' + SONAR_LOGIN: '${{secrets.SONARQUBE_LOGIN}}' + PULL_REQUEST_KEY: '${{github.event.number}}' + PULL_REQUEST_BRANCH: '${{github.head_ref}}' + PULL_REQUEST_BASE_BRANCH: '${{github.base_ref}}' + REPO_DEFAULT_BRANCH: '${{github.event.repository.default_branch}}' + REPO_EXCLUDE_FILES: '*properties*,**/src/test/**/*,**/*.sql,**/docs/**/*,**/*/*.java' \ No newline at end of file diff --git a/.github/workflows/sonarqube/configure-env.sh b/.github/workflows/sonarqube/configure-env.sh new file mode 100755 index 00000000..f123d646 --- /dev/null +++ b/.github/workflows/sonarqube/configure-env.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +DEBIAN_FRONTEND=noninteractive sudo apt-get -y install debhelper curl autoconf zlib1g-dev \ + libedit-dev libxml2-dev libxslt1-dev libkrb5-dev libssl-dev libpam0g-dev systemtap-sdt-dev \ + libselinux1-dev build-essential bison apt-utils lsb-release devscripts \ + software-properties-common git shellcheck flex + +sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' +wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - +sudo apt-get update + +sudo apt-get -y install libpq-dev postgresql-13 postgresql-server-dev-13 + +./configure + +export PG_CONFIG=/usr/bin/pg_config + +/home/buildfarm/sonar/depends/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir build_wrapper_output_directory make