CI - Java #193
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configuration for Java CI | |
# To force the execution of this workflow, add [run java] to your commit message | |
name: 'CI - Java' | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '15 9,21 * * *' | |
push: | |
pull_request: | |
env: | |
NODE_VERSION: '16.x' | |
jobs: | |
check_workflow: | |
permissions: | |
contents: none | |
uses: ./.github/workflows/should-workflow-run.yml | |
with: | |
bazel-target-prefix: '//java' | |
build: | |
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[java]') == true }} | |
needs: check_workflow | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source tree | |
uses: actions/checkout@v3 | |
- name: Cache Bazel artifacts | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/bazel-disk | |
~/.cache/bazel-repo | |
key: ${{ runner.os }}-bazel-build-${{ hashFiles('**/BUILD.bazel') }} | |
restore-keys: | | |
${{ runner.os }}-bazel-build- | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Build grid | |
uses: ./.github/actions/bazel | |
with: | |
command: build grid | |
small_tests: | |
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run java]') == true }} | |
needs: [ check_workflow, build ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source tree | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Cache Bazel artifacts | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/bazel-disk | |
~/.cache/bazel-repo | |
key: ${{ runner.os }}-bazel-small-tests-${{ hashFiles('**/BUILD.bazel') }} | |
restore-keys: | | |
${{ runner.os }}-bazel-small-tests- | |
${{ runner.os }}-bazel-build- | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Run small tests | |
uses: ./.github/actions/bazel-test | |
with: | |
query: attr(size, small, tests(//java/...)) except attr(tags, lint, tests(//java/...)) | |
- name: Sonar Scanner | |
uses: ./.github/actions/sonar-cloud | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
medium_tests: | |
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run java]') == true }} | |
needs: [ check_workflow, small_tests ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source tree | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Cache Bazel artifacts | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/bazel-disk | |
~/.cache/bazel-repo | |
key: ${{ runner.os }}-bazel-medium-tests-${{ hashFiles('**/BUILD.bazel') }} | |
restore-keys: | | |
${{ runner.os }}-bazel-medium-tests- | |
${{ runner.os }}-bazel-build- | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Run medium tests | |
uses: ./.github/actions/bazel-test | |
with: | |
query: attr(size, medium, tests(//java/...)) except attr(tags, lint, tests(//java/...)) | |
attempts: 3 | |
lint: | |
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run java]') == true }} | |
needs: [ check_workflow, build ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source tree | |
uses: actions/checkout@v3 | |
- name: Cache Bazel artifacts | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/bazel-disk | |
~/.cache/bazel-repo | |
key: ${{ runner.os }}-bazel-lint-${{ hashFiles('**/BUILD.bazel') }} | |
restore-keys: | | |
${{ runner.os }}-bazel-lint- | |
${{ runner.os }}-bazel-build- | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Run linter | |
uses: ./.github/actions/bazel-test | |
with: | |
query: attr(tags, lint, tests(//java/...)) except attr(tags, no-lint, tests(//java/...)) | |
browser_tests: | |
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run java]') == true }} | |
needs: [ check_workflow, small_tests ] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { "browser": "firefox", "version": "latest" } | |
- { "browser": "firefox", "version": "latest-beta" } | |
- { "browser": "firefox", "version": "latest-devedition" } | |
- { "browser": "chrome", "version": "stable" } | |
steps: | |
- name: Checkout source tree | |
uses: actions/checkout@v3 | |
- name: Cache Bazel artifacts | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/bazel-disk | |
~/.cache/bazel-repo | |
key: ${{ runner.os }}-bazel-${{ matrix.browser }}-tests-${{ hashFiles('**/BUILD.bazel') }} | |
restore-keys: | | |
${{ runner.os }}-bazel-${{ matrix.browser }}-tests- | |
${{ runner.os }}-bazel-build- | |
- name: Setup Fluxbox | |
run: sudo apt-get -y install fluxbox | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Setup Firefox | |
uses: abhi1693/[email protected] | |
with: | |
browser: firefox | |
version: ${{ matrix.version }} | |
if: | | |
matrix.browser == 'firefox' | |
- name: Setup Chrome | |
uses: browser-actions/setup-chrome@latest | |
with: | |
version: ${{ matrix.version }} | |
if: | | |
matrix.browser == 'chrome' | |
- name: Start XVFB | |
run: Xvfb :99 & | |
- name: Start Fluxbox | |
run: fluxbox -display :99 & | |
- name: Run browser tests in ${{ matrix.browser }} | |
uses: ./.github/actions/bazel-test | |
with: | |
query: attr(tags, ${{ matrix.browser }}, tests(//java/...)) except attr(tags, 'rc|remote', tests(//java/...)) | |
attempts: 3 | |
env: | |
DISPLAY: :99 | |
server_tests: | |
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run java]') == true }} | |
needs: [ check_workflow, small_tests ] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { "browser": "firefox", "version": "latest" } | |
- { "browser": "firefox", "version": "latest-beta" } | |
- { "browser": "firefox", "version": "latest-devedition" } | |
- { "browser": "chrome", "version": "stable" } | |
steps: | |
- name: Checkout source tree | |
uses: actions/checkout@v3 | |
- name: Cache Bazel artifacts | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/bazel-disk | |
~/.cache/bazel-repo | |
key: ${{ runner.os }}-bazel-${{ matrix.browser }}-server-tests-${{ hashFiles('**/BUILD.bazel') }} | |
restore-keys: | | |
${{ runner.os }}-bazel-${{ matrix.browser }}-server-tests- | |
${{ runner.os }}-bazel-${{ matrix.browser }}-tests- | |
${{ runner.os }}-bazel-build- | |
- name: Setup Fluxbox | |
run: sudo apt-get -y install fluxbox | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Setup Firefox | |
uses: abhi1693/[email protected] | |
with: | |
browser: firefox | |
version: ${{ matrix.version }} | |
if: | | |
matrix.browser == 'firefox' | |
- name: Setup Chrome | |
uses: browser-actions/setup-chrome@latest | |
with: | |
version: ${{ matrix.version }} | |
if: | | |
matrix.browser == 'chrome' | |
- name: Start XVFB | |
run: Xvfb :99 & | |
- name: Start Fluxbox | |
run: fluxbox -display :99 & | |
- name: Run server tests | |
uses: ./.github/actions/bazel-test | |
with: | |
query: attr(tags, ${{ matrix.browser }}, tests(//java/...)) intersect attr(tags, 'remote', tests(//java/...)) | |
attempts: 3 | |
env: | |
DISPLAY: :99 | |
rc_tests: | |
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run java]') == true }} | |
needs: [ check_workflow, small_tests ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source tree | |
uses: actions/checkout@v3 | |
- name: Cache Bazel artifacts | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/bazel-disk | |
~/.cache/bazel-repo | |
key: ${{ runner.os }}-bazel-firefox-tests-${{ hashFiles('**/BUILD.bazel') }} | |
restore-keys: | | |
${{ runner.os }}-bazel-firefox-tests- | |
${{ runner.os }}-bazel-build- | |
- name: Setup Fluxbox | |
run: sudo apt-get -y install fluxbox | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Setup Firefox | |
uses: abhi1693/[email protected] | |
with: | |
browser: firefox | |
version: latest | |
if: | | |
matrix.browser == 'firefox' | |
- name: Start XVFB | |
run: Xvfb :99 & | |
- name: Start Fluxbox | |
run: fluxbox -display :99 & | |
- name: Run browser tests in Firefox | |
uses: ./.github/actions/bazel-test | |
with: | |
query: attr(tags, rc, tests(//java/...)) | |
attempts: 3 | |
env: | |
DISPLAY: :99 | |
javadoc: | |
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run java]') == true }} | |
needs: [ check_workflow, build ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source tree | |
uses: actions/checkout@v3 | |
- name: Cache Bazel artifacts | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/bazel-disk | |
~/.cache/bazel-repo | |
key: ${{ runner.os }}-bazel-firefox-tests-${{ hashFiles('**/BUILD.bazel') }} | |
restore-keys: | | |
${{ runner.os }}-bazel-firefox-tests- | |
${{ runner.os }}-bazel-build- | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Generate javadoc | |
run: | | |
./go --verbose javadocs |