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
81 changes: 81 additions & 0 deletions .ci/files/regenerate_metadata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash

echo "Regenerating metadata for p2-site..."
local releases=($(find . -maxdepth 1 -type d -regex "\./[0-9]+\.[0-9]+\.[0-9]+\..*" -printf '%f\n'| tr '.' '\0' | sort -t '\0' -k1,1nr -k2,2nr -k3,3nr -k4dr |awk -F '\0' '{printf "%s.%s.%s.%s\n", $1, $2, $3, $4}'))
# remove old releases
for i in "${releases[@]:5}"; do
pmd_ci_log_info "Removing old release $i..."
rm -rf "$i"
done
releases=("${releases[@]:0:5}")

# regenerate metadata
local now
now=$(date +%s000)
local children=""
local children_index=""
for i in "${releases[@]}"; do
children="${children} <child location=\"$i\"/>\n"
children_index="${children_index} * [$i]($i/)\n"
echo "This is a Eclipse Update Site for the [PMD Eclipse Plugin](https://github.com/pmd/pmd-eclipse-plugin/) ${i}.

Use <https://pmd.github.io/pmd-eclipse-plugin-p2-site/${i}/> to install the plugin with the Eclipse Update Manager.

<dl>
<dt>Feature ID</dt>
<dd>net.sourceforge.pmd.eclipse</dd>
<dt>Version</dt>
<dd>${i}</dd>
</dl>

" > "$i"/index.md

git add "$i"/index.md
done

local site_name="PMD for Eclipse - Update Site"
local artifactsTemplate="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<?compositeArtifactRepository version=\"1.0.0\"?>
<repository name=\"${site_name}\" type=\"org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository\" version=\"1.0.0\">
<properties size=\"2\">
<property name=\"p2.timestamp\" value=\"${now}\"/>
<property name=\"p2.atomic.composite.loading\" value=\"true\"/>
</properties>
<children size=\"${#releases[@]}\">
${children} </children>
</repository>"
echo -e "${artifactsTemplate}" > compositeArtifacts.xml

local contentTemplate="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<?compositeMetadataRepository version=\"1.0.0\"?>
<repository name=\"${site_name}\" type=\"org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository\" version=\"1.0.0\">
<properties size=\"2\">
<property name=\"p2.timestamp\" value=\"${now}\"/>
<property name=\"p2.atomic.composite.loading\" value=\"true\"/>
</properties>
<children size=\"${#releases[@]}\">
${children} </children>
</repository>"
echo -e "${contentTemplate}" > compositeContent.xml

# p2.index
local p2_index="version = 1
metadata.repository.factory.order = compositeContent.xml,\!
artifact.repository.factory.order = compositeArtifacts.xml,\!"
echo -e "${p2_index}" > p2.index

# regenerate index.md
echo -e "This is a composite Eclipse Update Site for the [PMD Eclipse Plugin](https://github.com/pmd/pmd-eclipse-plugin/).

Use <https://pmd.github.io/pmd-eclipse-plugin-p2-site/> to install the plugin with the Eclipse Update Manager.

----

Versions available at <https://pmd.github.io/pmd-eclipse-plugin-p2-site/>:

${children_index}

For older versions, see <https://sourceforge.net/projects/pmd/files/pmd-eclipse/zipped/>

" > index.md

35 changes: 0 additions & 35 deletions .github/actions/build/action.yml

This file was deleted.

25 changes: 7 additions & 18 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: 'Setup'
description: 'Setup java and ruby, check environment'
description: 'Setup java and xvfb'

runs:
using: 'composite'
steps:
- name: Set up JDK 21
id: java21
uses: actions/setup-java@v4
with:
distribution: temurin
Expand All @@ -20,21 +19,11 @@ runs:
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '**/*.target') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up Ruby 3.3
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
- name: Setup Environment
shell: bash
run: |
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 "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/30/scripts" >> $GITHUB_ENV
- name: Check Environment
- name: Setup xvfb
if: ${{ runner.os == 'Linux' }}
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
#see https://github.com/GabrielBB/xvfb-action
sudo apt-get install --yes xvfb
sudo apt-get install --yes libgtk2.0-0
echo 'xvfb_cmd=xvfb-run --auto-servernum' >> "$GITHUB_ENV"
67 changes: 44 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,73 @@
name: build
name: Build

on:
pull_request:
merge_group:
push:
branches:
- main
- '**'
# don't run on dependabot branches. Dependabot will create pull requests, which will then be run instead
- '!dependabot/**'
tags:
- '**'
pull_request:
workflow_dispatch:
schedule:
# build it monthly: At 05:00 on day-of-month 1.
- cron: '0 5 1 * *'
workflow_dispatch:

# if another commit is added to the same branch or PR (same github.ref),
# then cancel already running jobs and start a new build.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

env:
LANG: 'en_US.UTF-8'

jobs:
# verify build on one node before multiple builds on different os are started
fail-fast-build:
name: verify (ubuntu-latest, 2025-03)
timeout-minutes: 60
timeout-minutes: 30
defaults:
run:
shell: bash
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup

- name: Build
uses: ./.github/actions/build
with:
targetPlatform: 2025-03
deploy: true
pmdCiSecretPassphrase: ${{ secrets.PMD_CI_SECRET_PASSPHRASE }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
pmdCiGpgPrivateKey: ${{ secrets.PMD_CI_GPG_PRIVATE_KEY }}
pmdCiGpgPassphrase: ${{ secrets.PMD_CI_GPG_PASSPHRASE }}
run: |
${xvfb_cmd} ./mvnw --show-version --errors --batch-mode \
verify

- name: Upload screenshots of failed unit tests
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: screenshots-ubuntu-latest-2025-03
name: screenshots-ubuntu-latest
path: net.sourceforge.pmd.eclipse.plugin.test/screenshots
if-no-files-found: ignore

- name: Upload update-site
uses: actions/upload-artifact@v4
with:
name: update-site
path: net.sourceforge.pmd.eclipse.p2updatesite/target/net.sourceforge.pmd.eclipse.p2updatesite-*.zip

build:
needs: fail-fast-build
name: verify (${{ matrix.os }}, ${{ matrix.targetPlatform }})
timeout-minutes: 60
timeout-minutes: 30
defaults:
run:
shell: bash
continue-on-error: false

strategy:
Expand All @@ -70,17 +90,18 @@ jobs:

runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup

- name: Build
uses: ./.github/actions/build
with:
targetPlatform: ${{ matrix.targetPlatform }}
deploy: false
env:
TARGET_PLATFORM: ${{ matrix.targetPlatform }}
run: |
${xvfb_cmd} ./mvnw --show-version --errors --batch-mode \
verify \
-Dtarget.platform="${TARGET_PLATFORM}"

- name: Upload screenshots of failed unit tests
uses: actions/upload-artifact@v4
Expand Down
Loading