Skip to content

Commit d1480c8

Browse files
committed
Enabling workflow_dispatch for Java
1 parent a9847f3 commit d1480c8

1 file changed

Lines changed: 281 additions & 14 deletions

File tree

.github/workflows/java-ci.yml

Lines changed: 281 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,289 @@ name: 'CI - Java'
44
on:
55
workflow_dispatch:
66
schedule:
7-
- cron: '0 0 * * *'
7+
- cron: '15 9,21 * * *'
8+
workflow_call:
9+
push:
10+
branches:
11+
- trunk
12+
pull_request:
13+
branches:
14+
- trunk
815

9-
permissions:
10-
issues: write
11-
pull-requests: write
16+
env:
17+
NODE_VERSION: '13.x'
1218

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

0 commit comments

Comments
 (0)