Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions .github/workflows/eclipse-dash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Validates third-party dependencies against the Eclipse IP database (ClearlyDefined / IPLab)
name: eclipse-dash

on:
pull_request:
workflow_dispatch:
inputs:
review:
description: 'Open IPLab review requests for restricted dependencies'
type: boolean
default: false
schedule:
- cron: '20 21 * * 0'

# added using https://github.com/step-security/secure-repo
permissions:
contents: read

env:
DASH_VERSION: 1.1.0
DASH_PROJECT: locationtech.proj4j
DASH_TIMEOUT: 600 # seconds per request, ClearlyDefined is slow; the Dash default is 120

jobs:
license-check:
name: license-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # jgitver derives the version from git tags
persist-credentials: false
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: maven

- name: Collect dependencies
# compile and runtime dependencies of the published modules, without the proj4j modules themselves;
# package first so the reactor can resolve the inter-module dependencies
run: |
rm -f target/dependencies-raw.txt target/dependencies-list.txt
mvn -B -q -DskipTests -Dmaven.javadoc.skip=true -Dmaven.source.skip=true \
package dependency:list \
-DincludeScope=runtime \
-DexcludeGroupIds=org.locationtech.proj4j \
-DoutputFile="${PWD}/target/dependencies-raw.txt" \
-DappendOutput=true
# group:artifact:type[:classifier]:version:scope -> maven/mavencentral/group/artifact/version
sed -nE 's#^ +([^: ]+):([^: ]+):[^: ]+:(([^: ]+):)?([^: ]+):(compile|runtime)( .*)?$#maven/mavencentral/\1/\2/\5#p' \
target/dependencies-raw.txt | sort -u > target/dependencies-list.txt
cat target/dependencies-list.txt
echo "Number of dependencies: $(wc -l < target/dependencies-list.txt)"

- name: Download Dash License Tool
run: |
curl -sSfL -o dash.jar \
"https://repo.eclipse.org/repository/dash-licenses-releases/org/eclipse/dash/org.eclipse.dash.licenses/${DASH_VERSION}/org.eclipse.dash.licenses-${DASH_VERSION}.jar"

- name: License check
env:
REVIEW: ${{ github.event_name == 'workflow_dispatch' && inputs.review }}
DASH_LICENSES_TOKEN: ${{ secrets.DASH_LICENSES_TOKEN }}
REPO_URL: ${{ github.server_url }}/${{ github.repository }}
run: |
mkdir -p target/dash
ARGS=(-summary target/dash/summary -batch 50 -timeout "${DASH_TIMEOUT}" -project "${DASH_PROJECT}")
if [[ "${REVIEW}" == "true" ]]; then
if [[ -z "${DASH_LICENSES_TOKEN}" ]]; then
echo "::error::review requested but the DASH_LICENSES_TOKEN secret is not set"
exit 1
fi
ARGS+=(-review -repo "${REPO_URL}" -token "${DASH_LICENSES_TOKEN}")
fi
# exit code 127 is a Dash internal error, i.e. a ClearlyDefined request timeout; retry those
for attempt in 1 2 3; do
code=0
java -jar dash.jar "${ARGS[@]}" target/dependencies-list.txt || code=$?
[[ "${code}" != 127 ]] && break
echo "::warning::Dash internal error (exit code 127), attempt ${attempt} of 3"
sleep $((attempt * 30))
done
exit "${code}"

- name: Show summary
if: success() || failure()
run: |
if [[ ! -s target/dash/summary ]]; then
result="Dash did not produce a summary, see the License check step log"
else
result="$(grep -v ', approved,' target/dash/summary || echo "All dependencies are approved")"
fi
echo "${result}"
{
echo '### Dash license check'
echo '```'
echo "${result}"
echo '```'
} >> "$GITHUB_STEP_SUMMARY"

- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: dash-summary
path: |
target/dash/summary
target/dependencies-list.txt
54 changes: 54 additions & 0 deletions .github/workflows/eclipse-sboms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Uploads software bill-of-materials (SBOMs) to the Eclipse SBOM registry https://sbom.eclipse.org.
name: eclipse-sboms

on:
push:
branches: ['master']
tags: [v*]
workflow_dispatch:

permissions:
contents: read

jobs:
generate-sbom:
name: generate-sbom
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # OIDC token for the upload to the Eclipse PIA
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # jgitver derives the version from git tags
persist-credentials: false
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: maven

- name: Generate SBOM
# one aggregate CycloneDX 1.6 SBOM of all published modules, configured in pom.xml
run: |
mvn -B -q -DskipTests -Dmaven.javadoc.skip=true -Dmaven.source.skip=true \
package cyclonedx:makeAggregateBom

- name: Read version
id: version
run: |
VERSION="$(mvn -B -q help:evaluate -Dexpression=project.version -DforceStdout | tail -n1 | tr -d '[:space:]')"
echo "Product version is: $VERSION"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- uses: actions/upload-artifact@v4
with:
name: sbom-proj4j
path: target/bom.json

- name: Upload SBOM
uses: eclipse-csi/workflows/upload-sbom@0c1c6cf5cb4dc624a86410274c71b27d6273385a # there are no tags, this is main as of 2026-10-06
with:
sbom-file: ./target/bom.json
product-name: proj4j
product-version: ${{ steps.version.outputs.version }}
18 changes: 18 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,24 @@
</executions>
</plugin>

<!-- CycloneDX SBOM of the published modules, see .github/workflows/eclipse-sboms.yml.
Not bound to a phase; run `mvn package cyclonedx:makeAggregateBom` to write target/bom.json.
Test dependencies are excluded. -->
<plugin>
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-maven-plugin</artifactId>
<version>2.9.3</version>
<configuration>
<projectType>library</projectType>
<!-- the Eclipse PIA rejects CycloneDX 1.7 -->
<schemaVersion>1.6</schemaVersion>
<outputFormat>json</outputFormat>
<outputName>bom</outputName>
<!-- maven.deploy.skip is set on the root and inherited, which would otherwise skip every module -->
<skipNotDeployed>false</skipNotDeployed>
</configuration>
</plugin>

<!-- Maven Central Publish -->
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
Expand Down
Loading