Skip to content

Commit 73bd6e8

Browse files
c-dilkstongtongcao
authored andcommitted
build!: cleanup dependency tree, shaded JAR, and deploy properly (#632)
* fix: exclude maven metadata and jacoco from shaded JAR Excluding maven metadata fixes the following warning from `deployDistribution.sh`: ``` [WARNING] Artifact org.jlab.coat:coat-libs JAR (about to be installed/deployed) contains Maven Plugin metadata for conflicting coordinates: org.jacoco:jacoco-maven-plugin. Your JAR contains rogue Maven Plugin metadata. Possible causes may be: shaded into this JAR some Maven Plugin or some rogue resource. ``` Excluding `jacoco` since only used here for coverage testing * fix: now we can use `mvn deploy` * build: work in progress... * doc: deployment notes * fix: mermaid * fix: mermaid * fix: mermaid * fix: mermaid * fix: mermaid * fix: mermaid * fix: more progress and an unhelpful git commit message * fix: flow control * doc: tersify * build: cleanup * fix: clear `ejml` warnings * build: untangling dependencies * build: openjfx * fix: more untangling * fix: classifiers * fix: only include `junit` where actually needed * fix: even more untangling * fix: resolved almost all the transitive dependencies * fix: the knot is untangled!!! * doc: mermaid * doc: mermaid * doc: mermaid * fix: remove test-scoped dependency `org.jlab.jnp:jnp-hipo4` from reconstruction tests This was strange. If I scope `jnp-hipo4` to `test` in the POM file, as suggested by `mvn dependency:analyze`, I would get build errors in very specific methods, for example, `ECCommon.readStripsHipo`: - my IDE (Eclipse JDT LSP) correctly sees `DataEvent` as `org.jlab.io.base.DataEvent` - the Maven build (`maven-compiler-plugin`) would get confused and think that `DataEvent` comes from somewhere in `jnp-hipo4`, even though this package was not being imported With the help of @raffaelladevita we found that `jnp-hipo4` dependency could actually be removed from all of the tests, so we can avoid the issue altogether. * fix: need `CLAS12DIR` in the test * ci: tell dependabot to not update `ejml-simple` * refactor: clarify which deps are for conflict resolution * ci: dependency analysis * fix(ci): dependence * fix: no progress printout * fix: stop screaming about unused shade deps * ci: release with version number in name; open issue if fail * fix: syntax and issue template * test: dump classpath for tests * perf(ci): move unit tests to their own job * ci: update needs for `final` * fix: exclude `coat-libs` from javadoc aggregation * fix: DRY violation of plugin version * fix: `coat-lib` -> `coat-libs` * fix: exclude `coat-libs` from `javadoc` in parent POM * fix: use `skip` configuration to self-exclude `coat-libs` * fix: `execution` * fix: explicit control in CI config * fix: install all modules' JARs * fix: env * feat: warn if a `target` directory persists after `mvn clean` * fix: improve installation * fix: claspathology * fix: source after clara * doc: choose version 1 * test: disable fail-fast * fix: appease clara and install `common-tools` to `lib/services` * fix: add `cnuphys/snr` and `clas-math` to `coat-libs`, since... ...they were in the original `coat-libs` somehow * doc: general deployment procedure * fix: small stuff * fix(coat-libs): `org.jlab.clas` -> `org.jlab.coat` * fix: actually deploy * fix(ci): `-pl` args * fix: release permission
1 parent 6425d5d commit 73bd6e8

100 files changed

Lines changed: 2027 additions & 1045 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ updates:
1818
- jhep
1919
ignore:
2020
- dependency-name: "org.jlab:groot" # since version numbers are not in order
21+
- dependency-name: "org.ejml:ejml-simple" # keep version the same as `j4ml:j4ml-clas12:jar:0.9-SNAPSHOT`; see pull requests #636 and #632
2122
- package-ecosystem: "github-actions"
2223
directory: "/"
2324
schedule:

.github/issue_release.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: Release build failed for tag ${{ env.TAG_NAME }}
3+
---
4+
Workflow Run: {{ env.REPO_URL }}/actions/runs/{{ env.RUN_ID }}

.github/workflows/ci.yml

Lines changed: 85 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ env:
2626
javadoc_version: 24 # newer than `java_version` for better javadoc
2727
groovy_version: 4.x
2828
CCDB_CONNECTION: 'sqlite:////cvmfs/oasis.opensciencegrid.org/jlab/hallb/clas12/sw/noarch/data/ccdb/ccdb_latest.sqlite'
29+
nthreads: 4
2930

3031
jobs:
3132

@@ -51,35 +52,48 @@ jobs:
5152
cvmfs_repositories: 'oasis.opensciencegrid.org'
5253
- name: cvmfs
5354
run: ls /cvmfs/oasis.opensciencegrid.org/jlab/hallb/clas12/sw/noarch/data/ccdb/ccdb_latest.sqlite
54-
- name: echo CCDB_CONNECTION
55-
run: echo $CCDB_CONNECTION
55+
- name: bump version to tag if tag trigger
56+
if: ${{ github.ref_type == 'tag' }}
57+
run: libexec/version-bump.sh ${{ github.ref_name }}
5658
- name: build
57-
run: ./build-coatjava.sh --spotbugs --unittests --no-progress -T4
59+
run: ./build-coatjava.sh --no-progress -T${{ env.nthreads }}
5860
- name: tar # tarball to preserve permissions
5961
run: tar czvf coatjava.tar.gz coatjava
6062
- uses: actions/upload-artifact@v4
6163
with:
6264
name: build_${{ matrix.runner }}
6365
retention-days: 1
6466
path: coatjava.tar.gz
67+
68+
# tests
69+
#############################################################################
70+
71+
unit_tests:
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v4
75+
- uses: actions/setup-java@v4
76+
with:
77+
java-version: ${{ env.java_version }}
78+
distribution: ${{ env.java_distribution }}
79+
- uses: cvmfs-contrib/github-action-cvmfs@v5
80+
with:
81+
cvmfs_repositories: 'oasis.opensciencegrid.org'
82+
- name: unit tests and spotbugs
83+
run: ./build-coatjava.sh --spotbugs --unittests --no-progress -T${{ env.nthreads }}
6584
- name: collect jacoco report
66-
if: ${{ matrix.runner == 'ubuntu-latest' }}
6785
run: validation/jacoco-aggregate.sh
6886
- name: publish jacoco report
69-
if: ${{ matrix.runner == 'ubuntu-latest' }}
7087
uses: actions/upload-artifact@v4
7188
with:
7289
name: jacoco_report
7390
path: publish/
7491
retention-days: 1
7592

76-
# tests
77-
#############################################################################
78-
7993
test_coatjava:
8094
needs: [ build ]
8195
strategy:
82-
fail-fast: true
96+
fail-fast: false
8397
matrix:
8498
runner:
8599
- ubuntu-latest
@@ -116,8 +130,6 @@ jobs:
116130
cvmfs_repositories: 'oasis.opensciencegrid.org'
117131
- name: untar build
118132
run: tar xzvf coatjava.tar.gz
119-
- name: echo CCDB_CONNECTION
120-
run: echo $CCDB_CONNECTION
121133
- name: run test
122134
run: |
123135
cd validation/advanced-tests
@@ -146,39 +158,32 @@ jobs:
146158
- name: test run-groovy
147159
run: coatjava/bin/run-groovy validation/advanced-tests/test-run-groovy.groovy
148160

149-
release:
161+
dependency_analysis:
150162
needs: [ build ]
151163
runs-on: ubuntu-latest
152164
steps:
153165
- uses: actions/checkout@v4
166+
- name: Set up JDK
167+
uses: actions/setup-java@v4
168+
with:
169+
java-version: ${{ env.java_version }}
170+
distribution: ${{ env.java_distribution }}
154171
- uses: actions/download-artifact@v4
155172
with:
156173
name: build_ubuntu-latest
157-
- name: Release
158-
uses: softprops/action-gh-release@v2
159-
if: startsWith(github.ref, 'refs/tags/')
160-
with:
161-
files: coatjava.tar.gz
162-
env:
163-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
164-
165-
final:
166-
needs:
167-
- build
168-
- test_coatjava
169-
- test_run-groovy
170-
- release
171-
runs-on: ubuntu-latest
172-
steps:
173-
- name: pass
174-
run: exit 0
174+
- name: untar build
175+
run: tar xzvf coatjava.tar.gz
176+
- name: print dependency tree
177+
run: mvn dependency:tree -Ddetail=true --no-transfer-progress
178+
- name: dependency analysis # note: skips `coat-libs`, since shaded JAR dependencies are "unused" according to `dependency:analyze`
179+
run: mvn dependency:analyze -DfailOnWarning=true -pl '!org.jlab.coat:coat-libs' --no-transfer-progress
175180

176181
# documentation
177182
#############################################################################
178183

179184
generate_documentation:
180185
runs-on: ubuntu-latest
181-
needs: [ build ]
186+
needs: [ unit_tests ]
182187
steps:
183188
### mkdocs
184189
- uses: actions/checkout@v4
@@ -198,10 +203,10 @@ jobs:
198203
with:
199204
java-version: ${{ env.javadoc_version }}
200205
distribution: ${{ env.java_distribution }}
201-
- name: build coatjava
206+
- name: build coatjava javadocs # javadoc:aggregate output dir cannot be controlled, so assume the latest "standard" path and `mv` it
202207
run: |
203-
./build-coatjava.sh --no-progress --docs
204-
mv coatjava/share/doc/coatjava/html pages/javadoc
208+
mvn javadoc:aggregate -pl '!org.jlab.coat:coat-libs' --no-transfer-progress
209+
mv target/reports/apidocs pages/javadoc
205210
### upload artifacts
206211
- uses: actions/upload-pages-artifact@v3
207212
with:
@@ -222,3 +227,49 @@ jobs:
222227
- name: deployment
223228
id: deployment
224229
uses: actions/deploy-pages@v4
230+
231+
# finalize
232+
#############################################################################
233+
234+
release_build:
235+
if: ${{ github.ref_type == 'tag' }}
236+
needs: [ build ]
237+
runs-on: ubuntu-latest
238+
permissions:
239+
contents: write
240+
issues: write
241+
env:
242+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
243+
REPO_URL: ${{ github.event.repository.html_url }}
244+
RUN_ID: ${{ github.run_id }}
245+
TAG_NAME: ${{ github.ref_name }}
246+
steps:
247+
- uses: actions/checkout@v4
248+
- uses: actions/download-artifact@v4
249+
with:
250+
name: build_ubuntu-latest
251+
- name: rename artifact
252+
run: |
253+
tar xzf coatjava.tar.gz
254+
mv coatjava{,-${{ env.TAG_NAME }}}
255+
tar czf coatjava-${{ env.TAG_NAME }}{.tar.gz,}
256+
- name: release
257+
uses: softprops/action-gh-release@v2
258+
with:
259+
files: coatjava-${{ env.TAG_NAME }}.tar.gz
260+
- name: open issue if failed
261+
if: ${{ cancelled() || failure() }}
262+
uses: JasonEtco/create-an-issue@v2
263+
with:
264+
filename: .github/issue_release.md
265+
266+
final:
267+
needs:
268+
- test_coatjava
269+
- dependency_analysis
270+
- test_run-groovy
271+
- generate_documentation
272+
runs-on: ubuntu-latest
273+
steps:
274+
- name: pass
275+
run: exit 0

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# installed:
22
/coatjava
3-
/myLocalMvnRepo
43
target
54
/publish
65
/docs/javadoc/*
76
/clara-home
87
tmp
98

9+
# deployment
10+
/myLocalMvnRepo
11+
/coatjava-*.tar.gz
12+
dependency-reduced-pom.xml
13+
1014
*.class
1115
*lundfiles*.dat
1216
.DS_Store

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
- [**Documentation Homepage**](https://jeffersonlab.github.io/coatjava)
77
- [API Documentation (Javadoc)](https://jeffersonlab.github.io/coatjava/javadoc)
8+
- [Developer notes](/docs/dev_notes.md)
89

910
----
1011

bin/bg-merger

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export MALLOC_ARENA_MAX=1
77
split_cli $@
88

99
java -Xmx1536m -Xms1024m -XX:+UseSerialGC ${jvm_options[@]} \
10-
-cp "$CLAS12DIR/lib/clas/*:$CLAS12DIR/lib/services/*:$CLAS12DIR/lib/utils/*" \
10+
-cp ${COATJAVA_CLASSPATH:-''} \
1111
org.jlab.analysis.eventmerger.EventMerger \
1212
${class_options[@]}
1313

bin/bos2hipo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
. `dirname $0`/../libexec/env.sh
44

55
java -Xms1024m -XX:+UseSerialGC \
6-
-cp "$CLAS12DIR/lib/clas/*:$CLAS12DIR/lib/plugins/*" \
6+
-cp ${COATJAVA_CLASSPATH:-''} \
77
org.jlab.io.utils.Bos2HipoEventBank \
88
$*

bin/cvt-compare

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
export MALLOC_ARENA_MAX=1
66

77
java -Xmx1536m -Xms1024m -XX:+UseSerialGC \
8-
-cp "$CLAS12DIR/lib/clas/*:$CLAS12DIR/lib/services/*:$CLAS12DIR/lib/utils/*" \
8+
-cp ${COATJAVA_CLASSPATH:-''} \
99
org.jlab.rec.cvt.Geometry \
1010
$*

bin/daqEventViewer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
. `dirname $0`/../libexec/env.sh
44

55
java -Xms1024m \
6-
-cp "$CLAS12DIR/lib/clas/*:$CLAS12DIR/lib/services/*:$CLAS12DIR/lib/utils/*" \
6+
-cp ${COATJAVA_CLASSPATH:-''} \
77
org.jlab.detector.examples.RawEventViewer \
88
$*

bin/dclayereffs-ana

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
. `dirname $0`/../libexec/env.sh
44

55
java -Dsun.java2d.pmoffscreen=false -Xmx2048m -Xms1024m \
6-
-cp "$CLAS12DIR/lib/clas/*:$CLAS12DIR/lib/utils/*:$CLAS12DIR/lib/services/*" \
6+
-cp ${COATJAVA_CLASSPATH:-''} \
77
org.jlab.service.dc.LayerEfficiencyAnalyzer \
88
$*

0 commit comments

Comments
 (0)