aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/continuous-integration.yml
blob: 9db301f149b1dfc0a5c896f9e6b644fb752614b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Continuous integration
on:
  pull_request:
  push:
    branches:
      - master
concurrency:
  group: ${{ github.ref }}
  cancel-in-progress: true
jobs:
  build:
    name: "JDK ${{ matrix.java }} on ${{ matrix.os }} with Error Prone ${{ matrix.epVersion }}"
    strategy:
      matrix:
        include:
          - os: macos-latest
            java: 8
            epVersion: 2.4.0
          - os: macos-latest
            java: 11
            epVersion: 2.4.0
          - os: ubuntu-latest
            java: 8
            epVersion: 2.4.0
          - os: ubuntu-latest
            java: 8
            epVersion: 2.10.0
          - os: ubuntu-latest
            java: 11
            epVersion: 2.4.0
          - os: windows-latest
            java: 8
            epVersion: 2.4.0
          - os: ubuntu-latest
            java: 17
            epVersion: 2.10.0
      fail-fast: false
    runs-on: ${{ matrix.os }}
    steps:
      - name: Check out NullAway sources
        uses: actions/checkout@v2
      - name: 'Set up JDK ${{ matrix.java }}'
        uses: actions/setup-java@v2
        with:
          java-version: ${{ matrix.java }}
          distribution: 'zulu'
      - name: Build and test using Gradle, Java 8, and Error Prone ${{ matrix.epVersion }}
        env:
          ORG_GRADLE_PROJECT_epApiVersion: ${{ matrix.epVersion }}
        uses: eskatos/gradle-command-action@v1
        with:
          arguments: verGJF build
        if: matrix.java == '8'
      - name: Build and test using Gradle and Java 11
        uses: eskatos/gradle-command-action@v1
        with:
          arguments: build -x :sample-app:build -x :jar-infer:nullaway-integration-test:build
        if: matrix.java == '11'
      - name: Build and test using Gradle and Java 17
        uses: eskatos/gradle-command-action@v1
        with:
          arguments: build -x :sample-app:build -x :jar-infer:jar-infer-lib:build -x :jar-infer:nullaway-integration-test:build -x :jar-infer:test-java-lib-jarinfer:build
        if: matrix.java == '17'
      - name: Report jacoco coverage
        uses: eskatos/gradle-command-action@v1
        env:
          COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
        with:
          arguments: codeCoverageReport coveralls
        continue-on-error: true
        if: runner.os == 'Linux' && matrix.java == '11' && matrix.epVersion == '2.4.0' && github.repository == 'uber/NullAway'
      - name: Check that Git tree is clean after build and test
        run: ./.buildscript/check_git_clean.sh
  publish_snapshot:
    name: 'Publish snapshot'
    needs: [build]
    if: github.event_name == 'push' && github.repository == 'uber/NullAway' && github.ref == 'refs/heads/master'
    runs-on: ubuntu-latest
    steps:
      - name: 'Check out repository'
        uses: actions/checkout@v2
      - name: Cache Gradle caches
        uses: actions/cache@v1
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle') }}
          restore-keys: ${{ runner.os }}-gradle-caches-
      - name: Cache Gradle wrapper
        uses: actions/cache@v1
        with:
          path: ~/.gradle/wrapper
          key: ${{ runner.os }}-gradlew-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
          restore-keys: ${{ runner.os }}-gradlew-wrapper-
      - name: 'Set up JDK 8'
        uses: actions/setup-java@v1
        with:
          java-version: 8
      - name: 'Publish'
        env:
          ORG_GRADLE_PROJECT_mavenCentralRepositoryUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
          ORG_GRADLE_PROJECT_mavenCentralRepositoryPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
        run: ./gradlew clean publish