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: [ 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: 17 39 experimental: false 40 - os: windows-latest 41 java: 17 42 experimental: false 43 - os: ubuntu-latest 44 java: 18-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 }}' 56 uses: actions/setup-java@v2 57 with: 58 java-version: ${{ matrix.java }} 59 distribution: 'zulu' 60 cache: 'maven' 61 - name: 'Install' 62 shell: bash 63 run: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V 64 - name: 'Test' 65 shell: bash 66 run: mvn test -B 67 68 publish_snapshot: 69 name: 'Publish snapshot' 70 needs: test 71 if: github.event_name == 'push' && github.repository == 'google/google-java-format' && github.ref == 'refs/heads/master' 72 runs-on: ubuntu-latest 73 steps: 74 - name: 'Check out repository' 75 uses: actions/checkout@v2 76 - name: 'Set up JDK 17' 77 uses: actions/setup-java@v2 78 with: 79 java-version: 17 80 distribution: 'zulu' 81 cache: 'maven' 82 server-id: sonatype-nexus-snapshots 83 server-username: CI_DEPLOY_USERNAME 84 server-password: CI_DEPLOY_PASSWORD 85 - name: 'Publish' 86 env: 87 CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} 88 CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }} 89 run: mvn -pl '!eclipse_plugin' source:jar deploy -B -DskipTests=true -Dinvoker.skip=true -Dmaven.javadoc.skip=true 90