Skip to content

Commit 79e75ba

Browse files
authored
Port from Travis-CI to GitHub Actions
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.
1 parent 6201db2 commit 79e75ba

File tree

4 files changed

+70
-66
lines changed

4 files changed

+70
-66
lines changed

.github/workflows/testing.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: GitHub Actions Linux Testing
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 'v1.*'
8+
pull_request:
9+
schedule:
10+
- cron: '54 19 * * SUN' # weekly at a "random" time
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
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@v2
25+
- uses: actions/setup-java@v2
26+
with:
27+
java-version: ${{ matrix.jre }}
28+
distribution: 'adopt'
29+
30+
- name: Gradle cache
31+
uses: actions/cache@v2
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@v2
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@v2
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: Check for modified codegen
57+
run: test -z "$(git status --porcelain)" || (git status && echo Error Working directory is not clean. Forget to commit generated files? && false)
58+
59+
- name: Coveralls
60+
if: matrix.jre == 8 # Upload once, instead of for each job in the matrix
61+
run: ./gradlew :grpc-all:coveralls -x compileJava
62+
- name: Codecov
63+
uses: codecov/codecov-action@v1

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ bin
3939

4040
# ARM tests
4141
qemu-arm-static
42+
43+
# Temporary output dir for artifacts
44+
mvn-artifacts

.travis.yml

-65
This file was deleted.

buildscripts/kokoro/unix.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,16 @@ if [[ -z "${SKIP_TESTS:-}" ]]; then
5757
exit 1
5858
fi
5959
# Run tests
60-
./gradlew build $GRADLE_FLAGS
60+
./gradlew build :grpc-all:jacocoTestReport $GRADLE_FLAGS
6161
pushd examples
6262
./gradlew clean $GRADLE_FLAGS
6363
./gradlew build $GRADLE_FLAGS
6464
# --batch-mode reduces log spam
6565
mvn verify --batch-mode
6666
popd
67+
pushd examples/example-alts
68+
../gradlew build $GRADLE_FLAGS
69+
popd
6770
pushd examples/example-hostname
6871
../gradlew build $GRADLE_FLAGS
6972
mvn verify --batch-mode

0 commit comments

Comments
 (0)