GitHub Actions Linux Testing #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@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: 6.0.0 | |
steps: | |
- uses: actions/checkout@v3 | |
- 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@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 //... --enable_bzlmod=false | |
- name: Run bazel build (bzlmod) | |
env: | |
USE_BAZEL_VERSION: 7.0.0 | |
run: bazelisk build //... --enable_bzlmod=true |