| name: GitHub Actions Linux Testing |
| |
| on: |
| push: |
| branches: |
| - master |
| - 'v1.*' |
| pull_request: |
| schedule: |
| - cron: '54 19 * * SUN' # weekly at a "random" time |
| |
| permissions: |
| contents: read |
| |
| jobs: |
| tests: |
| runs-on: ubuntu-latest |
| strategy: |
| matrix: |
| jre: [8, 11] |
| fail-fast: false # Should swap to true if we grow a large matrix |
| |
| steps: |
| - uses: actions/checkout@v3 |
| - uses: actions/setup-java@v3 |
| with: |
| java-version: ${{ matrix.jre }} |
| distribution: 'temurin' |
| |
| - name: Gradle cache |
| uses: actions/cache@v3 |
| with: |
| path: | |
| ~/.gradle/caches |
| ~/.gradle/wrapper |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} |
| restore-keys: | |
| ${{ runner.os }}-gradle- |
| - name: Maven cache |
| uses: actions/cache@v3 |
| with: |
| path: | |
| ~/.m2/repository |
| !~/.m2/repository/io/grpc |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', 'build.gradle') }} |
| restore-keys: | |
| ${{ runner.os }}-maven- |
| - name: Protobuf cache |
| uses: actions/cache@v3 |
| with: |
| path: /tmp/protobuf-cache |
| key: ${{ runner.os }}-maven-${{ hashFiles('buildscripts/make_dependencies.sh') }} |
| |
| - name: Build |
| run: buildscripts/kokoro/unix.sh |
| - name: Post Failure Upload Test Reports to Artifacts |
| if: ${{ failure() }} |
| uses: actions/upload-artifact@v3 |
| with: |
| name: Test Reports (JRE ${{ matrix.jre }}) |
| path: | |
| ./*/build/reports/tests/** |
| ./*/*/build/reports/tests/** |
| retention-days: 14 |
| - name: Check for modified codegen |
| run: test -z "$(git status --porcelain)" || (git status && echo Error Working directory is not clean. Forget to commit generated files? && false) |
| |
| - name: Coveralls |
| if: matrix.jre == 8 # Upload once, instead of for each job in the matrix |
| env: |
| COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
| run: ./gradlew :grpc-all:coveralls -PskipAndroid=true -x compileJava |
| - name: Codecov |
| uses: codecov/codecov-action@v3 |
| |
| bazel: |
| runs-on: ubuntu-latest |
| env: |
| USE_BAZEL_VERSION: 5.0.0 |
| |
| steps: |
| - uses: actions/checkout@v2 |
| |
| - name: Bazel cache |
| uses: actions/cache@v3 |
| with: |
| path: | |
| ~/.cache/bazel/*/cache |
| ~/.cache/bazelisk/downloads |
| key: ${{ runner.os }}-bazel-${{ env.USE_BAZEL_VERSION }}-${{ hashFiles('WORKSPACE', 'repositories.bzl') }} |
| |
| - name: Run bazel build |
| run: bazelisk build //... |