Skip to content

GitHub Actions Linux Testing #289

GitHub Actions Linux Testing

GitHub Actions Linux Testing #289

Workflow file for this run

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, 17]
fail-fast: false # Should swap to true if we grow a large matrix
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: ${{ matrix.jre }}
distribution: 'temurin'
- name: Gradle cache
uses: actions/cache@v4
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@v4
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@v4
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@v4
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@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
bazel:
runs-on: ubuntu-latest
env:
USE_BAZEL_VERSION: 6.0.0
steps:
- uses: actions/checkout@v4
- name: Check versions match in MODULE.bazel and repositories.bzl
run: |
diff -u <(sed -n '/GRPC_DEPS_START/,/GRPC_DEPS_END/ {/GRPC_DEPS_/! p}' MODULE.bazel) \
<(sed -n '/GRPC_DEPS_START/,/GRPC_DEPS_END/ {/GRPC_DEPS_/! p}' repositories.bzl)
- name: Bazel cache
uses: actions/cache@v4
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 //... --enable_bzlmod=false
- name: Run example bazel build
run: bazelisk build //... --enable_bzlmod=false
working-directory: ./examples
- name: Run bazel build (bzlmod)
env:
USE_BAZEL_VERSION: 7.0.0
run: bazelisk build //... --enable_bzlmod=true
- name: Run example bazel build (bzlmod)
env:
USE_BAZEL_VERSION: 7.0.0
run: bazelisk build //... --enable_bzlmod=true
working-directory: ./examples