Skip to content

Commit f23a4e2

Browse files
committed
For #604. Teach container to export needed files
1 parent 358b1fb commit f23a4e2

File tree

3 files changed

+81
-72
lines changed

3 files changed

+81
-72
lines changed

.github/workflows/ci-direct-maven.yml

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -49,75 +49,3 @@ jobs:
4949

5050
- name: Execute run script
5151
run: ./run-with-maven.sh
52-
53-
# Javadoc HTML and jars
54-
55-
- name: Save Javadoc HTML for main
56-
uses: actions/upload-artifact@v4
57-
with:
58-
name: javadoc-html-main
59-
if-no-files-found: error
60-
path: target/apidocs/
61-
62-
- name: Save Javadoc HTML Jar for main
63-
uses: actions/upload-artifact@v4
64-
with:
65-
name: javadoc-unittests-main
66-
if-no-files-found: error
67-
path: target/modern-java-practices-0-SNAPSHOT-javadoc.jar
68-
69-
- name: Save Javadoc HTML for unit tests
70-
uses: actions/upload-artifact@v4
71-
with:
72-
name: javadoc-html-unittests
73-
if-no-files-found: error
74-
path: target/testapidocs/
75-
76-
- name: Save Javadoc HTML Jar for unit tests
77-
uses: actions/upload-artifact@v4
78-
with:
79-
name: javadoc-jar-unittests
80-
if-no-files-found: error
81-
path: target/modern-java-practices-0-SNAPSHOT-test-javadoc.jar
82-
83-
# Coverage badge and report artifact
84-
85-
- name: Generate coverage badge
86-
# if: ${{ github.ref == 'refs/head/master' }}
87-
uses: cicirello/jacoco-badge-generator@v2
88-
with:
89-
badges-directory: images
90-
generate-branches-badge: false
91-
generate-summary: false
92-
93-
- name: Save coverage report
94-
uses: actions/upload-artifact@v4
95-
with:
96-
name: coverage-report
97-
if-no-files-found: error
98-
path: target/site/jacoco/
99-
100-
# Can this colide with the Gradle build when both finish about the same
101-
# time?
102-
- name: Add coverage to repo
103-
# if: ${{ github.ref == 'refs/head/master' }}
104-
run: |
105-
cd images
106-
if [[ ! -z "$(git status --porcelain *.svg)" ]]; then
107-
git config --global user.name 'github-actions'
108-
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
109-
git add *.svg
110-
git commit -m 'Autogenerated coverage badge'
111-
git push || echo "$0: Another build won for coverage badge" >&2
112-
fi
113-
- name: Add coverage to repo
114-
# if: ${{ github.ref == 'refs/head/master' }}
115-
run: |
116-
cd images
117-
if [[ ! -z "$(git status --porcelain *.svg)" ]]; then
118-
git config --global user.name 'github-actions'
119-
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
120-
git add *.svg
121-
git commit -m 'Autogenerated coverage badge'
122-
git push || echo "$0: Another build won for coverage badge" >&2
123-
fi

.github/workflows/ci-earthly-maven.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,77 @@ jobs:
6363

6464
- name: Execute run script
6565
run: earthly --secret OWASP_NVD_API_KEY +run-with-maven
66+
67+
# Javadoc HTML and jars
68+
# See Earthfile that copies these from container to local
69+
70+
- name: Save Javadoc HTML for main
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: javadoc-html-main
74+
if-no-files-found: error
75+
path: target/apidocs/
76+
77+
- name: Save Javadoc HTML Jar for main
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: javadoc-unittests-main
81+
if-no-files-found: error
82+
path: target/modern-java-practices-0-SNAPSHOT-javadoc.jar
83+
84+
- name: Save Javadoc HTML for unit tests
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: javadoc-html-unittests
88+
if-no-files-found: error
89+
path: target/testapidocs/
90+
91+
- name: Save Javadoc HTML Jar for unit tests
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: javadoc-jar-unittests
95+
if-no-files-found: error
96+
path: target/modern-java-practices-0-SNAPSHOT-test-javadoc.jar
97+
98+
# Coverage badge and report artifact
99+
# See Earthfile that copies these from container to local
100+
101+
- name: Generate coverage badge
102+
# if: ${{ github.ref == 'refs/head/master' }}
103+
uses: cicirello/jacoco-badge-generator@v2
104+
with:
105+
badges-directory: images
106+
generate-branches-badge: false
107+
generate-summary: false
108+
109+
- name: Save coverage report
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: coverage-report
113+
if-no-files-found: error
114+
path: target/site/jacoco/
115+
116+
# Can this colide with the Gradle build when both finish about the same
117+
# time?
118+
- name: Add coverage to repo
119+
# if: ${{ github.ref == 'refs/head/master' }}
120+
run: |
121+
cd images
122+
if [[ ! -z "$(git status --porcelain *.svg)" ]]; then
123+
git config --global user.name 'github-actions'
124+
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
125+
git add *.svg
126+
git commit -m 'Autogenerated coverage badge'
127+
git push || echo "$0: Another build won for coverage badge" >&2
128+
fi
129+
- name: Add coverage to repo
130+
# if: ${{ github.ref == 'refs/head/master' }}
131+
run: |
132+
cd images
133+
if [[ ! -z "$(git status --porcelain *.svg)" ]]; then
134+
git config --global user.name 'github-actions'
135+
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
136+
git add *.svg
137+
git commit -m 'Autogenerated coverage badge'
138+
git push || echo "$0: Another build won for coverage badge" >&2
139+
fi

Earthfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ build-with-maven:
2424
COPY config config
2525
COPY src src
2626
RUN --secret OWASP_NVD_API_KEY ./mvnw --no-transfer-progress clean verify
27+
# For CI so that GitHub can copy artifacts
28+
# Javadocs and jars
29+
SAVE ARTIFACT --keep-ts target/apidocs/ AS LOCAL target/apidocs/
30+
SAVE ARTIFACT --keep-ts target/modern-java-practices-0-SNAPSHOT-javadoc.jar AS LOCAL target/modern-java-practices-0-SNAPSHOT-javadoc.jar
31+
SAVE ARTIFACT --keep-ts target/testapidocs/ AS LOCAL target/testapidocs/
32+
SAVE ARTIFACT --keep-ts target/modern-java-practices-0-SNAPSHOT-test-javadoc.jar AS LOCAL target/modern-java-practices-0-SNAPSHOT-test-javadoc.jar
33+
# Test coverage and badge
2734
SAVE ARTIFACT --keep-ts target/site/jacoco/jacoco.csv AS LOCAL target/site/jacoco/jacoco.csv
2835

2936
run-with-maven:

0 commit comments

Comments
 (0)