Skip to content

Commit

Permalink
Merge branch 'main' into issues/4185-enum-source-range
Browse files Browse the repository at this point in the history
  • Loading branch information
yhkuo41 authored Jan 7, 2025
2 parents 07806ad + 0a55239 commit 78e6bdc
Show file tree
Hide file tree
Showing 1,461 changed files with 1,970 additions and 1,566 deletions.
1 change: 0 additions & 1 deletion .github/actions/run-gradle/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@ runs:
-Pjunit.develocity.predictiveTestSelection.enabled=true \
-Pjunit.develocity.predictiveTestSelection.selectRemainingTests=${{ github.event_name != 'pull_request' }} \
"-Dscan.value.GitHub job=${{ github.job }}" \
--refresh-dependencies \
javaToolchains \
${{ inputs.arguments }}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash -e

rm -rf checksums*
rm -f checksums-1.txt checksums-2.txt

export SOURCE_DATE_EPOCH=$(date +%s)
SOURCE_DATE_EPOCH=$(date +%s)
export SOURCE_DATE_EPOCH

function calculate_checksums() {
OUTPUT=$1
Expand All @@ -12,15 +13,14 @@ function calculate_checksums() {
--no-build-cache \
-Porg.gradle.java.installations.auto-download=false \
-Dscan.tag.Reproducibility \
--refresh-dependencies \
clean \
assemble

find . -name '*.jar' \
| grep '/build/libs/' \
| grep --invert-match 'javadoc' \
| sort \
| xargs sha256sum > "${OUTPUT}"
| xargs sha512sum > "${OUTPUT}"
}


Expand Down
5 changes: 5 additions & 0 deletions .github/scripts/waitForMavenCentralSync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

URL_PATH=$1
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
"$SCRIPT_DIR"/waitForUrl.sh "https://repo1.maven.org/maven2/$URL_PATH"
9 changes: 9 additions & 0 deletions .github/scripts/waitForUrl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

URL=$1
printf 'Waiting for %s' "$URL"
until curl --output /dev/null --silent --location --head --fail "$URL"; do
printf '.'
sleep 5
done
echo ' OK'
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:

publish_artifacts:
name: Publish Snapshot Artifacts
needs: Linux
needs: macOS
runs-on: ubuntu-latest
permissions:
attestations: write # required for build provenance attestation
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
concurrency:
group: github-pages-${{ github.ref }}
cancel-in-progress: true
needs: Linux
needs: macOS
runs-on: ubuntu-latest
steps:
- name: Check out repository
Expand Down
257 changes: 257 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
name: Release

on:
workflow_dispatch:
inputs:
releaseVersion:
description: Version to be released (e.g. "5.12.0-M1")
required: true
stagingRepoId:
description: ID of the Nexus staging repository (e.g. "orgjunit-1159")
required: true

permissions: read-all

env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
STAGING_REPO_URL: https://oss.sonatype.org/service/local/repositories/${{ github.event.inputs.stagingRepoId }}/content
RELEASE_TAG: r${{ github.event.inputs.releaseVersion }}

jobs:

verify_reproducibility:
name: Verify reproducibility
runs-on: ubuntu-24.04 # required to get a recent version of `jc`
permissions:
attestations: write # required for build provenance attestation
id-token: write # required for build provenance attestation
steps:
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 1
ref: "refs/tags/${{ env.RELEASE_TAG }}"
- name: Download reference JAR from staging repository
id: referenceJar
run: |
curl --silent --fail --location --output /tmp/reference.jar \
"${{ env.STAGING_REPO_URL }}/org/junit/jupiter/junit-jupiter-api/${{ github.event.inputs.releaseVersion }}/junit-jupiter-api-${{ github.event.inputs.releaseVersion }}.jar"
sudo apt-get update && sudo apt-get install --yes jc
unzip -c /tmp/reference.jar META-INF/MANIFEST.MF | jc --jar-manifest | jq '.[0]' > /tmp/manifest.json
echo "createdBy=$(jq --raw-output .Created_By /tmp/manifest.json)" >> "$GITHUB_OUTPUT"
echo "buildTimestamp=$(jq --raw-output .Build_Date /tmp/manifest.json) $(jq --raw-output .Build_Time /tmp/manifest.json)" >> "$GITHUB_OUTPUT"
- name: Verify artifacts
uses: ./.github/actions/run-gradle
with:
encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
arguments: |
--rerun-tasks \
-Pmanifest.buildTimestamp="${{ steps.referenceJar.outputs.buildTimestamp }}" \
-Pmanifest.createdBy="${{ steps.referenceJar.outputs.createdBy }}" \
:verifyArtifactsInStagingRepositoryAreReproducible \
--remote-repo-url=${{ env.STAGING_REPO_URL }}
- name: Generate build provenance attestations
uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0
with:
subject-path: build/repo/**/*.jar
- name: Upload local repository for later jobs
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4
with:
name: local-maven-repository
path: build/repo

verify_consumability:
name: Verify consumability
runs-on: ubuntu-latest
steps:
- name: Check out samples repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
repository: ${{ github.repository_owner }}/junit5-samples
token: ${{ secrets.GH_TOKEN }}
fetch-depth: 1
- name: Set up JDK
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4
with:
java-version: 21
distribution: temurin
- uses: sbt/setup-sbt@96cf3f09dc501acdad7807fffe97dba9fa0709be # v1
- name: Update JUnit dependencies in samples
run: java src/Updater.java ${{ github.event.inputs.releaseVersion }}
- name: Inject staging repository URL
run: java src/StagingRepoInjector.java ${{ env.STAGING_REPO_URL }}
- name: Build samples
run: java src/Builder.java

release_staging_repo:
name: Release staging repo
needs: [verify_reproducibility, verify_consumability]
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 1
ref: "refs/tags/${{ env.RELEASE_TAG }}"
- name: Release staging repository
uses: ./.github/actions/run-gradle
with:
encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
arguments: |
releaseSonatypeStagingRepository \
--staging-repository-id=${{ github.event.inputs.stagingRepoId }}
publish_documentation:
name: Publish documentation
needs: release_staging_repo
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 1
ref: "refs/tags/${{ env.RELEASE_TAG }}"
- name: Configure Git
run: |
git config --global user.name "JUnit Team"
git config --global user.email "[email protected]"
- name: Build and publish documentation
uses: ./.github/actions/run-gradle
env:
GIT_USERNAME: git
GIT_PASSWORD: ${{ secrets.GH_TOKEN }}
with:
encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
arguments: |
--no-build-cache \
--no-configuration-cache \
clean \
gitPublishPush \
-Pdocumentation.replaceCurrentDocs=${{ contains(github.event.inputs.releaseVersion, '-') && 'false' || 'true' }}
- name: Wait for deployment to GitHub Pages
id: pagesDeployment
timeout-minutes: 20
run: |
URL="https://junit.org/junit5/docs/${{ github.event.inputs.releaseVersion }}/user-guide/junit-user-guide-${{ github.event.inputs.releaseVersion }}.pdf"
./.github/scripts/waitForUrl.sh "$URL"
echo "pdfUrl=$URL" >> "$GITHUB_OUTPUT"
- name: Verify integrity of PDF version of User Guide
timeout-minutes: 15
run: |
curl --silent --fail --location --output /tmp/junit-user-guide.pdf "${{ steps.pagesDeployment.outputs.pdfUrl }}"
sudo apt-get update && sudo apt-get install --yes poppler-utils
pdfinfo /tmp/junit-user-guide.pdf
close_github_milestone:
name: Close GitHub milestone
needs: release_staging_repo
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Find milestone
id: milestoneNumber
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
result-encoding: string
script: |
const openMilestones = await github.rest.issues.listMilestones({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open'
});
const [milestone] = openMilestones.data.filter(x => x.title === "${{ github.event.inputs.releaseVersion }}")
if (!milestone) {
throw new Error('Milestone "${{ github.event.inputs.releaseVersion }}" not found');
}
const requestBody = {
owner: context.repo.owner,
repo: context.repo.repo,
milestone_number: milestone.number,
state: 'closed'
};
console.log(requestBody);
await github.rest.issues.updateMilestone(requestBody);
wait_for_maven_central:
name: Wait for Maven Central
needs: release_staging_repo
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 1
ref: "refs/tags/${{ env.RELEASE_TAG }}"
- name: Download local Maven repository
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: local-maven-repository
path: build/repo
- name: Wait for sync to Maven Central
timeout-minutes: 30
run: |
find build/repo -name '*.pom' -printf './.github/scripts/waitForMavenCentralSync.sh %P\n' | sh
update_samples:
name: Update samples
needs: wait_for_maven_central
runs-on: ubuntu-latest
steps:
- name: Check out samples repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
repository: ${{ github.repository_owner }}/junit5-samples
token: ${{ secrets.GH_TOKEN }}
fetch-depth: 1
- name: Set up JDK
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4
with:
java-version: 21
distribution: temurin
- uses: sbt/setup-sbt@96cf3f09dc501acdad7807fffe97dba9fa0709be # v1
- name: Update JUnit dependencies in samples
run: java src/Updater.java ${{ github.event.inputs.releaseVersion }}
- name: Build samples
run: java src/Builder.java
- name: Create release branch
run: |
git config user.name "JUnit Team"
git config user.email "[email protected]"
git switch -c "${{ env.RELEASE_TAG }}"
git status
git commit -a -m "Use ${{ github.event.inputs.releaseVersion }}"
git push origin "${{ env.RELEASE_TAG }}"
- name: Update main branch (only for GA releases)
if: ${{ !contains(github.event.inputs.releaseVersion, '-') }}
run: |
git switch main
git merge --ff-only "${{ env.RELEASE_TAG }}"
git push origin main
create_github_release:
name: Create GitHub release
needs: wait_for_maven_central
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Create GitHub release
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
script: |
const releaseVersion = "${{ github.event.inputs.releaseVersion }}";
const jupiterVersion = releaseVersion;
const vintageVersion = releaseVersion;
const platformVersion = "1." + releaseVersion.substring(2);
const requestBody = {
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `r${releaseVersion}`,
name: `JUnit ${releaseVersion}`,
generate_release_notes: true,
body: `JUnit ${jupiterVersion} = Platform ${platformVersion} + Jupiter ${jupiterVersion} + Vintage ${vintageVersion}\n\nSee [Release Notes](https://junit.org/junit5/docs/${releaseVersion}/release-notes/).`,
prerelease: releaseVersion.includes("-"),
};
console.log(requestBody);
await github.rest.repos.createRelease(requestBody);
3 changes: 1 addition & 2 deletions .github/workflows/reproducible-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@ jobs:
--no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318
- name: Build and compare checksums
shell: bash
run: |
./gradle/scripts/checkBuildReproducibility.sh
run: ./.github/scripts/checkBuildReproducibility.sh
12 changes: 6 additions & 6 deletions documentation/documentation.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ asciidoctorj {
}

val buildRevision: String by rootProject.extra
val snapshot = rootProject.version.toString().contains("SNAPSHOT")
val docsVersion = if (snapshot) "snapshot" else rootProject.version
val releaseBranch = if (snapshot) "HEAD" else "r${rootProject.version}"
val snapshot = version.isSnapshot()
val docsVersion = if (snapshot) "snapshot" else version
val releaseBranch = if (snapshot) "HEAD" else "r${version}"
val docsDir = layout.buildDirectory.dir("ghpages-docs")
val replaceCurrentDocs = buildParameters.documentation.replaceCurrentDocs
val uploadPdfs = !snapshot
val userGuidePdfFileName = "junit-user-guide-${rootProject.version}.pdf"
val ota4jDocVersion = if (libs.versions.opentest4j.get().contains("SNAPSHOT")) "snapshot" else libs.versions.opentest4j.get()
val apiGuardianDocVersion = if (libs.versions.apiguardian.get().contains("SNAPSHOT")) "snapshot" else libs.versions.apiguardian.get()
val userGuidePdfFileName = "junit-user-guide-${version}.pdf"
val ota4jDocVersion = libs.versions.opentest4j.map { if (it.isSnapshot()) "snapshot" else it }.get()
val apiGuardianDocVersion = libs.versions.apiguardian.map { if (it.isSnapshot()) "snapshot" else it }.get()

gitPublish {
repoUri = "https://github.com/junit-team/junit5.git"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ JUnit repository on GitHub.
calling the internal `ReflectionUtils.makeAccessible(Field)` method directly.
* Support both the primitive type `void` and the wrapper type `Void` in the internal
`ReflectionUtils` to allow `String` to `Class` conversion in parameterized tests.
* New `--exclude-methodname` and `--include-methodname` options added to the
`ConsoleLauncher` to include or exclude methods based on fully qualified method names
without parameters. For example, `--exclude-methodname=^org\.example\..+#methodname`
will exclude all methods called `methodName` under package `org.example`.
* Add support for passing line and column number to `ConsoleLauncher` via
`--select-file` and `--select-resource`.
* `ConsoleLauncher` now accepts multiple values for all `--select` options.
Expand Down Expand Up @@ -96,10 +100,6 @@ JUnit repository on GitHub.
[[release-notes-5.12.0-M1-junit-jupiter-new-features-and-improvements]]
==== New Features and Improvements

* New `--exclude-methodname` and `--include-methodname` options added to the
`ConsoleLauncher` to include or exclude methods based on fully qualified method names
without parameters. For example, `--exclude-methodname=^org\.example\..+#methodname`
will exclude all methods called `methodName` under package `org.example`.
* In a `@ParameterizedTest` method, a `null` value can now be supplied for Java Date/Time
types such as `LocalDate` if the new `nullable` attribute in
`@JavaTimeConversionPattern` is set to `true`.
Expand Down Expand Up @@ -139,6 +139,9 @@ JUnit repository on GitHub.
used to include them in test reports, such as the Open Test Reporting format.
* New `from` and `to` attributes added to `@EnumSource` to support range selection of
enum constants.
* Auto-registered extensions can now be
<<../user-guide/index.adoc#extensions-registration-automatic-filtering, filtered>> using
include and exclude patterns that can be specified as configuration parameters.


[[release-notes-5.12.0-M1-junit-vintage]]
Expand Down
2 changes: 1 addition & 1 deletion documentation/src/main/java/example/domain/Person.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2024 the original author or authors.
* Copyright 2015-2025 the original author or authors.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v2.0 which
Expand Down
Loading

0 comments on commit 78e6bdc

Please sign in to comment.