Skip to content

Commit

Permalink
Port from Travis-CI to GitHub Actions
Browse files Browse the repository at this point in the history
Travis-CI no longer has a free tier (only a free trial). That was a
major reason we used Travis-CI, so that external contributors would be
able to run the CI on their forks. Iterating on a Travis config in a
personal repo was also quite convenient. The other reason was that
Travis-CI was safe to run even with untrusted code.

Since the introduction of the permissions field in workflows, GitHub
Actions appears safe to run untrusted code and has a free tier for
external contributors. GitHub Actions and Google Cloud Build are the
main contenders for a Kokoro replacement, but Cloud Build isn't safe for
untrusted code. Instead of migrating to Travis-CI.com from
Travis-CI.org, let's migrate to GitHub Actions and gain some familiarity.

I've really appreciated Travis-CI.org and have wanted to pay for it for
years but wasn't about to give it write permission to the repo. I'm
disappointed to migrate off it, now that the permissions issues have
been sorted out.
  • Loading branch information
ejona86 authored Jun 17, 2021
1 parent 6201db2 commit 79e75ba
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 66 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
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@v2
- uses: actions/setup-java@v2
with:
java-version: ${{ matrix.jre }}
distribution: 'adopt'

- name: Gradle cache
uses: actions/cache@v2
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@v2
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@v2
with:
path: /tmp/protobuf-cache
key: ${{ runner.os }}-maven-${{ hashFiles('buildscripts/make_dependencies.sh') }}

- name: Build
run: buildscripts/kokoro/unix.sh
- 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
run: ./gradlew :grpc-all:coveralls -x compileJava
- name: Codecov
uses: codecov/codecov-action@v1
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ bin

# ARM tests
qemu-arm-static

# Temporary output dir for artifacts
mvn-artifacts
65 changes: 0 additions & 65 deletions .travis.yml

This file was deleted.

5 changes: 4 additions & 1 deletion buildscripts/kokoro/unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,16 @@ if [[ -z "${SKIP_TESTS:-}" ]]; then
exit 1
fi
# Run tests
./gradlew build $GRADLE_FLAGS
./gradlew build :grpc-all:jacocoTestReport $GRADLE_FLAGS
pushd examples
./gradlew clean $GRADLE_FLAGS
./gradlew build $GRADLE_FLAGS
# --batch-mode reduces log spam
mvn verify --batch-mode
popd
pushd examples/example-alts
../gradlew build $GRADLE_FLAGS
popd
pushd examples/example-hostname
../gradlew build $GRADLE_FLAGS
mvn verify --batch-mode
Expand Down

0 comments on commit 79e75ba

Please sign in to comment.