Skip to content

3.x Switch from Travis CI to GitHub Actions #7114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/gradle_branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Branch

on:
push:
branches-ignore: [ '3.x' ]

jobs:
build:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build branch without snapshot
run: ./gradlew -PreleaseMode=pr build --stacktrace
- name: Upload to Codecov
uses: codecov/codecov-action@v1
31 changes: 31 additions & 0 deletions .github/workflows/gradle_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: PR

on:
pull_request:
branches: [ 3.x, 3.x_GHA ]

jobs:
build:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build PR
run: ./gradlew -PreleaseMode=pr build --stacktrace
- name: Upload to Codecov
uses: codecov/codecov-action@v1
49 changes: 49 additions & 0 deletions .github/workflows/gradle_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Release

on:
release:
branches: [ '3.x' ]
tags:
- 'v3.*.*'

jobs:
build:

runs-on: ubuntu-latest
env:
# Define secrets at https://github.com/ReactiveX/RxJava/settings/secrets/actions
# ------------------------------------------------------------------------------
bintrayUser: ${{ secrets.BINTRAY_USER }}
bintrayKey: ${{ secrets.BINTRAY_KEY }}
sonatypeUsername: ${{ secrets.SONATYPE_USER }}
sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
JAVADOCS_TOKEN: ${{ secrets.JAVADOCS_TOKEN }}
# ------------------------------------------------------------------------------
CI_BUILD_NUMBER: ${{ github.run_number }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Grant execute permission for push
run: chmod +x push_javadoc.sh
- name: Extract version tag
run: echo "BUILD_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: Build and Release
run: ./gradlew -PreleaseMode=full -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" build --stacktrace
- name: Upload to Codecov
uses: codecov/codecov-action@v1
- name: Push Javadocs
run: ./push_javadoc.sh
45 changes: 45 additions & 0 deletions .github/workflows/gradle_snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Snapshot

on:
push:
branches: [ '3.x' ]

jobs:
build:

runs-on: ubuntu-latest
env:
# Define secrets at https://github.com/ReactiveX/RxJava/settings/secrets/actions
# ------------------------------------------------------------------------------
bintrayUser: ${{ secrets.BINTRAY_USER }}
bintrayKey: ${{ secrets.BINTRAY_KEY }}
sonatypeUsername: ${{ secrets.SONATYPE_USER }}
sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
JAVADOCS_TOKEN: ${{ secrets.JAVADOCS_TOKEN }}
# ------------------------------------------------------------------------------
CI_BUILD_NUMBER: ${{ github.run_number }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Grant execute permission for push
run: chmod +x push_javadoc.sh
- name: Build and Snapshot branch
run: ./gradlew -PreleaseMode=branch -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" build --stacktrace
- name: Upload to Codecov
uses: codecov/codecov-action@v1
- name: Push Javadocs
run: ./push_javadoc.sh
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ext.githubProjectName = "rxjava"

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

def releaseTag = System.getenv("TRAVIS_TAG");
def releaseTag = System.getenv("BUILD_TAG");
if (releaseTag != null && !releaseTag.isEmpty()) {
if (releaseTag.startsWith("v")) {
releaseTag = releaseTag.substring(1);
Expand Down
29 changes: 0 additions & 29 deletions gradle/buildViaTravis.sh

This file was deleted.

28 changes: 8 additions & 20 deletions gradle/push_javadoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,9 @@
targetRepo=github.com/ReactiveX/RxJava.git
# =======================================================================

# only for main pushes, for now
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo -e "Pull request detected, skipping JavaDocs pushback."
exit 0
fi

# only when on the 3.x branch and not tagged
if [ "$TRAVIS_BRANCH" != "3.x" ] && [ "$TRAVIS_TAG" == "" ]; then
echo -e "On a secondary branch '$TRAVIS_BRANCH', skipping JavaDocs pushback."
exit 0
fi

# get the current build tag if any
buildTag="$TRAVIS_TAG"
echo -e "Travis tag: '$buildTag'"
buildTag="$BUILD_TAG"
echo -e "Build tag: '$buildTag'"

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

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

# prepare the git information
git config --global user.email "[email protected]"
git config --global user.name "Travis CI"
git config --global user.email "[email protected]"
git config --global user.name "akarnokd+ci"

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

# stash changes due to chmod
echo -e "Stashing any local non-ignored changes"
Expand Down Expand Up @@ -119,8 +107,8 @@ echo -e "Removing deleted files"
git add -u

# commit all
echo -e "commit Travis build: $TRAVIS_BUILD_NUMBER for $buildTag"
git commit --message "Travis build: $TRAVIS_BUILD_NUMBER for $buildTag"
echo -e "commit CI build: $CI_BUILD_NUMBER for $buildTag"
git commit --message "CI build: $CI_BUILD_NUMBER for $buildTag"

# debug file list
#find -name "*.html"
Expand Down