Add a test for building with different source/target combinations #171
Workflow file for this run
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
name: CI | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Mount bazel cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/bazel | |
~/.cache/bazelisk | |
key: bazel | |
- name: Build JdtJavaBuilder_deploy.jar | |
run: | | |
bazelisk build :JdtJavaBuilder_deploy.jar | |
cp -fv bazel-bin/JdtJavaBuilder_deploy.jar compiler/export/ | |
test: | |
needs: [build] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false # we want all results | |
matrix: | |
compiler: [ecj, ecjtool, javac] | |
java_versions: # not all combinations are allowed: language <= runtime | |
- {language: 11, runtime: local_jdk} | |
- {language: 11, runtime: remotejdk_11} | |
- {language: 11, runtime: remotejdk_17} | |
- {language: 11, runtime: remotejdk_21} | |
- {language: 17, runtime: remotejdk_17} | |
- {language: 17, runtime: remotejdk_21} | |
- {language: 21, runtime: remotejdk_21} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Mount bazel cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/bazel | |
~/.cache/bazelisk | |
key: bazel | |
- name: Build JdtJavaBuilder_deploy.jar | |
run: | | |
bazelisk build :JdtJavaBuilder_deploy.jar | |
cp -fv bazel-bin/JdtJavaBuilder_deploy.jar compiler/export/ | |
- name: Prepare Test Compile | |
run: | | |
cd examples/ | |
echo "JAVA_HOME=$JAVA_HOME" | |
java --version | |
bazelisk info | |
bazelisk clean | |
- name: Echo Bazel Flags | |
run: | | |
echo "using --config=${{ matrix.compiler }} --config=debug --java_runtime_version=${{ matrix.java_versions.runtime }} --java_language_version=${{ matrix.java_versions.language }}" | |
- name: Test Compile & Test | |
run: | | |
cd examples/ | |
bazelisk build --config=${{ matrix.compiler }} --java_runtime_version=${{ matrix.java_versions.runtime }} --java_language_version=${{ matrix.java_versions.language }} //... | |
bazelisk test --config=${{ matrix.compiler }} --config=debug --java_runtime_version=${{ matrix.java_versions.runtime }} --java_language_version=${{ matrix.java_versions.language }} //... | |
- name: Test Compile with source 11 target 17 | |
if: ${{ matrix.java_versions.language == '11' && matrix.java_versions.runtime == 'remotejdk_17' }} | |
run: | | |
cd examples/ | |
bazelisk build --config=${{ matrix.compiler }} --extra_toolchains=//source-target-toolchains:all --java_runtime_version=${{ matrix.java_versions.runtime }} --java_language_version=${{ matrix.java_versions.language }} //... | |
- name: Dump Test Logs when failed | |
if: ${{ failure() }} | |
run: | | |
cd examples | |
find -L ./bazel-testlogs -type f -name test.log -exec cat {} \; | |
- name: Clear Test Output | |
run: | | |
cd examples/ | |
bazelisk clean |