-
Notifications
You must be signed in to change notification settings - Fork 80
213 lines (185 loc) · 7.08 KB
/
build-ci.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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
name: Build CI
on:
push:
branches: [ 'main', 'build/**', 'release/v*' ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
server:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup JDK 11
id: setup-java-11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Setup JDK 17
id: setup-java-17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV
- name: Setup gradle properties
run: |
.github/scripts/gradle-properties.sh >> gradle.properties
cat gradle.properties
- name: Get Semver
id: semver
if: ${{ startsWith(github.ref, 'refs/heads/release/v') }}
run: |
semver=$(echo ${{ github.ref }} | tail -c +21)
echo "semver=$semver" >> $GITHUB_OUTPUT
- name: Docker meta server
id: docker_meta_server
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/server-netty
flavor: |
latest=false
tags: |
type=edge,branch=main
type=raw,priority=950,enable=${{ startsWith(github.ref, 'refs/heads/release/v') }},value=${{ steps.semver.outputs.semver }}
type=raw,enable=${{ startsWith(github.ref, 'refs/heads/release/v0.19.') }},value=latest
type=ref,event=branch
- name: Docker meta server slim
id: docker_meta_server_slim
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/server-slim-netty
flavor: |
latest=false
tags: |
type=edge,branch=main
type=raw,priority=950,enable=${{ startsWith(github.ref, 'refs/heads/release/v') }},value=${{ steps.semver.outputs.semver }}
type=raw,enable=${{ startsWith(github.ref, 'refs/heads/release/v0.19.') }},value=latest
type=ref,event=branch
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
install: true
driver: docker
- name: Login to ghcr.io
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create Dockerfile and context
uses: burrunan/gradle-cache-action@v1
with:
job-id: build-server
arguments: --scan outputVersion docker-server-slim:prepareDocker docker-server:prepareDockerAll
gradle-version: wrapper
- name: Get Deephaven Version
id: deephaven_version
run: |
echo "deephaven_version=$(cat build/version)" >> $GITHUB_OUTPUT
# TODO: switch to new GitHub cache backend when available
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#github-cache
# https://github.com/docker/buildx/pull/535
- name: Docker build server
uses: docker/build-push-action@v5
with:
build-args: |
BASE=deephaven/server-base:local-build
SERVER=server-netty
DEEPHAVEN_VERSION=${{ steps.deephaven_version.outputs.deephaven_version }}
tags: ${{ steps.docker_meta_server.outputs.tags }}
builder: ${{ steps.buildx.outputs.name }}
context: ./docker/server/build/context/
push: false
# Note: server-slim does not need BASE/SERVER build-args like the other server images
- name: Docker build server slim
uses: docker/build-push-action@v5
with:
build-args: |
DEEPHAVEN_VERSION=${{ steps.deephaven_version.outputs.deephaven_version }}
tags: ${{ steps.docker_meta_server_slim.outputs.tags }}
builder: ${{ steps.buildx.outputs.name }}
context: ./docker/server-slim/build/context/
push: false
web-plugin-packager:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Semver
id: semver
if: ${{ startsWith(github.ref, 'refs/heads/release/v') }}
run: |
semver=$(echo ${{ github.ref }} | tail -c +21)
echo "semver=$semver" >> $GITHUB_OUTPUT
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/web-plugin-packager
flavor: |
latest=false
tags: |
type=edge,branch=main
type=raw,priority=950,enable=${{ startsWith(github.ref, 'refs/heads/release/v') }},value=${{ steps.semver.outputs.semver }}
type=raw,enable=${{ startsWith(github.ref, 'refs/heads/release/v0.19.') }},value=latest
type=ref,event=branch
- name: Setup JDK 11
id: setup-java-11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV
- name: Setup gradle properties
run: |
.github/scripts/gradle-properties.sh >> gradle.properties
cat gradle.properties
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
install: true
driver: docker
- name: Login to ghcr.io
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create Dockerfile and context
uses: burrunan/gradle-cache-action@v1
with:
job-id: build-web
arguments: --scan outputVersion docker-web-plugin-packager:prepareDocker
gradle-version: wrapper
- name: Get Deephaven Version
id: deephaven_version
run: |
echo "deephaven_version=$(cat build/version)" >> $GITHUB_OUTPUT
- name: Docker build
uses: docker/build-push-action@v5
with:
build-args: |
DEEPHAVEN_VERSION=${{ steps.deephaven_version.outputs.deephaven_version }}
tags: ${{ steps.docker_meta.outputs.tags }}
builder: ${{ steps.buildx.outputs.name }}
context: ./docker/web-plugin-packager/build/context/
push: false
### Notes about `driver: docker`
###
### By default, the driver used is `docker-container`. This does not allow the Dockerfile to
### reference images that were built in earlier steps. Since our server and web Dockerfiles
### reference earlier images (built during the gradle step), we need to change the driver to
### `docker`.
###
### See https://github.com/docker/buildx/blob/master/docs/reference/buildx_create.md#driver