88
99env :
1010 JAVA_VERSION : 17
11+ JAVA_DISTRO : temurin
1112
1213jobs :
1314 lint :
@@ -30,37 +31,22 @@ jobs:
3031 - name : Set up JDK ${{ env.JAVA_VERSION }}
3132 uses : actions/setup-java@v2
3233 with :
33- distribution : adopt
3434 java-version : ${{ env.JAVA_VERSION }}
35+ distribution : ${{ env.JAVA_DISTRO }}
3536
3637 - name : Grant execute permission for gradlew
3738 run : chmod +x gradlew
3839
3940 - name : Lint with Gradle
40- run : ./gradlew checkstyleMain checkstyleTest spotbugsMain spotbugsTest pmdMain pmdTest --stacktrace --no-daemon # javadoc
41-
42- # - name: Annotate Checkstyle Issues
43- # uses: jwgmeligmeyling/checkstyle-github-action@master
44- # with:
45- # path: '**/build/reports/checkstyle/*.xml'
46- #
47- # - name: Annotate SpotBugs Issues
48- # uses: jwgmeligmeyling/spotbugs-github-action@master
49- # with:
50- # path: '**/build/reports/spotbugs/*.xml'
51- #
52- # - name: Annotate PMD Issues
53- # uses: jwgmeligmeyling/pmd-github-action@master
54- # with:
55- # path: '**/build/reports/pmd/*.xml'
41+ run : ./gradlew checkstyleMain checkstyleTest spotbugsMain spotbugsTest pmdMain pmdTest --stacktrace --no-daemon
5642
5743 test :
5844 runs-on : ubuntu-latest
5945
6046 strategy :
6147 matrix :
62- java-version : [ 11, 16 ]
63- jvm-impl : [ 'hotspot', 'openj9' ]
48+ java-version : [ 17 ]
49+ java-distro : [ temurin, zulu, liberica, microsoft ]
6450
6551 steps :
6652 - uses : actions/checkout@v2
@@ -72,21 +58,21 @@ jobs:
7258 path : |
7359 ~/.gradle/caches
7460 ~/.gradle/wrapper
75- key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
61+ key : ${{ runner.os }}-gradle-${{ matrix.java-distro }}-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
7662 restore-keys : |
77- ${{ runner.os }}-gradle-
63+ ${{ runner.os }}-gradle-${{ matrix.java-distro }}-${{ matrix.java-version }}-
7864
7965 - name : Set up JDK ${{ matrix.java-version }}
8066 uses : actions/setup-java@v2
8167 with :
82- distribution : adopt-${{ matrix.jvm-impl }}
8368 java-version : ${{ matrix.java-version }}
69+ distribution : ${{ matrix.java-distro }}
8470
8571 - name : Grant execute permission for gradlew
8672 run : chmod +x gradlew
8773
8874 - name : Run tests with Gradle
89- run : ./gradlew test --no-daemon
75+ run : ./gradlew test --stacktrace -- no-daemon
9076
9177 build :
9278 needs : [ lint, test ]
@@ -113,14 +99,14 @@ jobs:
11399 - name : Set up JDK ${{ env.JAVA_VERSION }}
114100 uses : actions/setup-java@v2
115101 with :
116- distribution : adopt
117102 java-version : ${{ env.JAVA_VERSION }}
103+ distribution : ${{ env.JAVA_DISTRO }}
118104
119105 - name : Grant execute permission for gradlew
120106 run : chmod +x gradlew
121107
122108 - name : Build with Gradle
123- run : ./gradlew :${{ matrix.service }}:bootJar --no-daemon
109+ run : ./gradlew :${{ matrix.service }}:shadowJar :${{ matrix.service }}:assemble --stacktrace --no-daemon
124110
125111 - uses : actions/upload-artifact@v2
126112 with :
@@ -131,37 +117,29 @@ jobs:
131117 needs : build
132118 runs-on : ubuntu-latest
133119
120+ permissions :
121+ packages : write
122+
134123 strategy :
135124 matrix :
136125 service : [ 'server', 'java-daemon', 'admin-panel' ]
137- jvm-impl : [ hotspot, openj9 ]
138- include :
139- - jvm-impl : hotspot
140- platforms : linux/amd64,linux/arm/v7,linux/arm64/v8
141- - jvm-impl : openj9
142- platforms : linux/amd64 # ,linux/arm64/v8
143-
144- env :
145- IMAGE_NAME : crypticcp/${{ matrix.service }}
146126
147127 steps :
148128 - uses : actions/checkout@v2
149129 with :
150130 submodules : recursive
151131
152132 - name : Docker meta
153- id : docker_meta
154- uses : marcelcoding/ghaction-docker-meta@v1
155- with :
156- tag-edge : true
157- images : |
158- ${{ env.IMAGE_NAME }}
159- ghcr.io/${{ github.repository_owner }}/${{ matrix.service }}
160- tag-semver : |
161- {{version}}
162- {{major}}.{{minor}}
163- flavor : ${{ matrix.jvm-impl }}
164- main-flavor : ${{ matrix.jvm-impl == 'hotspot' }}
133+ id : meta
134+ uses : docker/metadata-action@v3
135+ with :
136+ images : ghcr.io/${{ github.repository_owner }}/${{ matrix.service }}
137+ tags : |
138+ type=edge
139+ type=ref,event=pr
140+ type=semver,pattern={{version}}
141+ type=semver,pattern={{major}}.{{minor}}
142+ type=semver,pattern={{major}}
165143
166144 - uses : docker/setup-qemu-action@v1
167145 - uses : docker/setup-buildx-action@v1
@@ -170,53 +148,39 @@ jobs:
170148 uses : actions/cache@v2
171149 with :
172150 path : /tmp/.buildx-cache
173- key : ${{ runner.os }}-buildx-${{ matrix.service }}-${{ matrix.jvm-impl }}-${{ github.sha }}
151+ key : ${{ runner.os }}-buildx-${{ matrix.service }}-${{ github.sha }}
174152 restore-keys : |
175- ${{ runner.os }}-buildx-${{ matrix.service }}-${{ matrix.jvm-impl }}-
176-
177- - name : Login to Docker Hub
178- if : ${{ github.event_name != 'pull_request' }}
179- uses : docker/login-action@v1
180- with :
181- username : ${{ secrets.DOCKERHUB_USERNAME }}
182- password : ${{ secrets.DOCKERHUB_PASSWORD }}
153+ ${{ runner.os }}-buildx-${{ matrix.service }}-
183154
184155 - name : Login to GitHub Container Registry
185- if : ${{ github.event_name != 'pull_request' }}
186156 uses : docker/login-action@v1
157+ if : github.event_name != 'pull_request'
187158 with :
188159 registry : ghcr.io
189- username : ${{ github.repository_owner }}
160+ username : ${{ github.actor }}
190161 password : ${{ github.token }}
191162
192163 - uses : actions/download-artifact@v2
193164 with :
194165 name : ${{ matrix.service }}
195- path : dist
196166
197167 - name : Build
198168 uses : docker/build-push-action@v2
199169 with :
200170 context : .
201171 file : ./docker/Dockerfile.github-actions
202- platforms : ${{ matrix.platforms }}
172+ platforms : linux/amd64,linux/arm64/v8 # ${{ matrix.platforms }} linux/arm/v7,
203173 push : ${{ github.event_name != 'pull_request' }}
204- tags : ${{ steps.docker_meta .outputs.tags }}
205- labels : ${{ steps.docker_meta .outputs.labels }}
174+ tags : ${{ steps.meta .outputs.tags }}
175+ labels : ${{ steps.meta .outputs.labels }}
206176 build-args : |
207177 SERVICE_NAME=${{ matrix.service }}
208- JAVA_VERSION =${{ env.JAVA_VERSION }}
209- JVM_IMPL=${{ matrix.jvm-impl }}
178+ JVM_VERSION =${{ env.JAVA_VERSION }}
179+ # JVM_IMPL=${{ matrix.jvm-impl }}
210180 cache-from : type=local,src=/tmp/.buildx-cache
211181 cache-to : type=local,dest=/tmp/.buildx-cache-new
212182
213183 - name : Move cache
214184 run : |
215185 rm -rf /tmp/.buildx-cache
216186 mv /tmp/.buildx-cache-new /tmp/.buildx-cache
217-
218- - name : Check manifest
219- if : ${{ github.event_name != 'pull_request' }}
220- run : |
221- docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:${{ steps.docker_meta.outputs.version }}
222- docker buildx imagetools inspect ghcr.io/${{ github.repository_owner }}/${{ matrix.service }}:${{ steps.docker_meta.outputs.version }}
0 commit comments