Bump org.junit:junit-bom from 5.11.4 to 5.12.0 #2
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: Pull Request Build | |
on: pull_request | |
# if another commit is added to the PR (same github.head_ref), then cancel already running jobs | |
# and start a new build | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
env: | |
LANG: 'en_US.UTF-8' | |
jobs: | |
compile: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- uses: actions/cache@v4 | |
with: | |
key: maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: maven- | |
path: ~/.m2/repository | |
enableCrossOsArchive: true | |
- name: Fast Build with Maven | |
run: | | |
./mvnw --show-version --errors --batch-mode \ | |
verify -PfastSkip -DskipTests \ | |
deploy:deploy -DdogfoodStagingRepo="$(pwd)/target/staging" | |
- name: Cleanup local repository | |
run: | | |
# Cleanup local repository to not poison the shared cache with our SNAPSHOTS of the current build. | |
# Some information is stored in maven-metadata-*.xml files which tells maven which | |
# version exactly is available in the staging repo. But if we rerun the build using the | |
# older cache, it points to the old staging versions, which are not available anymore. | |
find ~/.m2/repository/net/sourceforge/pmd -type d -name "*-SNAPSHOT" -and -not -wholename "*/pmd-designer/*" | xargs rm -vrf | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: compile-artifact | |
if-no-files-found: error | |
path: | | |
*/target | |
*/*/target | |
!pmd-dist/target/pmd-dist-*-bin.zip | |
!pmd-dist/target/pmd-dist-*-src.zip | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: staging-repository | |
if-no-files-found: error | |
path: target/staging | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist-artifact | |
if-no-files-found: error | |
path: | | |
pmd-dist/target/pmd-dist-*-bin.zip | |
pmd-dist/target/pmd-dist-*-src.zip | |
verify: | |
needs: compile | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- uses: actions/cache@v4 | |
with: | |
key: maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: maven- | |
path: ~/.m2/repository | |
enableCrossOsArchive: true | |
- uses: actions/download-artifact@v4 | |
with: | |
name: compile-artifact | |
- name: Full Build with Maven | |
run: | | |
./mvnw --show-version --errors --batch-mode \ | |
verify \ | |
-DskipTests -Dmaven.test.skip=true | |
verify-unittests: | |
needs: compile | |
timeout-minutes: 30 | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
# don't fail fast - we want to know the results of all runs | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- uses: actions/setup-java@v4 | |
# under linux we execute more extensive integration tests with various java versions | |
if: ${{ runner.os == 'Linux' }} | |
with: | |
distribution: 'temurin' | |
java-version: | | |
8 | |
17 | |
21 | |
- uses: actions/setup-java@v4 | |
# default java version for all os is 11 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
# only restore the cache, don't create a new cache | |
# under Windows, hashFiles('**/pom.xml') gives a different result due to line endings | |
- uses: actions/cache/restore@v4 | |
with: | |
key: maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: maven- | |
path: ~/.m2/repository | |
enableCrossOsArchive: true | |
- uses: actions/download-artifact@v4 | |
# we can only reuse compile-artifacts under linux due to file timestamp issues and | |
# platform specific line endings in test files. | |
if: ${{ runner.os == 'Linux' }} | |
with: | |
name: compile-artifact | |
- name: Build with Maven and run unit tests | |
run: | | |
./mvnw --show-version --errors --batch-mode \ | |
verify \ | |
-PfastSkip -Dcyclonedx.skip=false \ | |
-Djava8.home="${JAVA_HOME_8_X64}" \ | |
-Djava17.home="${JAVA_HOME_17_X64}" \ | |
-Djava21.home="${JAVA_HOME_21_X64}" | |
dogfood: | |
needs: compile | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- uses: actions/cache@v4 | |
with: | |
key: maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: maven- | |
path: ~/.m2/repository | |
enableCrossOsArchive: true | |
- uses: actions/download-artifact@v4 | |
with: | |
name: compile-artifact | |
- uses: actions/download-artifact@v4 | |
with: | |
name: staging-repository | |
path: target/staging | |
- name: Run PMD on PMD | |
run: | | |
# this only works if the triggering event of this workflow is "pull_request" | |
pr_number="$(jq -r ".number" "${GITHUB_EVENT_PATH}")" | |
echo "Determined PR number: ${pr_number}" | |
current_pmd_version=$(./mvnw --batch-mode --no-transfer-progress \ | |
help:evaluate -Dexpression=project.version -q -DforceStdout || echo "failed_to_determine_current_pmd_version") | |
echo "Determined current pmd version: ${current_pmd_version}" | |
new_version="${current_pmd_version}-pr-${pr_number}-dogfood-SNAPSHOT" | |
echo "::group::Set version to ${new_version}" | |
./mvnw versions:set --quiet -DnewVersion="${new_version}" -DgenerateBackupPoms=false | |
sed -i 's/<version>[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}.*<\/version>\( *<!-- pmd.dogfood.version -->\)/<version>'"${current_pmd_version}"'<\/version>\1/' pom.xml | |
echo "::endgroup::" | |
echo "::group::Run ./mvnw verify" | |
./mvnw --show-version --errors --batch-mode \ | |
verify \ | |
-PfastSkip \ | |
-DdogfoodStagingRepo="$(pwd)/target/staging" \ | |
-DskipTests \ | |
-Dpmd.skip=false \ | |
-Dcpd.skip=false | |
echo "::endgroup::" | |
echo "::group::Restore version to ${current_pmd_version}" | |
./mvnw versions:set --quiet -DnewVersion="${current_pmd_version}" -DgenerateBackupPoms=false | |
git checkout -- pom.xml | |
echo "::endgroup::" | |
documentation: | |
needs: compile | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- uses: actions/cache@v4 | |
with: | |
key: maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: maven- | |
path: ~/.m2/repository | |
enableCrossOsArchive: true | |
- uses: actions/download-artifact@v4 | |
with: | |
name: compile-artifact | |
- name: Generate rule docs | |
run: | | |
./mvnw --show-version --errors --batch-mode \ | |
verify \ | |
-Pgenerate-rule-docs,fastSkip \ | |
-DskipTests -Dmaven.test.skip=true -Dassembly.skipAssembly=true | |
- name: Set up Ruby 3.3 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3 | |
- name: Setup bundler | |
run: | | |
cd docs | |
bundle config set --local path vendor/bundle | |
bundle install | |
- name: Build documentation | |
run: | | |
cd docs | |
bundle exec jekyll build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: docs-artifact | |
if-no-files-found: error | |
path: docs/_site | |
regressiontester: | |
needs: compile | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- name: Set up Ruby 3.3 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.m2/repository | |
~/.gradle/caches | |
~/work/pmd/target/repositories | |
vendor/bundle | |
key: regressiontester-${{ hashFiles('.ci/files/project-list.xml', 'Gemfile.lock') }} | |
restore-keys: regressiontester- | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist-artifact | |
path: pmd-dist/target | |
- name: Setup bundler | |
run: | | |
bundle config set --local gemfile .ci/files/Gemfile | |
bundle config set --local path vendor/bundle | |
bundle install | |
- name: Prepare HOME/openjdk11 | |
run: | | |
ln -sfn "${JAVA_HOME_11_X64}" "${HOME}/openjdk11" | |
- name: Run pmdtester | |
env: | |
# this only works if the triggering event of this workflow is "pull_request" | |
PMD_CI_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} | |
PMD_CI_BRANCH: ${{ github.base_ref }} | |
run: | | |
echo "::group::Fetching additional commits" | |
# git clone initially only fetched with depth 2. Regression tester | |
# needs more history, so we'll fetch more here | |
# and create local branches as well (${PMD_CI_BRANCH} and pr-fetch) | |
echo "Fetching 25 commits for ${PMD_CI_BRANCH} and pull/${PMD_CI_PULL_REQUEST_NUMBER}/head" | |
git fetch --no-tags --depth=25 origin "${PMD_CI_BRANCH}:${PMD_CI_BRANCH}" "pull/${PMD_CI_PULL_REQUEST_NUMBER}/head:pr-fetch" | |
# if the PR is older, base might have advanced more than 25 commits... fetch more, up to 150 | |
for i in $(seq 1 3); do | |
if [ -z "$( git merge-base "${PMD_CI_BRANCH}" "pr-fetch" )" ]; then | |
echo "No merge-base yet - fetching more commits... (try $i)" | |
git fetch --no-tags --deepen=50 origin "${PMD_CI_BRANCH}:" "pull/${PMD_CI_PULL_REQUEST_NUMBER}/head:pr-fetch" | |
fi | |
done | |
echo "Merge base is: $( git merge-base "${PMD_CI_BRANCH}" "pr-fetch" )" | |
echo "::endgroup::" | |
echo "::group::Running pmdtester on branch ${PMD_CI_BRANCH}" | |
bundle exec ruby .ci/files/pmdtester.rb | |
echo "::endgroup::" | |
- name: Workaround actions/upload-artifact#176 | |
run: | | |
echo "artifacts_path=$(realpath ..)" >> "${GITHUB_ENV}" | |
- name: Upload regression tester report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pmd-regression-tester | |
if-no-files-found: error | |
path: ${{ env.artifacts_path }}/target/reports/diff |