Skip to content

Commit c816e6f

Browse files
authored
3.x Switch from Travis CI to GitHub Actions (#7114)
* 3.x: Switch to GitHub Actions * Update action names
1 parent 5b408f6 commit c816e6f

8 files changed

+165
-79
lines changed

.github/workflows/gradle_branch.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow will build a Java project with Gradle
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
3+
4+
name: Branch
5+
6+
on:
7+
push:
8+
branches-ignore: [ '3.x' ]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up JDK 1.8
17+
uses: actions/setup-java@v1
18+
with:
19+
java-version: 1.8
20+
- name: Cache Gradle packages
21+
uses: actions/cache@v2
22+
with:
23+
path: ~/.gradle/caches
24+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
25+
restore-keys: ${{ runner.os }}-gradle
26+
- name: Grant execute permission for gradlew
27+
run: chmod +x gradlew
28+
- name: Build branch without snapshot
29+
run: ./gradlew -PreleaseMode=pr build --stacktrace
30+
- name: Upload to Codecov
31+
uses: codecov/codecov-action@v1

.github/workflows/gradle_pr.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow will build a Java project with Gradle
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
3+
4+
name: PR
5+
6+
on:
7+
pull_request:
8+
branches: [ 3.x, 3.x_GHA ]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up JDK 1.8
17+
uses: actions/setup-java@v1
18+
with:
19+
java-version: 1.8
20+
- name: Cache Gradle packages
21+
uses: actions/cache@v2
22+
with:
23+
path: ~/.gradle/caches
24+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
25+
restore-keys: ${{ runner.os }}-gradle
26+
- name: Grant execute permission for gradlew
27+
run: chmod +x gradlew
28+
- name: Build PR
29+
run: ./gradlew -PreleaseMode=pr build --stacktrace
30+
- name: Upload to Codecov
31+
uses: codecov/codecov-action@v1

.github/workflows/gradle_release.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This workflow will build a Java project with Gradle
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
3+
4+
name: Release
5+
6+
on:
7+
release:
8+
branches: [ '3.x' ]
9+
tags:
10+
- 'v3.*.*'
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
env:
17+
# Define secrets at https://github.com/ReactiveX/RxJava/settings/secrets/actions
18+
# ------------------------------------------------------------------------------
19+
bintrayUser: ${{ secrets.BINTRAY_USER }}
20+
bintrayKey: ${{ secrets.BINTRAY_KEY }}
21+
sonatypeUsername: ${{ secrets.SONATYPE_USER }}
22+
sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
23+
JAVADOCS_TOKEN: ${{ secrets.JAVADOCS_TOKEN }}
24+
# ------------------------------------------------------------------------------
25+
CI_BUILD_NUMBER: ${{ github.run_number }}
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Set up JDK 1.8
29+
uses: actions/setup-java@v1
30+
with:
31+
java-version: 1.8
32+
- name: Cache Gradle packages
33+
uses: actions/cache@v2
34+
with:
35+
path: ~/.gradle/caches
36+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
37+
restore-keys: ${{ runner.os }}-gradle
38+
- name: Grant execute permission for gradlew
39+
run: chmod +x gradlew
40+
- name: Grant execute permission for push
41+
run: chmod +x push_javadoc.sh
42+
- name: Extract version tag
43+
run: echo "BUILD_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
44+
- name: Build and Release
45+
run: ./gradlew -PreleaseMode=full -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" build --stacktrace
46+
- name: Upload to Codecov
47+
uses: codecov/codecov-action@v1
48+
- name: Push Javadocs
49+
run: ./push_javadoc.sh

.github/workflows/gradle_snapshot.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This workflow will build a Java project with Gradle
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
3+
4+
name: Snapshot
5+
6+
on:
7+
push:
8+
branches: [ '3.x' ]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
env:
15+
# Define secrets at https://github.com/ReactiveX/RxJava/settings/secrets/actions
16+
# ------------------------------------------------------------------------------
17+
bintrayUser: ${{ secrets.BINTRAY_USER }}
18+
bintrayKey: ${{ secrets.BINTRAY_KEY }}
19+
sonatypeUsername: ${{ secrets.SONATYPE_USER }}
20+
sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
21+
JAVADOCS_TOKEN: ${{ secrets.JAVADOCS_TOKEN }}
22+
# ------------------------------------------------------------------------------
23+
CI_BUILD_NUMBER: ${{ github.run_number }}
24+
steps:
25+
- uses: actions/checkout@v2
26+
- name: Set up JDK 1.8
27+
uses: actions/setup-java@v1
28+
with:
29+
java-version: 1.8
30+
- name: Cache Gradle packages
31+
uses: actions/cache@v2
32+
with:
33+
path: ~/.gradle/caches
34+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
35+
restore-keys: ${{ runner.os }}-gradle
36+
- name: Grant execute permission for gradlew
37+
run: chmod +x gradlew
38+
- name: Grant execute permission for push
39+
run: chmod +x push_javadoc.sh
40+
- name: Build and Snapshot branch
41+
run: ./gradlew -PreleaseMode=branch -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" build --stacktrace
42+
- name: Upload to Codecov
43+
uses: codecov/codecov-action@v1
44+
- name: Push Javadocs
45+
run: ./push_javadoc.sh

.travis.yml

-29
This file was deleted.

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ ext.githubProjectName = "rxjava"
4242

4343
version = project.properties["release.version"]
4444

45-
def releaseTag = System.getenv("TRAVIS_TAG");
45+
def releaseTag = System.getenv("BUILD_TAG");
4646
if (releaseTag != null && !releaseTag.isEmpty()) {
4747
if (releaseTag.startsWith("v")) {
4848
releaseTag = releaseTag.substring(1);

gradle/buildViaTravis.sh

-29
This file was deleted.

gradle/push_javadoc.sh

+8-20
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,9 @@
88
targetRepo=github.com/ReactiveX/RxJava.git
99
# =======================================================================
1010

11-
# only for main pushes, for now
12-
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
13-
echo -e "Pull request detected, skipping JavaDocs pushback."
14-
exit 0
15-
fi
16-
17-
# only when on the 3.x branch and not tagged
18-
if [ "$TRAVIS_BRANCH" != "3.x" ] && [ "$TRAVIS_TAG" == "" ]; then
19-
echo -e "On a secondary branch '$TRAVIS_BRANCH', skipping JavaDocs pushback."
20-
exit 0
21-
fi
22-
2311
# get the current build tag if any
24-
buildTag="$TRAVIS_TAG"
25-
echo -e "Travis tag: '$buildTag'"
12+
buildTag="$BUILD_TAG"
13+
echo -e "Build tag: '$buildTag'"
2614

2715
if [ "$buildTag" == "" ]; then
2816
buildTag="snapshot"
@@ -33,18 +21,18 @@ fi
3321
echo -e "JavaDocs pushback for tag: $buildTag"
3422

3523
# check if the token is actually there
36-
if [ "$GITHUB_TOKEN" == "" ]; then
24+
if [ "$JAVADOCS_TOKEN" == "" ]; then
3725
echo -e "No access to GitHub, skipping JavaDocs pushback."
3826
exit 0
3927
fi
4028

4129
# prepare the git information
42-
git config --global user.email "[email protected]"
43-
git config --global user.name "Travis CI"
30+
git config --global user.email "[email protected]"
31+
git config --global user.name "akarnokd+ci"
4432

4533
# setup the remote
4634
echo -e "Adding the target repository to git"
47-
git remote add origin-pages https://${GITHUB_TOKEN}@${targetRepo} > /dev/null 2>&1
35+
git remote add origin-pages https://${JAVADOCS_TOKEN}@${targetRepo} > /dev/null 2>&1
4836

4937
# stash changes due to chmod
5038
echo -e "Stashing any local non-ignored changes"
@@ -119,8 +107,8 @@ echo -e "Removing deleted files"
119107
git add -u
120108

121109
# commit all
122-
echo -e "commit Travis build: $TRAVIS_BUILD_NUMBER for $buildTag"
123-
git commit --message "Travis build: $TRAVIS_BUILD_NUMBER for $buildTag"
110+
echo -e "commit CI build: $CI_BUILD_NUMBER for $buildTag"
111+
git commit --message "CI build: $CI_BUILD_NUMBER for $buildTag"
124112

125113
# debug file list
126114
#find -name "*.html"

0 commit comments

Comments
 (0)