|
| 1 | +# Copyright 2022 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +# Github action job to test core java library features on |
| 15 | +# downstream client libraries before they are released. |
| 16 | +on: |
| 17 | + push: |
| 18 | + branches: |
| 19 | + - main |
| 20 | + pull_request: |
| 21 | +name: java-logging ci |
| 22 | +defaults: |
| 23 | + run: |
| 24 | + working-directory: java-logging |
| 25 | +jobs: |
| 26 | + filter: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + outputs: |
| 29 | + library: ${{ steps.filter.outputs.library }} |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + - uses: dorny/paths-filter@v3 |
| 33 | + id: filter |
| 34 | + with: |
| 35 | + filters: | |
| 36 | + library: |
| 37 | + - 'java-logging/**' |
| 38 | + units: |
| 39 | + needs: filter |
| 40 | + if: ${{ needs.filter.outputs.library == 'true' }} |
| 41 | + runs-on: ubuntu-latest |
| 42 | + strategy: |
| 43 | + fail-fast: false |
| 44 | + matrix: |
| 45 | + java: [11, 17, 21, 25] |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + - uses: actions/setup-java@v4 |
| 49 | + with: |
| 50 | + distribution: temurin |
| 51 | + java-version: ${{matrix.java}} |
| 52 | + - run: java -version |
| 53 | + - run: .kokoro/build.sh |
| 54 | + env: |
| 55 | + JOB_TYPE: test |
| 56 | + units-java8: |
| 57 | + needs: filter |
| 58 | + if: ${{ needs.filter.outputs.library == 'true' }} |
| 59 | + # Building using Java 17 and run the tests with Java 8 runtime |
| 60 | + name: "units (8)" |
| 61 | + runs-on: ubuntu-latest |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v4 |
| 64 | + - uses: actions/setup-java@v4 |
| 65 | + with: |
| 66 | + java-version: 8 |
| 67 | + distribution: temurin |
| 68 | + - name: "Set jvm system property environment variable for surefire plugin (unit tests)" |
| 69 | + # Maven surefire plugin (unit tests) allows us to specify JVM to run the tests. |
| 70 | + # https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm |
| 71 | + run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java" >> $GITHUB_ENV |
| 72 | + shell: bash |
| 73 | + - uses: actions/setup-java@v4 |
| 74 | + with: |
| 75 | + java-version: 17 |
| 76 | + distribution: temurin |
| 77 | + - run: .kokoro/build.sh |
| 78 | + env: |
| 79 | + JOB_TYPE: test |
| 80 | + windows: |
| 81 | + needs: filter |
| 82 | + if: ${{ needs.filter.outputs.library == 'true' }} |
| 83 | + runs-on: windows-latest |
| 84 | + steps: |
| 85 | + - name: Support longpaths |
| 86 | + run: git config --system core.longpaths true |
| 87 | + - uses: actions/checkout@v4 |
| 88 | + - uses: actions/setup-java@v4 |
| 89 | + with: |
| 90 | + distribution: temurin |
| 91 | + java-version: 8 |
| 92 | + - run: java -version |
| 93 | + - run: .kokoro/build.bat |
| 94 | + env: |
| 95 | + JOB_TYPE: test |
| 96 | + dependencies: |
| 97 | + needs: filter |
| 98 | + if: ${{ needs.filter.outputs.library == 'true' }} |
| 99 | + runs-on: ubuntu-latest |
| 100 | + strategy: |
| 101 | + matrix: |
| 102 | + java: [17] |
| 103 | + steps: |
| 104 | + - uses: actions/checkout@v4 |
| 105 | + - uses: actions/setup-java@v4 |
| 106 | + with: |
| 107 | + distribution: temurin |
| 108 | + java-version: ${{matrix.java}} |
| 109 | + - run: java -version |
| 110 | + - run: .kokoro/dependencies.sh |
| 111 | + javadoc: |
| 112 | + needs: filter |
| 113 | + if: ${{ needs.filter.outputs.library == 'true' }} |
| 114 | + runs-on: ubuntu-latest |
| 115 | + steps: |
| 116 | + - uses: actions/checkout@v4 |
| 117 | + - uses: actions/setup-java@v4 |
| 118 | + with: |
| 119 | + distribution: temurin |
| 120 | + java-version: 17 |
| 121 | + - run: java -version |
| 122 | + - run: .kokoro/build.sh |
| 123 | + env: |
| 124 | + JOB_TYPE: javadoc |
| 125 | + lint: |
| 126 | + needs: filter |
| 127 | + if: ${{ needs.filter.outputs.library == 'true' }} |
| 128 | + runs-on: ubuntu-latest |
| 129 | + steps: |
| 130 | + - uses: actions/checkout@v4 |
| 131 | + - uses: actions/setup-java@v4 |
| 132 | + with: |
| 133 | + distribution: temurin |
| 134 | + java-version: 17 |
| 135 | + - run: java -version |
| 136 | + - run: .kokoro/build.sh |
| 137 | + env: |
| 138 | + JOB_TYPE: lint |
0 commit comments