• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: CI
2
3on:
4  push:
5    branches:
6      - master
7  pull_request:
8    branches:
9      - master
10
11jobs:
12  test:
13    name: "JDK ${{ matrix.java }}"
14    strategy:
15      matrix:
16        java: [ 8, 11 ]
17    runs-on: ubuntu-latest
18    steps:
19      # Cancel any previous runs for the same branch that are still running.
20      - name: 'Cancel previous runs'
21        uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa
22        with:
23          access_token: ${{ github.token }}
24      - name: 'Check out repository'
25        uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
26      - name: 'Cache local Maven repository'
27        uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
28        with:
29          path: ~/.m2/repository
30          key: maven-${{ hashFiles('**/pom.xml') }}
31          restore-keys: |
32            maven-
33      - name: 'Set up JDK ${{ matrix.java }}'
34        uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9
35        with:
36          java-version: ${{ matrix.java }}
37          distribution: 'zulu'
38      - name: 'Install'
39        shell: bash
40        run: mvn -B -P!standard-with-extra-repos install -U -DskipTests=true
41      - name: 'Test'
42        shell: bash
43        run: mvn -B -P!standard-with-extra-repos verify -U -Dmaven.javadoc.skip=true
44      - name: 'Javadoc Test Run'
45        shell: bash
46        run: mvn -B -P!standard-with-extra-repos javadoc:aggregate -U
47
48  publish_snapshot:
49    name: 'Publish snapshot'
50    needs: test
51    if: github.event_name == 'push' && github.repository == 'google/truth'
52    runs-on: ubuntu-latest
53    steps:
54      - name: 'Check out repository'
55        uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
56      - name: 'Cache local Maven repository'
57        uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
58        with:
59          path: ~/.m2/repository
60          key: maven-${{ hashFiles('**/pom.xml') }}
61          restore-keys: |
62            maven-
63      - name: 'Set up JDK 11'
64        uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9
65        with:
66          java-version: 11
67          distribution: 'zulu'
68          server-id: sonatype-nexus-snapshots
69          server-username: CI_DEPLOY_USERNAME
70          server-password: CI_DEPLOY_PASSWORD
71      - name: 'Publish'
72        env:
73          CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
74          CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
75        run: mvn -B clean source:jar javadoc:jar deploy -DskipTests=true
76
77  generate_docs:
78    name: 'Generate latest docs'
79    needs: test
80    if: github.event_name == 'push' && github.repository == 'google/truth'
81    runs-on: ubuntu-latest
82    steps:
83      - name: 'Check out repository'
84        uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
85      - name: 'Cache local Maven repository'
86        uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
87        with:
88          path: ~/.m2/repository
89          key: maven-${{ hashFiles('**/pom.xml') }}
90          restore-keys: |
91            maven-
92      - name: 'Set up JDK 11'
93        uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9
94        with:
95          java-version: 11
96          distribution: 'zulu'
97      - name: 'Generate latest docs'
98        env:
99          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100        run: ./util/generate-latest-docs.sh
101