Skip to content

Commit 10f171f

Browse files
committed
Merge branch 'pombast'
This branch updates the "mega-melt" integration test to use SciJava's new pombast command-line tool, which generalizes the concept of BOM component testing beyond only pom-scijava, and makes the pom-scijava testing more robust and featureful. It also updates many managed component versions in an effort to attain total BOM harmony once again.
2 parents 32481b4 + fbf2e22 commit 10f171f

24 files changed

Lines changed: 1559 additions & 1025 deletions

.github/build.sh

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,3 @@
11
#!/bin/sh
2-
3-
# Discern whether this is a release build.
4-
releasing=
5-
if [ -f release.properties ]; then
6-
releasing=1
7-
fi
8-
9-
# Run the SciJava CI build script.
10-
curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/main/ci-build.sh &&
11-
sh ci-build.sh || { echo "Maven build failed. Skipping melting pot tests."; exit 1; }
12-
13-
# Skip melting pot if cutting a release.
14-
if [ "$releasing" ]; then
15-
exit 0
16-
fi
17-
18-
# Helper method to get the last cache modified date as seconds since epoch
19-
last_cache_modified() {
20-
find "$HOME/.cache/scijava/melting-pot" -type f | while read f
21-
do
22-
stat -c '%Y' "$f"
23-
done | sort -nr 2>/dev/null | head -n1
24-
}
25-
26-
# Record the last time of cache modification before running melting-pot
27-
cache_modified_pre=0
28-
cache_modified_post=0
29-
30-
if [ -d "$HOME/.cache/scijava/melting-pot" ]; then
31-
cache_modified_pre=$(last_cache_modified)
32-
fi
33-
34-
# run melting-pot
35-
tests/run.sh
36-
meltResult=$?
37-
38-
# Record the last time of cache modification after running melting-pot
39-
if [ -d "$HOME/.cache/scijava/melting-pot" ]; then
40-
cache_modified_post=$(last_cache_modified)
41-
fi
42-
43-
# Determine if cache needs to be re-generated
44-
echo "cache_modified_pre=$cache_modified_pre"
45-
echo "cache_modified_post=$cache_modified_post"
46-
if [ "$cache_modified_post" -gt "$cache_modified_pre" ]; then
47-
echo "cacheChanged=true"
48-
echo "cacheChanged=true" >> $GITHUB_ENV
49-
else
50-
echo "cacheChanged=false"
51-
echo "cacheChanged=false" >> $GITHUB_ENV
52-
fi
53-
54-
# NB: This script exits 0, but saves the exit code for a later build step.
55-
echo $meltResult > exit-code
2+
curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/main/ci-build.sh
3+
sh ci-build.sh

.github/delete-cache.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
test "$1" || { echo "Usage: delete-cache.sh cache-key"; exit 1; }
3+
gh api --method DELETE \
4+
-H "Accept: application/vnd.github+json" \
5+
"/repos/scijava/pom-scijava/actions/caches?key=$1" || true

.github/exit.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/publish.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/sh
2+
# Commit a file to the status.scijava.org gh-pages branch.
3+
# Requires SSH agent to be running with write access to status.scijava.org.
4+
set -e
5+
6+
test $# -gt 1 || {
7+
echo "Usage: publish.sh \"Commit message\" file1 [file2 ...]"
8+
exit 2
9+
}
10+
11+
datestamp="$(TZ=UTC date +'%Y-%m-%d %H:%M:%S UTC')"
12+
message="$1 ($datestamp)"
13+
shift
14+
15+
git config --global user.name "SciJava CI"
16+
git config --global user.email ci@scijava.org
17+
18+
dest_dir=site-publish
19+
20+
git clone --depth=1 --branch=gh-pages git@github.com:scijava/status.scijava.org "$dest_dir"
21+
22+
while [ $# -gt 0 ]
23+
do
24+
file=$1
25+
shift
26+
test -f "$file" || { echo "File not found: $file" >&2; exit 1; }
27+
dest=$(basename "$file")
28+
cp "$file" "$dest_dir/$dest"
29+
(cd "$dest_dir" && git add "$dest")
30+
done
31+
32+
cd "$dest_dir"
33+
if git diff --quiet .
34+
then
35+
echo "== No changes =="
36+
else
37+
echo "== Committing changes =="
38+
git commit -m "$message"
39+
# Retry against concurrent publishers (the build and status workflows both
40+
# push here), rebasing onto whatever landed in between.
41+
n=0
42+
until git push
43+
do
44+
n=$((n + 1))
45+
test "$n" -lt 5 || { echo "push failed after $n attempts" >&2; exit 1; }
46+
git pull --rebase
47+
done
48+
fi

.github/setup-build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/main/ci-setup-github-actions.sh
3+
sh ci-setup-github-actions.sh
4+
5+
# Install native libraries needed to smelt components.
6+
pkgs="libxcb-shape0" # org.janelia:H5J_Loader_Plugin
7+
pkgs="$pkgs libgtk2.0-0" # net.imagej:imagej-opencv
8+
pkgs="$pkgs libblosc1" # org.janelia.saalfeldlab:n5-blosc
9+
sudo apt-get update
10+
sudo apt-get -y install $pkgs

.github/setup-release.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/main/ci-setup-github-actions.sh
3+
sh ci-setup-github-actions.sh

.github/setup.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/status.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
# CI orchestrator for the status dashboard: fetch the most recently published
3+
# smelt.json, regenerate the status/badges/team reports from it, and publish
4+
# them to status.scijava.org. The report generation itself lives in
5+
# bin/report.sh so it can be run outside CI too.
6+
set -e
7+
8+
# Pull the most recently published smelt results so that `pombast status` can
9+
# classify each available version bump by its bytecode-floor blast radius
10+
# (flat / local / cascading / excluded). Read straight from the gh-pages branch
11+
# rather than https://status.scijava.org/, so we pick up a freshly committed
12+
# smelt.json immediately instead of waiting on the asynchronous Pages deploy.
13+
#
14+
# Best-effort: if smelt.json is not published yet (or the fetch fails),
15+
# bin/report.sh still generates the reports -- just without the classification.
16+
smelt_url=https://raw.githubusercontent.com/scijava/status.scijava.org/gh-pages/smelt.json
17+
mkdir -p target/pombast
18+
curl -fsSL -o target/pombast/smelt.json "$smelt_url" ||
19+
echo "== smelt.json unavailable; running status without classification =="
20+
21+
bin/report.sh
22+
23+
.github/publish.sh "Update status reports" \
24+
target/pombast/index.html \
25+
target/pombast/badges.json \
26+
target/pombast/team.html \
27+
target/pombast/team.json

.github/workflows/build.yml

Lines changed: 53 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,23 @@ on:
88
branches:
99
- master
1010
schedule:
11-
- cron: "4 5 * * 0" # every Sunday at 0405, to keep cache alive
11+
# Run weekly on Sunday to keep the Maven cache alive.
12+
- cron: '4 5 * * 0'
13+
14+
# Queue runs of the same ref; cancel superseded PR builds (they never publish).
15+
concurrency:
16+
group: build-${{ github.ref }}
17+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1218

1319
jobs:
1420
build:
1521
runs-on: ubuntu-latest
22+
permissions:
23+
actions: write # needed to delete and re-save the pombast cache
1624

1725
steps:
1826
- uses: actions/checkout@v4
27+
1928
- name: Set up Java
2029
uses: actions/setup-java@v4
2130
with:
@@ -24,19 +33,20 @@ jobs:
2433
distribution: 'zulu'
2534
cache: 'maven'
2635

27-
- name: Set up CI environment
28-
run: .github/setup.sh
36+
- uses: astral-sh/setup-uv@v6
2937

30-
- name: Restore the melting-pot cache
31-
id: restore-cache
32-
uses: actions/cache/restore@v3
38+
- uses: webfactory/ssh-agent@v0.9.0
39+
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
3340
with:
34-
path: ~/.cache/scijava/melting-pot
35-
key: ${{ runner.os }}-cache
41+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
42+
43+
- name: Set up build environment
44+
run: .github/setup-build.sh
45+
shell: bash
3646

37-
- name: Execute the build
38-
id: execute-build
47+
- name: Maven CI build
3948
run: .github/build.sh
49+
shell: bash
4050
env:
4151
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
4252
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
@@ -46,22 +56,40 @@ jobs:
4656
CENTRAL_PASS: ${{ secrets.CENTRAL_PASS }}
4757
SIGNING_ASC: ${{ secrets.SIGNING_ASC }}
4858

49-
- name: Delete the melting-pot cache
50-
if: env.cacheChanged == 'true'
51-
id: delete-cache
52-
run: |
53-
gh api --method DELETE -H "Accept: application/vnd.github+json" /repos/scijava/pom-scijava/actions/caches?key=${{ runner.os }}-cache || true
59+
- name: Restore pombast cache
60+
uses: actions/cache/restore@v4
61+
with:
62+
# pombast: success/timestamp caches; cjdk: downloaded JDKs + Maven;
63+
# jgo: per-artifact bytecode-scan results. (~/.m2 is cached above by
64+
# setup-java's cache: 'maven'.)
65+
path: |
66+
~/.cache/pombast
67+
~/.cache/cjdk
68+
~/.cache/jgo
69+
key: ${{ runner.os }}-pombast-build
70+
71+
- name: Run pombast checks (melt + smelt)
72+
run: bin/check.sh
73+
shell: bash
74+
75+
- name: Delete old pombast cache
76+
if: always()
77+
run: .github/delete-cache.sh "${{ runner.os }}-pombast-build"
78+
shell: bash
5479
env:
55-
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5681

57-
- name: Save the melting-pot cache
58-
if: env.cacheChanged == 'true'
59-
id: save-cache
60-
uses: actions/cache/save@v3
82+
- name: Save pombast cache
83+
if: always()
84+
uses: actions/cache/save@v4
6185
with:
62-
path: ~/.cache/scijava/melting-pot
63-
key: ${{ runner.os }}-cache
86+
path: |
87+
~/.cache/pombast
88+
~/.cache/cjdk
89+
~/.cache/jgo
90+
key: ${{ runner.os }}-pombast-build
6491

65-
- name: Return the exit code
66-
id: exit-build
67-
run: .github/exit.sh
92+
- name: Publish smelt results
93+
if: always() && github.ref == 'refs/heads/master' && github.event_name == 'push'
94+
run: .github/publish.sh "Update smelt results" target/pombast/smelt.json
95+
shell: bash

.github/workflows/release.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ jobs:
1919
distribution: 'zulu'
2020
cache: 'maven'
2121

22-
- name: Set up CI environment
23-
run: .github/setup.sh
22+
- name: Set up release environment
23+
run: .github/setup-release.sh
24+
shell: bash
2425

25-
- name: Execute the build
26-
id: execute-build
26+
- name: Execute the release
2727
run: .github/build.sh
28+
shell: bash
2829
env:
2930
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
3031
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

0 commit comments

Comments
 (0)