• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: GitHub Actions Linux Testing
2
3on:
4  push:
5    branches:
6    - master
7    - 'v1.*'
8  pull_request:
9  schedule:
10  - cron: '54 19 * * SUN' # weekly at a "random" time
11
12permissions:
13  contents: read
14
15jobs:
16  tests:
17    runs-on: ubuntu-latest
18    strategy:
19      matrix:
20        jre: [8, 11]
21      fail-fast: false # Should swap to true if we grow a large matrix
22
23    steps:
24    - uses: actions/checkout@v3
25    - uses: actions/setup-java@v3
26      with:
27        java-version: ${{ matrix.jre }}
28        distribution: 'temurin'
29
30    - name: Gradle cache
31      uses: actions/cache@v3
32      with:
33        path: |
34          ~/.gradle/caches
35          ~/.gradle/wrapper
36        key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
37        restore-keys: |
38          ${{ runner.os }}-gradle-
39    - name: Maven cache
40      uses: actions/cache@v3
41      with:
42        path: |
43          ~/.m2/repository
44          !~/.m2/repository/io/grpc
45        key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', 'build.gradle') }}
46        restore-keys: |
47          ${{ runner.os }}-maven-
48    - name: Protobuf cache
49      uses: actions/cache@v3
50      with:
51        path: /tmp/protobuf-cache
52        key: ${{ runner.os }}-maven-${{ hashFiles('buildscripts/make_dependencies.sh') }}
53
54    - name: Build
55      run: buildscripts/kokoro/unix.sh
56    - name: Post Failure Upload Test Reports to Artifacts
57      if: ${{ failure() }}
58      uses: actions/upload-artifact@v3
59      with:
60        name: Test Reports (JRE ${{ matrix.jre }})
61        path: |
62          ./*/build/reports/tests/**
63          ./*/*/build/reports/tests/**
64        retention-days: 14
65    - name: Check for modified codegen
66      run: test -z "$(git status --porcelain)" || (git status && echo Error Working directory is not clean. Forget to commit generated files? && false)
67
68    - name: Coveralls
69      if: matrix.jre == 8 # Upload once, instead of for each job in the matrix
70      env:
71        COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
72      run: ./gradlew :grpc-all:coveralls -PskipAndroid=true -x compileJava
73    - name: Codecov
74      uses: codecov/codecov-action@v3
75
76  bazel:
77    runs-on: ubuntu-latest
78    env:
79      USE_BAZEL_VERSION: 5.0.0
80
81    steps:
82    - uses: actions/checkout@v2
83
84    - name: Bazel cache
85      uses: actions/cache@v3
86      with:
87        path: |
88          ~/.cache/bazel/*/cache
89          ~/.cache/bazelisk/downloads
90        key: ${{ runner.os }}-bazel-${{ env.USE_BAZEL_VERSION }}-${{ hashFiles('WORKSPACE', 'repositories.bzl') }}
91
92    - name: Run bazel build
93      run: bazelisk build //...
94