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. 16on: 17 push: 18 branches: 19 - main 20 pull_request: 21name: ci 22jobs: 23 units: 24 runs-on: ubuntu-latest 25 strategy: 26 fail-fast: false 27 matrix: 28 java: [8, 11, 17] 29 steps: 30 - name: Get current week within the year 31 id: date 32 run: echo "::set-output name=week_of_year::$(date +'%W' --utc)" 33 - uses: actions/checkout@v3 34 - uses: actions/setup-java@v3 35 with: 36 distribution: zulu 37 java-version: ${{matrix.java}} 38 - run: java -version 39 - uses: actions/cache@v3 40 id: mvn-cache 41 with: 42 path: ~/.m2/repository 43 key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }} 44 - run: .kokoro/build.sh 45 env: 46 JOB_TYPE: test 47 JOB_NAME: units-${{matrix.java}} 48 windows: 49 runs-on: windows-latest 50 steps: 51 - name: Support longpaths 52 run: git config --system core.longpaths true 53 - uses: actions/checkout@v3 54 - uses: actions/setup-java@v3 55 with: 56 distribution: zulu 57 java-version: 11 58 cache: 'maven' 59 - run: java -version 60 - run: .kokoro/build.sh 61 env: 62 JOB_TYPE: test 63 JOB_NAME: windows-units 64 lint: 65 runs-on: ubuntu-latest 66 steps: 67 - name: Get current week within the year 68 id: date 69 run: echo "::set-output name=week_of_year::$(date +'%W' --utc)" 70 - uses: actions/checkout@v3 71 - uses: actions/setup-java@v3 72 with: 73 distribution: zulu 74 java-version: 11 75 - run: java -version 76 - uses: actions/cache@v3 77 id: mvn-cache 78 with: 79 path: ~/.m2/repository 80 key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }} 81 - run: java -version 82 - run: mvn -B -ntp com.coveo:fmt-maven-plugin:check 83 - run: mvn -B -ntp checkstyle:check@checkstyle 84 enforcer: 85 runs-on: ubuntu-latest 86 steps: 87 - name: Get current week within the year 88 id: date 89 run: echo "::set-output name=week_of_year::$(date +'%W' --utc)" 90 - uses: actions/checkout@v3 91 - uses: actions/setup-java@v3 92 with: 93 distribution: zulu 94 java-version: 11 95 - run: java -version 96 - uses: actions/cache@v3 97 id: mvn-cache 98 with: 99 path: ~/.m2/repository 100 key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }} 101 - run: java -version 102 - run: mvn -B -ntp enforcer:enforce@enforce -T 1C 103 requirements-kokoro: 104 runs-on: ubuntu-latest 105 container: gcr.io/cloud-devrel-public-resources/java8 106 steps: 107 - uses: actions/checkout@v3 108 - run: python3 --version 109 - run: python3 -m pip install --require-hashes -r .kokoro/requirements.txt 110 111 gapic-libraries-bom: 112 runs-on: ubuntu-latest 113 steps: 114 - uses: actions/checkout@v3 115 - uses: actions/setup-java@v3 116 with: 117 java-version: 11 118 distribution: temurin 119 cache: maven 120 - name: Install Maven modules to local Maven repository 121 run: | 122 mvn install -B -ntp -T 1C -DskipTests -Dclirr.skip -Dcheckstyle.skip 123 - name: Validate gapic-libraries-bom 124 uses: googleapis/java-cloud-bom/tests/validate-bom@v26.13.0 125 with: 126 bom-path: gapic-libraries-bom/pom.xml 127 128# TODO: Uncomment the needed Github Actions 129# dependencies: 130# runs-on: ubuntu-latest 131# strategy: 132# matrix: 133# java: [8, 11, 17] 134# steps: 135# - uses: actions/checkout@v3 136# - uses: actions/setup-java@v3 137# with: 138# distribution: zulu 139# java-version: ${{matrix.java}} 140# - run: java -version 141# - run: .kokoro/dependencies.sh 142# clirr: 143# runs-on: ubuntu-latest 144# steps: 145# - uses: actions/checkout@v3 146# - uses: actions/setup-java@v3 147# with: 148# distribution: zulu 149# java-version: 8 150# - run: java -version 151# - run: .kokoro/build.sh 152# env: 153# JOB_TYPE: clirr