This repository has been archived by the owner on Sep 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (99 loc) · 3.11 KB
/
ci.yaml
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
name: CI
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
JAVA_VERSION: 17
JAVA_DISTRO: temurin
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 17 ]
java-distro: [ temurin, zulu, liberica, microsoft ]
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java-version }}
distribution: ${{ matrix.java-distro }}
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run tests with Gradle
run: ./gradlew test --stacktrace --no-daemon
build:
needs: [ test ]
runs-on: ubuntu-latest
permissions:
packages: write
strategy:
matrix:
service: [ cryptic-auth ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Jars
run: ./gradlew :${{ matrix.service }}:assemble --stacktrace --no-daemon
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.service }}
path: ${{ matrix.service }}/build/libs
docker:
needs: [ build ]
runs-on: ubuntu-latest
permissions:
packages: write
strategy:
matrix:
service: [ cryptic-auth ]
flavor: [ jvm ] # native
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Docker Image
run: ./gradlew :${{ matrix.service }}:bootBuildImage --imageName=${{ matrix.service }} -Pflavor=${{ matrix.flavor }} --stacktrace --no-daemon
- name: Docker meta
id: meta
if: github.event_name != 'pull_request'
uses: MarcelCoding/ghaction-docker-meta@v2
with:
images: ghcr.io/${{ github.repository_owner }}/${{ matrix.service }}
tag-semver: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
flavor: ${{ matrix.flavor }}
main-flavor: ${{ matrix.flavor == 'jvm' }}
- uses: docker/login-action@v2
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Push to ghcr.io
if: github.event_name != 'pull_request'
run: |
for image in $(echo "${{ steps.meta.outputs.tags }}" | cat -); do
docker tag ${{ matrix.service }} $image
docker push $image
done