[ci] Finish scripts migration, integration sonar+coveralls

This commit is contained in:
Andreas Dangel 2021-04-15 16:20:22 +02:00
parent 10c6906f0f
commit 417cc7fcbe
14 changed files with 61 additions and 615 deletions

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
source $(dirname $0)/inc/logger.inc
source $(dirname $0)/inc/setup-secrets.inc
source $(dirname $0)/inc/install-openjdk.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 "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

View File

@ -1,34 +0,0 @@
#!/usr/bin/env bash
source $(dirname $0)/inc/logger.inc
source $(dirname $0)/inc/install-openjdk.inc
source $(dirname $0)/inc/regression-tester.inc
set -e
log_group_start "Installing Java"
log_info "Install openjdk11 as default"
install_openjdk_setdefault 11
PMD_EXTRA_OPT=""
if [[ "$(uname)" == Linux* ]]; then
log_info "Install oracle7 for integration tests"
install_oraclejdk7
PMD_EXTRA_OPT="-Djava7.home=${HOME}/oraclejdk7"
fi
log_group_end
log_group_start "Building with maven"
./mvnw -e -V -B clean verify ${PMD_EXTRA_OPT}
log_group_end
# Danger is executed only on the linux runner
case "$(uname)" in
Linux*)
log_group_start "Executing danger"
regression_tester_setup_ci
regression_tester_executeDanger
log_group_end
;;
esac

View File

@ -1,28 +0,0 @@
#!/usr/bin/env bash
source $(dirname $0)/inc/logger.inc
source $(dirname $0)/inc/setup-secrets.inc
source $(dirname $0)/inc/install-openjdk.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 "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

View File

@ -80,6 +80,37 @@ function build() {
regression_tester_setup_ci regression_tester_setup_ci
regression_tester_uploadBaseline regression_tester_uploadBaseline
pmd_ci_log_group_end pmd_ci_log_group_end
if pmd_ci_maven_isSnapshotBuild; then
pmd_ci_log_group_start "Executing build with sonar"
# Note: Sonar also needs GITHUB_TOKEN (!)
./mvnw \
-Dmaven.javadoc.skip=true \
-Dmaven.source.skip \
-Dcheckstyle.skip \
-Dpmd.skip \
--show-version --errors --batch-mode --no-transfer-progress \
clean package \
sonar:sonar -Dsonar.login=${SONAR_TOKEN} -Psonar
pmd_ci_log_success "New sonar results: https://sonarcloud.io/dashboard?id=net.sourceforge.pmd%3Apmd"
pmd_ci_log_group_end
pmd_ci_log_group_start "Executing build with coveralls"
export CI_NAME="github actions"
export CI_BUILD_URL="${PMD_CI_JOB_URL}"
export CI_BRANCH="${PMD_CI_BRANCH}"
./mvnw \
-Dmaven.javadoc.skip=true \
-Dmaven.source.skip \
-Dcheckstyle.skip \
-Dpmd.skip \
-DrepoToken=${COVERALLS_REPO_TOKEN} \
--show-version --errors --batch-mode --no-transfer-progress \
clean package jacoco:report \
coveralls:report -Pcoveralls
pmd_ci_log_success "New coveralls result: https://coveralls.io/github/pmd/pmd"
pmd_ci_log_group_end
fi
} }

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,6 @@
- [ ] Added unit tests for fixed bug/feature - [ ] Added unit tests for fixed bug/feature
- [ ] Passing all unit tests - [ ] Passing all unit tests
- [ ] Complete build `./mvnw clean verify` passes (checked automatically by travis) - [ ] Complete build `./mvnw clean verify` passes (checked automatically by github actions)
- [ ] Added (in-code) documentation (if needed) - [ ] Added (in-code) documentation (if needed)

View File

@ -27,6 +27,7 @@ jobs:
path: | path: |
~/.m2/repository ~/.m2/repository
~/.cache ~/.cache
vendor/bundle
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }} key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: | restore-keys: |
${{ runner.os }}- ${{ runner.os }}-
@ -38,7 +39,7 @@ jobs:
shell: bash shell: bash
run: | run: |
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
echo "MAVEN_OPTS=-Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3" >> $GITHUB_ENV echo "MAVEN_OPTS=-Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3 -DstagingProgressTimeoutMinutes=30" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/master/scripts" >> $GITHUB_ENV echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/master/scripts" >> $GITHUB_ENV
- name: Check Environment - name: Check Environment
shell: bash shell: bash
@ -53,3 +54,4 @@ jobs:
shell: bash shell: bash
env: env:
PMD_CI_SECRET_PASSPHRASE: ${{ secrets.PMD_CI_SECRET_PASSPHRASE }} PMD_CI_SECRET_PASSPHRASE: ${{ secrets.PMD_CI_SECRET_PASSPHRASE }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,40 +0,0 @@
name: Pull Requests
on: pull_request
jobs:
build:
runs-on: ${{ matrix.os }}
continue-on-error: false
timeout-minutes: 60
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- uses: actions/cache@v2
with:
path: |
~/.m2/repository
~/.cache
vendor/bundle
key: pr-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
pr-${{ runner.os }}-
- name: Set up Ruby 2.7
uses: actions/setup-ruby@v1
with:
ruby-version: 2.7
- name: Check Environment
run: .ci/check-environment.sh
shell: bash
- name: Build
run: .ci/build-pr-win-macos.sh
shell: bash
env:
MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3
PMD_CI_BRANCH: ${{ github.event.pull_request.base.ref }}
PMD_CI_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}

View File

@ -1,118 +0,0 @@
name: Pushes
on:
push:
branches:
- main
- master
schedule:
# build it monthly: At 04:00 on day-of-month 1.
- cron: '0 4 1 * *'
jobs:
linux:
runs-on: ubuntu-latest
continue-on-error: false
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.m2/repository
~/.cache
vendor/bundle
key: push-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
push-${{ runner.os }}-
- name: Set up Ruby 2.7
uses: actions/setup-ruby@v1
with:
ruby-version: 2.7
- name: Check Environment
run: .ci/check-environment.sh
shell: bash
- name: Build
run: .ci/build.sh
shell: bash
env:
MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3 -DstagingProgressTimeoutMinutes=30
PMD_CI_SECRET_PASSPHRASE: ${{ secrets.PMD_CI_SECRET_PASSPHRASE }}
PMD_CI_JOB_URL: "https://github.com/pmd/pmd/runs/${{ github.run_id }}"
PMD_CI_PUSH_COMMIT_COMPARE: ${{ github.event.compare }}
PMD_CI_GIT_REF: ${{ github.ref }}
windows-macos:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest, macos-latest ]
needs: linux
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.m2/repository
~/.cache
vendor/bundle
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-
- name: Check Environment
run: .ci/check-environment.sh
shell: bash
- name: Build
run: .ci/build-pr-win-macos.sh
shell: bash
env:
MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3
coveralls:
runs-on: ubuntu-latest
needs: [linux]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.m2/repository
~/.cache
vendor/bundle
key: coveralls-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
coveralls-${{ runner.os }}-
- 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]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.m2/repository
~/.cache
vendor/bundle
key: sonar-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
sonar-${{ runner.os }}-
- 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 }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,28 +0,0 @@
name: Release Builds
on:
push:
tags:
- 'pmd_releases/*'
jobs:
release:
runs-on: ubuntu-latest
continue-on-error: false
steps:
- uses: actions/checkout@v2
- name: Set up Ruby 2.7
uses: actions/setup-ruby@v1
with:
ruby-version: 2.7
- name: Check Environment
run: .ci/check-environment.sh
shell: bash
- name: Build
run: .ci/build.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 }}"
PMD_CI_PUSH_COMMIT_COMPARE: ${{ github.event.compare }}
PMD_CI_GIT_REF: ${{ github.ref }}

View File

@ -26,11 +26,28 @@ jobs:
uses: actions/setup-ruby@v1 uses: actions/setup-ruby@v1
with: with:
ruby-version: 2.7 ruby-version: 2.7
- name: Install OpenJDK 11 - name: Setup Environment
shell: bash
run: | run: |
source .ci/inc/logger.inc echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
source .ci/inc/install-openjdk.inc echo "MAVEN_OPTS=-Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3 -DstagingProgressTimeoutMinutes=30" >> $GITHUB_ENV
install_openjdk 11 echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/master/scripts" >> $GITHUB_ENV
- name: Check Environment
shell: bash
run: |
f=check-environment.sh; \
mkdir -p .ci && \
( [ -e .ci/$f ] || curl -sSL "${PMD_CI_SCRIPTS_URL}/$f" > ".ci/$f" ) && \
chmod 755 .ci/$f && \
.ci/$f
- name: Build
run: |
f=openjdk.bash; \
mkdir -p .ci/inc && \
( [ -e .ci/inc/$f ] || curl -sSL "${PMD_CI_SCRIPTS_URL}/inc/$f" > ".ci/inc/$f" ) && \
source .ci/inc/$f ; \
pmd_ci_openjdk_install_adoptopenjdk 11 ; \
pmd_ci_openjdk_setdefault 11
shell: bash shell: bash
- name: Setup tmate session - name: Setup tmate session
uses: mxschmitt/action-tmate@v3 uses: mxschmitt/action-tmate@v3

View File

@ -25,12 +25,12 @@ limitations apply:
* Generally give **different results on Windows and Unix** because of different newlines. * Generally give **different results on Windows and Unix** because of different newlines.
(carriage return linefeed on Windows, linefeed on Unixes). (carriage return linefeed on Windows, linefeed on Unixes).
We build our releases under **Linux** on [Travis CI](https://travis-ci.com/pmd/pmd). We build our releases under **Linux** on [Github Actions](https://github.com/pmd/pmd/actions).
* Generally depend on the **major version of the JDK** used to compile. (Even with source/target defined, * Generally depend on the **major version of the JDK** used to compile. (Even with source/target defined,
each major JDK version changes the generated bytecode.). each major JDK version changes the generated bytecode.).
We build our releases using OpenJDK 11 (see "before_install" step in `.travis.yml`). We build our releases using OpenJDK 11.
## How to build the documentation? ## How to build the documentation?

View File

@ -7,8 +7,8 @@ gem 'pmdtester', '~> 1'
gem 'danger', '~> 5.6', '>= 5.6' gem 'danger', '~> 5.6', '>= 5.6'
# This group is only needed for rendering release notes # This group is only needed for rendering release notes
# this happens during release (.travis/release.sh and do-release.sh) # this happens during release (.ci/build.sh and do-release.sh)
# but also during regular builds (.travis/build-deploy.sh) # but also during regular builds (.ci/build.sh)
group :release_notes_preprocessing do group :release_notes_preprocessing do
gem 'liquid', '>=4.0.0' gem 'liquid', '>=4.0.0'
gem 'safe_yaml', '>=1.0' gem 'safe_yaml', '>=1.0'

View File

@ -1,7 +1,7 @@
# PMD # PMD
[![Join the chat at https://gitter.im/pmd/pmd](https://badges.gitter.im/pmd/pmd.svg)](https://gitter.im/pmd/pmd?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Join the chat at https://gitter.im/pmd/pmd](https://badges.gitter.im/pmd/pmd.svg)](https://gitter.im/pmd/pmd?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://github.com/pmd/pmd/workflows/Pushes/badge.svg?branch=master)](https://github.com/pmd/pmd/actions) [![Build Status](https://github.com/pmd/pmd/workflows/build/badge.svg?branch=master)](https://github.com/pmd/pmd/actions)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd)
[![Reproducible Builds](https://img.shields.io/badge/Reproducible_Builds-ok-green?labelColor=blue)](https://github.com/jvm-repo-rebuild/reproducible-central#net.sourceforge.pmd:pmd) [![Reproducible Builds](https://img.shields.io/badge/Reproducible_Builds-ok-green?labelColor=blue)](https://github.com/jvm-repo-rebuild/reproducible-central#net.sourceforge.pmd:pmd)
[![Coverage Status](https://coveralls.io/repos/github/pmd/pmd/badge.svg)](https://coveralls.io/github/pmd/pmd) [![Coverage Status](https://coveralls.io/repos/github/pmd/pmd/badge.svg)](https://coveralls.io/github/pmd/pmd)