Skip to content

Commit 773e8c3

Browse files
committed
Adding new workflow for Java
1 parent 7908fc2 commit 773e8c3

1 file changed

Lines changed: 290 additions & 0 deletions

File tree

.github/workflows/ci-java.yml

Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
name: CI Java
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '15 9,21 * * *'
6+
workflow_call:
7+
push:
8+
branches:
9+
- trunk
10+
pull_request:
11+
branches:
12+
- trunk
13+
14+
env:
15+
NODE_VERSION: '13.x'
16+
17+
jobs:
18+
check_workflow:
19+
uses: ./.github/workflows/should-workflow-run.yml
20+
with:
21+
bazel-target-prefix: '//java'
22+
23+
build:
24+
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
25+
needs: check_workflow
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout source tree
29+
uses: actions/checkout@v2
30+
- name: Cache Bazel artifacts
31+
uses: actions/cache@v2
32+
with:
33+
path: |
34+
~/.cache/bazel-disk
35+
~/.cache/bazel-repo
36+
key: ${{ runner.os }}-bazel-build-${{ hashFiles('**/BUILD.bazel') }}
37+
restore-keys: |
38+
${{ runner.os }}-bazel-build-
39+
- name: Setup bazelisk
40+
uses: ./.github/actions/setup-bazelisk
41+
- name: Setup Java
42+
uses: actions/setup-java@v1
43+
with:
44+
java-version: '11'
45+
- name: Build grid
46+
uses: ./.github/actions/bazel
47+
with:
48+
command: build grid
49+
50+
small_tests:
51+
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
52+
needs: [ check_workflow, build ]
53+
runs-on: ubuntu-latest
54+
steps:
55+
- name: Checkout source tree
56+
uses: actions/checkout@v2
57+
with:
58+
fetch-depth: 0
59+
- name: Cache Bazel artifacts
60+
uses: actions/cache@v2
61+
with:
62+
path: |
63+
~/.cache/bazel-disk
64+
~/.cache/bazel-repo
65+
key: ${{ runner.os }}-bazel-small-tests-${{ hashFiles('**/BUILD.bazel') }}
66+
restore-keys: |
67+
${{ runner.os }}-bazel-small-tests-
68+
${{ runner.os }}-bazel-build-
69+
- name: Setup bazelisk
70+
uses: ./.github/actions/setup-bazelisk
71+
- name: Setup Java
72+
uses: actions/setup-java@v1
73+
with:
74+
java-version: '11'
75+
- name: Run small tests
76+
uses: ./.github/actions/bazel-test
77+
with:
78+
query: attr(size, small, tests(//java/...)) except attr(tags, lint, tests(//java/...))
79+
- name: Sonar Scanner
80+
uses: ./.github/actions/sonar-cloud
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
84+
85+
lint:
86+
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
87+
needs: [ check_workflow, build ]
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: Checkout source tree
91+
uses: actions/checkout@v2
92+
- name: Cache Bazel artifacts
93+
uses: actions/cache@v2
94+
with:
95+
path: |
96+
~/.cache/bazel-disk
97+
~/.cache/bazel-repo
98+
key: ${{ runner.os }}-bazel-lint-${{ hashFiles('**/BUILD.bazel') }}
99+
restore-keys: |
100+
${{ runner.os }}-bazel-lint-
101+
${{ runner.os }}-bazel-build-
102+
- name: Setup bazelisk
103+
uses: ./.github/actions/setup-bazelisk
104+
- name: Setup Java
105+
uses: actions/setup-java@v1
106+
with:
107+
java-version: '11'
108+
- name: Run linter
109+
uses: ./.github/actions/bazel-test
110+
with:
111+
query: attr(tags, lint, tests(//java/...))
112+
113+
browser_tests:
114+
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
115+
needs: [ check_workflow, small_tests ]
116+
runs-on: ubuntu-latest
117+
strategy:
118+
fail-fast: false
119+
matrix:
120+
browser: [ chrome, firefox ]
121+
version: [ latest ]
122+
include:
123+
- browser: 'firefox'
124+
version: 'latest-devedition'
125+
- browser: 'firefox'
126+
version: 'latest-beta'
127+
steps:
128+
- name: Checkout source tree
129+
uses: actions/checkout@v2
130+
- name: Cache Bazel artifacts
131+
uses: actions/cache@v2
132+
with:
133+
path: |
134+
~/.cache/bazel-disk
135+
~/.cache/bazel-repo
136+
key: ${{ runner.os }}-bazel-${{ matrix.browser }}-tests-${{ hashFiles('**/BUILD.bazel') }}
137+
restore-keys: |
138+
${{ runner.os }}-bazel-${{ matrix.browser }}-tests-
139+
${{ runner.os }}-bazel-build-
140+
- name: Setup bazelisk
141+
uses: ./.github/actions/setup-bazelisk
142+
- name: Setup Java
143+
uses: actions/setup-java@v1
144+
with:
145+
java-version: '11'
146+
- name: Setup Firefox
147+
uses: browser-actions/setup-firefox@latest
148+
if: |
149+
matrix.browser == 'firefox'
150+
with:
151+
firefox-version: ${{ matrix.version }}
152+
- name: Setup GeckoDriver
153+
uses: browser-actions/setup-geckodriver@latest
154+
if: |
155+
matrix.browser == 'firefox'
156+
- name: Setup Chrome and ChromeDriver
157+
uses: ./.github/actions/setup-chrome
158+
if: |
159+
matrix.browser == 'chrome'
160+
- name: Start XVFB
161+
run: Xvfb :99 &
162+
- name: Run browser tests in ${{ matrix.browser }}
163+
uses: ./.github/actions/bazel-test
164+
with:
165+
query: attr(tags, ${{ matrix.browser }}, tests(//java/...)) except attr(tags, 'lint|rc|remote', tests(//java/...))
166+
attempts: 3
167+
env:
168+
DISPLAY: :99
169+
170+
server_tests:
171+
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
172+
needs: [ check_workflow, small_tests ]
173+
runs-on: ubuntu-latest
174+
strategy:
175+
fail-fast: false
176+
matrix:
177+
browser: [ chrome, firefox ]
178+
version: [ latest ]
179+
include:
180+
- browser: 'firefox'
181+
version: 'latest-devedition'
182+
- browser: 'firefox'
183+
version: 'latest-beta'
184+
steps:
185+
- name: Checkout source tree
186+
uses: actions/checkout@v2
187+
- name: Cache Bazel artifacts
188+
uses: actions/cache@v2
189+
with:
190+
path: |
191+
~/.cache/bazel-disk
192+
~/.cache/bazel-repo
193+
key: ${{ runner.os }}-bazel-${{ matrix.browser }}-server-tests-${{ hashFiles('**/BUILD.bazel') }}
194+
restore-keys: |
195+
${{ runner.os }}-bazel-${{ matrix.browser }}-server-tests-
196+
${{ runner.os }}-bazel-${{ matrix.browser }}-tests-
197+
${{ runner.os }}-bazel-build-
198+
- name: Setup bazelisk
199+
uses: ./.github/actions/setup-bazelisk
200+
- name: Setup Java
201+
uses: actions/setup-java@v1
202+
with:
203+
java-version: '11'
204+
- name: Setup Firefox
205+
uses: browser-actions/setup-firefox@latest
206+
if: |
207+
matrix.browser == 'firefox'
208+
with:
209+
firefox-version: ${{ matrix.version }}
210+
- name: Setup GeckoDriver
211+
uses: browser-actions/setup-geckodriver@latest
212+
if: |
213+
matrix.browser == 'firefox'
214+
- name: Setup Chrome and ChromeDriver
215+
uses: ./.github/actions/setup-chrome
216+
if: |
217+
matrix.browser == 'chrome'
218+
- name: Start XVFB
219+
run: Xvfb :99 &
220+
- name: Run server tests
221+
uses: ./.github/actions/bazel-test
222+
with:
223+
query: attr(tags, ${{ matrix.browser }}, tests(//java/...)) intersect attr(tags, 'remote', tests(//java/...))
224+
attempts: 3
225+
env:
226+
DISPLAY: :99
227+
228+
rc_tests:
229+
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
230+
needs: [ check_workflow, small_tests ]
231+
runs-on: ubuntu-latest
232+
steps:
233+
- name: Checkout source tree
234+
uses: actions/checkout@v2
235+
- name: Cache Bazel artifacts
236+
uses: actions/cache@v2
237+
with:
238+
path: |
239+
~/.cache/bazel-disk
240+
~/.cache/bazel-repo
241+
key: ${{ runner.os }}-bazel-firefox-tests-${{ hashFiles('**/BUILD.bazel') }}
242+
restore-keys: |
243+
${{ runner.os }}-bazel-firefox-tests-
244+
${{ runner.os }}-bazel-build-
245+
- name: Setup bazelisk
246+
uses: ./.github/actions/setup-bazelisk
247+
- name: Setup Java
248+
uses: actions/setup-java@v1
249+
with:
250+
java-version: '11'
251+
- name: Setup Firefox
252+
uses: browser-actions/setup-firefox@latest
253+
- name: Setup GeckoDriver
254+
uses: browser-actions/setup-geckodriver@latest
255+
- name: Start XVFB
256+
run: Xvfb :99 &
257+
- name: Run browser tests in Firefox
258+
uses: ./.github/actions/bazel-test
259+
with:
260+
query: attr(tags, rc, tests(//java/...))
261+
attempts: 3
262+
env:
263+
DISPLAY: :99
264+
265+
javadoc:
266+
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
267+
needs: [ check_workflow, build ]
268+
runs-on: ubuntu-latest
269+
steps:
270+
- name: Checkout source tree
271+
uses: actions/checkout@v2
272+
- name: Cache Bazel artifacts
273+
uses: actions/cache@v2
274+
with:
275+
path: |
276+
~/.cache/bazel-disk
277+
~/.cache/bazel-repo
278+
key: ${{ runner.os }}-bazel-firefox-tests-${{ hashFiles('**/BUILD.bazel') }}
279+
restore-keys: |
280+
${{ runner.os }}-bazel-firefox-tests-
281+
${{ runner.os }}-bazel-build-
282+
- name: Setup bazelisk
283+
uses: ./.github/actions/setup-bazelisk
284+
- name: Setup Java
285+
uses: actions/setup-java@v1
286+
with:
287+
java-version: '11'
288+
- name: Generate javadoc
289+
run: |
290+
./go --verbose javadocs

0 commit comments

Comments
 (0)