Add validation test for conditional compilation in Java (#2006) #1642
This file contains hidden or 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 | |
| on: | |
| - push | |
| - pull_request | |
| jobs: | |
| Linux: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - jdk: 8 | |
| - jdk: 8 | |
| ecj: true | |
| - jdk: 11 | |
| - jdk: 11 | |
| ecj: true | |
| - jdk: 17 | |
| - jdk: 17 | |
| ecj: true | |
| - jdk: 21 | |
| - jdk: 21 | |
| ecj: true | |
| name: JDK ${{ matrix.jdk }}${{ matrix.ecj && ' with ECJ' || ''}} | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | |
| with: | |
| distribution: 'zulu' | |
| java-version: | | |
| ${{ matrix.jdk }} | |
| 17 | |
| - name: 'Generate toolchains.xml' | |
| env: | |
| JDK_VERSION: ${{ matrix.jdk }} | |
| JDK_HOME_VARIABLE_NAME: JAVA_HOME_${{ matrix.jdk }}_X64 | |
| run: | | |
| echo " | |
| <toolchains> | |
| <toolchain> | |
| <type>jdk</type> | |
| <provides> | |
| <id>$JDK_VERSION</id> | |
| <version>$JDK_VERSION</version> | |
| </provides> | |
| <configuration> | |
| <jdkHome>${!JDK_HOME_VARIABLE_NAME}</jdkHome> | |
| </configuration> | |
| </toolchain> | |
| </toolchains> | |
| " > toolchains.xml | |
| - name: 'Build' | |
| run: | | |
| ./mvnw -V -B -e --no-transfer-progress \ | |
| verify -Djdk.version=${{ matrix.jdk }} -Dbytecode.version=${{ matrix.jdk }} \ | |
| ${{ matrix.ecj && '-Decj' || ''}} \ | |
| --toolchains=toolchains.xml | |
| Windows: | |
| runs-on: windows-2022 | |
| steps: | |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | |
| with: | |
| distribution: 'zulu' | |
| java-version: | | |
| 6 | |
| 17 | |
| - name: 'Generate toolchains.xml' | |
| env: | |
| JDK_VERSION: 6 | |
| JDK_HOME_VARIABLE_NAME: JAVA_HOME_6_X64 | |
| shell: bash | |
| run: | | |
| echo " | |
| <toolchains> | |
| <toolchain> | |
| <type>jdk</type> | |
| <provides> | |
| <id>$JDK_VERSION</id> | |
| <version>$JDK_VERSION</version> | |
| </provides> | |
| <configuration> | |
| <jdkHome>${!JDK_HOME_VARIABLE_NAME}</jdkHome> | |
| </configuration> | |
| </toolchain> | |
| </toolchains> | |
| " > toolchains.xml | |
| - name: 'Build' | |
| shell: bash | |
| run: | | |
| ./mvnw -V -B -e --no-transfer-progress \ | |
| verify -Djdk.version=6 -Dbytecode.version=5 \ | |
| --toolchains=toolchains.xml | |
| - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| id: artifact-upload-step | |
| with: | |
| name: jacoco | |
| path: jacoco/target/*.zip | |
| if-no-files-found: error |