• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: CI
2
3on:
4  push:
5    branches:
6      - master
7  pull_request:
8    branches:
9      - master
10
11permissions:
12  contents: read
13
14jobs:
15  test:
16    permissions:
17      actions: write  # for styfle/cancel-workflow-action to cancel/stop running workflows
18      contents: read  # for actions/checkout to fetch code
19    name: "${{ matrix.root-pom }} on JDK ${{ matrix.java }} on ${{ matrix.os }}"
20    strategy:
21      matrix:
22        os: [ ubuntu-latest ]
23        java: [ 8, 11, 17 ]
24        root-pom: [ 'pom.xml', 'android/pom.xml' ]
25        include:
26          - os: windows-latest
27            java: 17
28            root-pom: pom.xml
29    runs-on: ${{ matrix.os }}
30    env:
31      ROOT_POM: ${{ matrix.root-pom }}
32    steps:
33      # Cancel any previous runs for the same branch that are still running.
34      - name: 'Cancel previous runs'
35        uses: styfle/cancel-workflow-action@01ce38bf961b4e243a6342cbade0dbc8ba3f0432
36        with:
37          access_token: ${{ github.token }}
38      - name: 'Check out repository'
39        uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
40      - name: 'Set up JDK ${{ matrix.java }}'
41        uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
42
43        with:
44          java-version: ${{ matrix.java }}
45          distribution: 'zulu'
46          cache: 'maven'
47      - name: 'Install'
48        shell: bash
49        run: ./mvnw -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn install -U -DskipTests=true -f $ROOT_POM
50      - name: 'Test'
51        shell: bash
52        run: ./mvnw -B -P!standard-with-extra-repos verify -U -Dmaven.javadoc.skip=true -f $ROOT_POM
53      - name: 'Print Surefire reports'
54        # Note: Normally a step won't run if the job has failed, but this causes it to
55        if: ${{ failure() }}
56        shell: bash
57        run: ./util/print_surefire_reports.sh
58      - name: 'Integration Test'
59        if: matrix.java == 11
60        shell: bash
61        run: util/gradle_integration_tests.sh
62
63  publish_snapshot:
64    name: 'Publish snapshot'
65    needs: test
66    if: github.event_name == 'push' && github.repository == 'google/guava'
67    runs-on: ubuntu-latest
68    steps:
69      - name: 'Check out repository'
70        uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
71      - name: 'Set up JDK 11'
72        uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
73
74        with:
75          java-version: 11
76          distribution: 'zulu'
77          server-id: sonatype-nexus-snapshots
78          server-username: CI_DEPLOY_USERNAME
79          server-password: CI_DEPLOY_PASSWORD
80          cache: 'maven'
81      - name: 'Publish'
82        env:
83          CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
84          CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
85        run: ./util/deploy_snapshot.sh
86
87  generate_docs:
88    permissions:
89      contents: write
90    name: 'Generate latest docs'
91    needs: test
92    if: github.event_name == 'push' && github.repository == 'google/guava'
93    runs-on: ubuntu-latest
94    steps:
95      - name: 'Check out repository'
96        uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
97      - name: 'Set up JDK 11'
98        uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
99
100        with:
101          java-version: 11
102          distribution: 'zulu'
103          cache: 'maven'
104      - name: 'Generate latest docs'
105        env:
106          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107        run: ./util/update_snapshot_docs.sh
108