1# Copyright 2020 The Error Prone Authors. 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 15name: CI 16 17on: 18 push: 19 branches: 20 - master 21 pull_request: 22 branches: 23 - master 24 25jobs: 26 test: 27 name: "JDK ${{ matrix.java }} on ${{ matrix.os }}" 28 strategy: 29 fail-fast: false 30 matrix: 31 os: [ ubuntu-latest ] 32 java: [ 21, 17, 11 ] 33 experimental: [ false ] 34 include: 35 # Only test on macos and windows with a single recent JDK to avoid a 36 # combinatorial explosion of test configurations. 37 - os: macos-latest 38 java: 21 39 experimental: false 40 - os: windows-latest 41 java: 21 42 experimental: false 43 - os: ubuntu-latest 44 java: EA 45 experimental: true 46 runs-on: ${{ matrix.os }} 47 continue-on-error: ${{ matrix.experimental }} 48 steps: 49 - name: Cancel previous 50 uses: styfle/cancel-workflow-action@0.9.1 51 with: 52 access_token: ${{ github.token }} 53 - name: 'Check out repository' 54 uses: actions/checkout@v2 55 - name: 'Set up JDK ${{ matrix.java }} from jdk.java.net' 56 if: ${{ matrix.java == 'EA' }} 57 uses: oracle-actions/setup-java@v1 58 with: 59 website: jdk.java.net 60 release: ${{ matrix.java }} 61 cache: 'maven' 62 - name: 'Set up JDK ${{ matrix.java }}' 63 if: ${{ matrix.java != 'EA' }} 64 uses: actions/setup-java@v2 65 with: 66 java-version: ${{ matrix.java }} 67 distribution: 'zulu' 68 cache: 'maven' 69 - name: 'Install' 70 shell: bash 71 run: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V 72 - name: 'Test' 73 shell: bash 74 run: mvn test -B 75 76 publish_snapshot: 77 name: 'Publish snapshot' 78 needs: test 79 if: github.event_name == 'push' && github.repository == 'google/google-java-format' && github.ref == 'refs/heads/master' 80 runs-on: ubuntu-latest 81 steps: 82 - name: 'Check out repository' 83 uses: actions/checkout@v2 84 - name: 'Set up JDK 17' 85 uses: actions/setup-java@v2 86 with: 87 java-version: 17 88 distribution: 'zulu' 89 cache: 'maven' 90 server-id: sonatype-nexus-snapshots 91 server-username: CI_DEPLOY_USERNAME 92 server-password: CI_DEPLOY_PASSWORD 93 - name: 'Publish' 94 env: 95 CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} 96 CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }} 97 run: mvn -pl '!eclipse_plugin' source:jar deploy -B -DskipTests=true -Dinvoker.skip=true -Dmaven.javadoc.skip=true 98