fix: other review comments and workflow improvements
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 4022c68..44a6e1a 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml
@@ -10,11 +10,17 @@ # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause # -name: JSON-P API +name: Java CI with Maven on: - pull_request: push: + branches: + - 'main' + - '*-BRANCH' + pull_request: + branches: + - 'main' + - '*-BRANCH' concurrency: group: ${{ github.ref }} @@ -22,21 +28,35 @@ jobs: build: - name: Test on JDK ${{ matrix.java_version }} - runs-on: ubuntu-latest - strategy: matrix: - java_version: [ 17, 21, 25 ] + java-version: [ '17', '21', '25' ] + + name: Test on JDK ${{ matrix.java-version }} + runs-on: ubuntu-latest steps: - - name: Checkout for build - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Set up JDK - uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Set up JDK ${{ matrix.java-version }} + uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0 with: + java-version: ${{ matrix.java-version }} distribution: 'temurin' - java-version: ${{ matrix.java_version }} - cache: 'maven' - - name: Package + cache: maven + - name: Build project run: mvn -B -V -U -C clean package + - name: Verify TCK Distribution + run: | + # Unzip tck-dist zip + TCK_UNZIP=tck-dist/target/tck-unzipped + mkdir -p "$TCK_UNZIP" + unzip -q "$(ls tck-dist/target/*.zip)" -d "$TCK_UNZIP" + + # Find TCK directory + TCK_VERSIONED_ROOT=$(find "$TCK_UNZIP" -mindepth 1 -maxdepth 1 -type d) + + # Run artifact-install + "$TCK_VERSIONED_ROOT/artifacts/artifact-install.sh" + + # Verify pom.xml and sub-modules are valid + mvn -B -V -f "$TCK_VERSIONED_ROOT/bin/pom.xml" clean verify
diff --git a/.github/workflows/update-signature.yml b/.github/workflows/update-signature.yml index 6ebdb18..8b62459 100644 --- a/.github/workflows/update-signature.yml +++ b/.github/workflows/update-signature.yml
@@ -34,32 +34,31 @@ jobs: update: - name: Update signature file for JDK ${{ matrix.java_version }} - runs-on: ubuntu-latest strategy: max-parallel: 1 matrix: - java_version: [ 17 ] # Add other Java versions if multiple signature files are supported. + java-version: [ '17' ] # Add other Java versions if multiple signature files are supported. + + name: Update signature file for JDK ${{ matrix.java-version }} + runs-on: ubuntu-latest env: SIGNATURE_DIR: tck/tck-tests/src/main/resources/ee/jakarta/tck/jsonp/signaturetest UPDATE_BRANCH: update-signature-files-${{ github.sha }} steps: - - name: Checkout source - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Set up JDK ${{ matrix.java_version }} - uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Set up JDK ${{ matrix.java-version }} + uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0 with: distribution: 'temurin' - java-version: ${{ matrix.java_version }} + java-version: ${{ matrix.java-version }} cache: 'maven' - name: Generate signature file run: | - mvn -B -V -U -C install -N -DskipTests - mvn -B -V -U -C install -f api/pom.xml -DskipTests -Dmaven.javadoc.skip=true -Dgpg.skip=true - mvn -B -V -U -C package -N -f tck/pom.xml -Psignature-generation -Djdk.major.version=${{ matrix.java_version }} + mvn install -DskipTests -Dmaven.javadoc.skip=true -projects ".,api" + mvn package -DskipTests -Psignature-generation --file tck/pom.xml - name: Check for changes id: changes run: | @@ -78,10 +77,10 @@ git config user.name "github-actions[bot]" git checkout -b "${UPDATE_BRANCH}" git add "${SIGNATURE_DIR}" - git commit -s -m "Update signature file for JDK ${{ matrix.java_version }}" + git commit -s -m "Update signature file for JDK ${{ matrix.java-version }}" git push origin "${UPDATE_BRANCH}" gh pr create \ --base "${{ github.ref_name }}" \ --head "${UPDATE_BRANCH}" \ - --title "Update signature file for JDK ${{ matrix.java_version }}" \ + --title "Update signature file for JDK ${{ matrix.java-version }}" \ --body "Generated from ${{ github.sha }} after a change to the API module."
diff --git a/pom.xml b/pom.xml index 151c213..0f53782 100644 --- a/pom.xml +++ b/pom.xml
@@ -123,6 +123,8 @@ <maven.assembly.plugin.version>3.3.0</maven.assembly.plugin.version> <maven.antrun.plugin.version>3.1.0</maven.antrun.plugin.version> <exec.maven.plugin.version>3.6.3</exec.maven.plugin.version> + <maven.dependency.plugin.version>3.2.0</maven.dependency.plugin.version> + <maven.surefire.plugin.version>3.0.0-M5</maven.surefire.plugin.version> </properties> @@ -242,6 +244,16 @@ <artifactId>maven-assembly-plugin</artifactId> <version>${maven.assembly.plugin.version}</version> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>${maven.dependency.plugin.version}</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${maven.surefire.plugin.version}</version> + </plugin> </plugins> </pluginManagement> <plugins>
diff --git a/tck/pom.xml b/tck/pom.xml index 4fa35fd..5c87af8 100644 --- a/tck/pom.xml +++ b/tck/pom.xml
@@ -115,36 +115,6 @@ </dependencies> <build> <plugins> - <!-- Unpacks the API jar into target/json-api for use by sigtest-maven-plugin --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>unpack</id> - <phase>generate-sources</phase> - <goals> - <goal>unpack</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>jakarta.json</groupId> - <artifactId>jakarta.json-api</artifactId> - <version>${project.version}</version> - <type>jar</type> - <overWrite>false</overWrite> - <outputDirectory>${project.build.directory}/json-api</outputDirectory> - <!-- Include only compiled classes; exclude source and property files --> - <includes>**/*.class,**/*.xml</includes> - <excludes>**/*.properties</excludes> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> - </plugin> - <!-- Extract JDK modules into output directory for use by signature plugin --> <plugin> <groupId>org.codehaus.mojo</groupId> @@ -184,7 +154,7 @@ </execution> </executions> <configuration> - <classes>${project.build.directory}/json-api</classes> + <!-- Only a single directory is supported; the API jar is added via the provided dependency --> <classes>${project.build.directory}/jimage/java.base</classes> <packages> jakarta.json,