-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (124 loc) · 4.12 KB
/
ubuntu-maven.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Ubuntu Maven build
concurrency: # More info: https://stackoverflow.com/a/68422069/253468
group: ${{ github.workflow }}-${{ ( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/release' ) && format('ci-master-{0}', github.sha) || format('ci-master-{0}', github.ref) }}
cancel-in-progress: true
env:
MAVEN_OPTS: -Djava.awt.headless=true
MAVEN_VERSION: '3.9.9'
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
schedule:
- cron: "16 23 * * 0"
jobs:
build:
name: Build w/ Java 17
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
- name: 'Set up Maven'
uses: stCarolas/setup-maven@v5
with:
maven-version: ${{ env.MAVEN_VERSION }}
- name: Priming build with Maven
run: mvn -B -V -fae -DskipTests -DskipITs -DskipQA=true install
- name: Test with Maven
run: |
mvn -B -fae -e test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build javadoc
run: mvn javadoc:javadoc
# Upload event file so test results can be processed for the PR
# https://github.com/EnricoMi/publish-unit-test-result-action#support-fork-repositories-and-dependabot-branches
event_file:
name: "Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}
site:
name: 'Publish gh-pages'
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') }}
needs: build
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
- name: 'Set up Maven'
uses: stCarolas/setup-maven@v5
with:
maven-version: ${{ env.MAVEN_VERSION }}
- name: 'Build Maven site'
env:
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
run: mvn site
- name: 'Deploy gh-pages'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: target/site
publish:
name: Deploy artifacts
runs-on: ubuntu-latest
needs: build
permissions:
packages: write
contents: read
if: ${{ github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
- name: 'Set up Maven'
uses: stCarolas/setup-maven@v5
with:
maven-version: ${{ env.MAVEN_VERSION }}
- name: Build and Push
# no need to run any QC or tests
# note deploy will deploy both Maven artifact and Docker image
env:
B3P_DEPLOY_ACTOR: ${{ secrets.B3P_DEPLOY_ACTOR }}
B3P_DEPLOY_TOKEN: ${{ secrets.B3P_DEPLOY_TOKEN }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B -V -fae -DskipTests -DskipITs -DskipQA=true -Ddocker.publish=true clean deploy --settings .github/maven-settings.xml
cleanup:
name: 'Maven cache cleanup'
if: ${{ always() }}
needs: [ build, publish ]
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: setup-java-Linux-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
setup-java-Linux-maven-
- name: Cleanup snapshot cache
run: |
find ~/.m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}