forked from phoedos/pmd
Add sonar and coveralls jobs
This commit is contained in:
@@ -18,6 +18,8 @@ for a ssh key, which is used to copy files to sourceforge.
|
|||||||
* PMD_SF_APIKEY
|
* PMD_SF_APIKEY
|
||||||
* GITHUB_OAUTH_TOKEN
|
* GITHUB_OAUTH_TOKEN
|
||||||
* GITHUB_BASE_URL
|
* GITHUB_BASE_URL
|
||||||
|
* COVERALLS_REPO_TOKEN
|
||||||
|
* SONAR_TOKEN
|
||||||
* DANGER_GITHUB_API_TOKEN
|
* DANGER_GITHUB_API_TOKEN
|
||||||
* PMD_CI_CHUNK_TOKEN
|
* PMD_CI_CHUNK_TOKEN
|
||||||
|
|
||||||
|
37
.ci/build-coveralls.sh
Executable file
37
.ci/build-coveralls.sh
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source $(dirname $0)/inc/logger.inc
|
||||||
|
source $(dirname $0)/inc/setup-secrets.inc
|
||||||
|
source $(dirname $0)/inc/install-openjdk.inc
|
||||||
|
source $(dirname $0)/inc/maven-dependencies.inc
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
log_group_start "Setup private env and OpenJDK"
|
||||||
|
pmd_ci_setup_private_env
|
||||||
|
install_openjdk_setdefault 11
|
||||||
|
export CI_NAME="github actions"
|
||||||
|
export CI_BUILD_URL="${PMD_CI_JOB_URL}"
|
||||||
|
export CI_BRANCH="${PMD_CI_GIT_REF##refs/heads/}"
|
||||||
|
log_group_end
|
||||||
|
|
||||||
|
log_group_start "Downloading maven dependencies"
|
||||||
|
maven_dependencies_resolve
|
||||||
|
log_group_end
|
||||||
|
|
||||||
|
log_group_start "Executing build with coveralls"
|
||||||
|
./mvnw \
|
||||||
|
-Dmaven.javadoc.skip=true \
|
||||||
|
-Dmaven.source.skip \
|
||||||
|
-Dcheckstyle.skip \
|
||||||
|
-DrepoToken=${COVERALLS_REPO_TOKEN} \
|
||||||
|
-B -V -e \
|
||||||
|
clean package jacoco:report \
|
||||||
|
coveralls:report -Pcoveralls
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
log_error "Error creating coveralls report"
|
||||||
|
else
|
||||||
|
log_success "New coveralls result: https://coveralls.io/github/pmd/pmd"
|
||||||
|
fi
|
||||||
|
log_group_end
|
33
.ci/build-sonar.sh
Executable file
33
.ci/build-sonar.sh
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source $(dirname $0)/inc/logger.inc
|
||||||
|
source $(dirname $0)/inc/setup-secrets.inc
|
||||||
|
source $(dirname $0)/inc/install-openjdk.inc
|
||||||
|
source $(dirname $0)/inc/maven-dependencies.inc
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
log_group_start "Setup private env and OpenJDK"
|
||||||
|
pmd_ci_setup_private_env
|
||||||
|
install_openjdk_setdefault 11
|
||||||
|
log_group_end
|
||||||
|
|
||||||
|
log_group_start "Downloading maven dependencies"
|
||||||
|
maven_dependencies_resolve
|
||||||
|
log_group_end
|
||||||
|
|
||||||
|
log_group_start "Executing build with sonar"
|
||||||
|
./mvnw \
|
||||||
|
-Dmaven.javadoc.skip=true \
|
||||||
|
-Dmaven.source.skip \
|
||||||
|
-Dcheckstyle.skip \
|
||||||
|
-B -V -e \
|
||||||
|
clean package \
|
||||||
|
sonar:sonar -Dsonar.login=${SONAR_TOKEN} -Psonar
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
log_error "Error updating sonar..."
|
||||||
|
else
|
||||||
|
log_success "New sonar results: https://sonarcloud.io/dashboard?id=net.sourceforge.pmd%3Apmd"
|
||||||
|
fi
|
||||||
|
log_group_end
|
Binary file not shown.
1
.github/workflows/pull-requests.yml
vendored
1
.github/workflows/pull-requests.yml
vendored
@@ -7,7 +7,6 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
||||||
|
71
.github/workflows/pushes.yml
vendored
71
.github/workflows/pushes.yml
vendored
@@ -11,6 +11,8 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
linux:
|
linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: false
|
||||||
|
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
@@ -40,6 +42,7 @@ jobs:
|
|||||||
|
|
||||||
windows:
|
windows:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
needs: linux
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
@@ -50,16 +53,19 @@ jobs:
|
|||||||
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-
|
${{ runner.os }}-
|
||||||
- name: Install OpenJDK
|
- name: Check Environment
|
||||||
run: .ci/install-openjdk.sh
|
run: .ci/check-environment.sh
|
||||||
shell: bash
|
shell: bash
|
||||||
- name: Build with mvnw
|
- name: Build with mvnw
|
||||||
run: |
|
run: |
|
||||||
source ${HOME}/java.env
|
source .ci/inc/install-openjdk.inc
|
||||||
./mvnw -V clean install
|
install_openjdk_setdefault 11
|
||||||
|
./mvnw -V clean verify
|
||||||
|
shell: bash
|
||||||
|
|
||||||
macos:
|
macos:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
needs: linux
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
@@ -70,10 +76,59 @@ jobs:
|
|||||||
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-
|
${{ runner.os }}-
|
||||||
- name: Install OpenJDK
|
- name: Check Environment
|
||||||
run: .ci/install-openjdk.sh
|
run: .ci/check-environment.sh
|
||||||
shell: bash
|
shell: bash
|
||||||
- name: Build with mvnw
|
- name: Build with mvnw
|
||||||
run: |
|
run: |
|
||||||
source ${HOME}/java.env
|
source .ci/inc/install-openjdk.inc
|
||||||
./mvnw -V clean install
|
install_openjdk_setdefault 11
|
||||||
|
./mvnw -V clean verify
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
coveralls:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [linux, windows, macos]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.m2/repository
|
||||||
|
~/.cache
|
||||||
|
key: ${{ runner.os }}-coveralls-${{ hashFiles('**/pom.xml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-coveralls-
|
||||||
|
- name: Check Environment
|
||||||
|
run: .ci/check-environment.sh
|
||||||
|
shell: bash
|
||||||
|
- name: Build
|
||||||
|
run: .ci/build-coveralls.sh
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3
|
||||||
|
PMD_CI_SECRET_PASSPHRASE: ${{ secrets.PMD_CI_SECRET_PASSPHRASE }}
|
||||||
|
PMD_CI_JOB_URL: "https://github.com/pmd/pmd/runs/${{ github.run_id }}"
|
||||||
|
|
||||||
|
sonar:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [linux, windows, macos]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.m2/repository
|
||||||
|
~/.cache
|
||||||
|
key: ${{ runner.os }}-sonar-${{ hashFiles('**/pom.xml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-sonar-
|
||||||
|
- name: Check Environment
|
||||||
|
run: .ci/check-environment.sh
|
||||||
|
shell: bash
|
||||||
|
- name: Build
|
||||||
|
run: .ci/build-sonar.sh
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3
|
||||||
|
PMD_CI_SECRET_PASSPHRASE: ${{ secrets.PMD_CI_SECRET_PASSPHRASE }}
|
||||||
|
1
pom.xml
1
pom.xml
@@ -1028,6 +1028,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
||||||
<sonar.organization>pmd</sonar.organization>
|
<sonar.organization>pmd</sonar.organization>
|
||||||
|
<sonar.java.source>1.8</sonar.java.source>
|
||||||
</properties>
|
</properties>
|
||||||
<build>
|
<build>
|
||||||
<pluginManagement>
|
<pluginManagement>
|
||||||
|
Reference in New Issue
Block a user