-
Notifications
You must be signed in to change notification settings - Fork 130
182 lines (179 loc) · 5.71 KB
/
build.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# This workflow will build a Java project with Maven
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
name: Build
on:
push:
branches:
- "**"
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
max-parallel: 1
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
java: ['11']
experimental: [false]
# JDK 17 build testing. Allowed to fail as marked experimental
include:
- java: 17
os: ubuntu-latest
experimental: true
steps:
- name: Git support longpaths
run: git config --global core.longpaths true
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Build with Maven
run: mvn -B -U clean install
postgres-itest:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
java: ['11']
services:
postgres:
image: postgres:12
env:
POSTGRES_USER: fcrepo-user
POSTGRES_PASSWORD: fcrepo-pw
POSTGRES_DB: fcrepo
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Git support longpaths
run: git config --global core.longpaths true
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Build with Maven
run: mvn -B -U -Dfcrepo.db.url="jdbc:postgresql://localhost:5432/fcrepo" -Dfcrepo.db.user="fcrepo-user" -Dfcrepo.db.password="fcrepo-pw" clean install -P db-test
mariadb-itest:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
java: ['11']
services:
postgres:
image: mariadb:10.5
env:
MYSQL_ROOT_PASSWORD: root-pw
MYSQL_DATABASE: fcrepo
MYSQL_USER: fcrepo-user
MYSQL_PASSWORD: fcrepo-pw
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
ports:
- 3306:3306
steps:
- name: Git support longpaths
run: git config --global core.longpaths true
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Build with Maven
run: mvn -B -U -Dfcrepo.db.url="jdbc:mariadb://localhost:3306/fcrepo" -Dfcrepo.db.user="fcrepo-user" -Dfcrepo.db.password="fcrepo-pw" clean install -P db-test
mysql-itest:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
java: ['11']
services:
postgres:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: root-pw
MYSQL_DATABASE: fcrepo
MYSQL_USER: fcrepo-user
MYSQL_PASSWORD: fcrepo-pw
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
ports:
- 3306:3306
steps:
- name: Git support longpaths
run: git config --global core.longpaths true
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Build with Maven
run: mvn -B -U -Dfcrepo.db.url="jdbc:mysql://localhost:3306/fcrepo" -Dfcrepo.db.user="fcrepo-user" -Dfcrepo.db.password="fcrepo-pw" clean install -P db-test
deploy:
if: github.ref == 'refs/heads/main'
needs: [build, postgres-itest, mariadb-itest, mysql-itest]
runs-on: ubuntu-latest
steps:
- name: Git support longpaths
run: git config --global core.longpaths true
- name: Checkout fcrepo
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
server-id: sonatype-nexus-snapshots
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
# https://github.com/actions/setup-java/issues/43
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Publish package
run: mvn -U -B -DskipTests=true deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Checkout fcrepo-docker
uses: actions/checkout@v4
with:
repository: fcrepo-exts/fcrepo-docker
path: fcrepo-docker
- name: Deploy Docker image
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
FCREPO_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout)
cd fcrepo-docker
echo "build and push image to dockerhub"
./build-and-push-to-dockerhub.sh ../fcrepo-webapp/target/fcrepo-webapp-${FCREPO_VERSION}.war ${FCREPO_VERSION}