Skip to content

Commit

Permalink
Set Up GitHub Actions CI and SNAPSHOT uploading (#440)
Browse files Browse the repository at this point in the history
This change sets up GitHub Actions as a parallel build CI to Travis (for now). GitHub Actions should build NullAway on MacOS X and Linux using JDK 8 and JDK 11, and on Windows using JDK 8. 

Additionally, this migrates snapshot uploading and coverage tracking to GitHub Actions, disabling the equivalent Travis CI events as they will likely conflict.

This also switches the Gradle plugin we were using for code coverage support and re-enabled coverage uploads to Coveralls (from GH Actions).

Finally, this includes a few tooling dependency upgrades, most notable an upgrade of the Android SDK and build-tools used to build this repo to v30.

See #408
  • Loading branch information
lazaroclapp committed Jan 5, 2021
1 parent 7164a48 commit eed3fc0
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .buildscript/check_git_clean.sh
@@ -0,0 +1,5 @@
if [ -n "$(git status --porcelain)" ]; then
echo 'warning: source tree contains uncommitted changes; .gitignore patterns may need to be fixed'
git status
false
fi
76 changes: 76 additions & 0 deletions .github/workflows/continuous-integration.yml
@@ -0,0 +1,76 @@
name: Continuous integration
on:
- push
jobs:
build:
name: "JDK ${{ matrix.java }} on ${{ matrix.os }}"
strategy:
matrix:
include:
- os: macos-latest
java: 8
- os: macos-latest
java: 11
- os: ubuntu-latest
java: 8
- os: ubuntu-latest
java: 11
- os: windows-latest
java: 8
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Check out NullAway sources
uses: actions/checkout@v2
- name: 'Set up JDK ${{ matrix.java }}'
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Build and test using Gradle and Java 8
uses: eskatos/gradle-command-action@v1
with:
arguments: verGJF build
if: matrix.java == '8'
- name: Build and test using Gradle and Java 11
uses: eskatos/gradle-command-action@v1
with:
arguments: :nullaway:test
if: matrix.java == '11'
- name: Report jacoco coverage
uses: eskatos/gradle-command-action@v1
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
with:
arguments: jacocoTestReport coverallsJacoco
if: runner.os == 'Linux' && matrix.java == '8'
- name: Check that Git tree is clean after build and test
run: ./.buildscript/check_git_clean.sh
publish_snapshot:
name: 'Publish snapshot'
needs: [build]
if: github.event_name == 'push' && github.repository == 'uber/NullAway' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: 'Check out repository'
uses: actions/checkout@v2
- name: Cache Gradle caches
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-caches-
- name: Cache Gradle wrapper
uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradlew-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradlew-wrapper-
- name: 'Set up JDK 8'
uses: actions/setup-java@v1
with:
java-version: 8
- name: 'Publish'
env:
ORG_GRADLE_PROJECT_SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
run: ./gradlew clean uploadArchives
15 changes: 3 additions & 12 deletions .travis.yml
Expand Up @@ -13,25 +13,16 @@ android:
components:
- tools
- platform-tools
- build-tools-28.0.3
- android-28
- build-tools-30.0.3
- android-30

before_install:
- if [[ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ]]; then yes | sdkmanager "platforms;android-28"; fi
- if [[ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ]]; then yes | sdkmanager "platforms;android-30"; fi

script:
- if [[ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ]]; then ./gradlew verGJF build; fi
- if [[ "$TRAVIS_JDK_VERSION" == "openjdk11" ]]; then ./gradlew :nullaway:test; fi

after_success:
- .buildscript/deploy_snapshot.sh
- ./gradlew jacocoTestReport coveralls

env:
global:
- secure: Gmj9s887BQhPfGA2IR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I2DVhNgBvQp1fUvEf5UD+gWr5Edh2tX6LsdzraXRgn13tULZ08aO+tTvTZUeSYpagrC9g6gQ6wq7gucmikOK/otw7+IPtOxR7DZ6qik60bvooqpaf439O2bVQh/cIwd6i8Afsf5sCAK+p54DfNBnED+03sIKcJD64IUiTFOFxjDGhwivsv/rf7/x3iyEZawWuQTP1rciDYlk9WvQjC3UkMFmT7zywa3PcFQjyn6yjNTy8plDaZ6ILXSyZTC6cW4rxy4iG3FKB+NnOfTC9tV/Z0/78=

notifications:
email: false

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Expand Up @@ -28,8 +28,8 @@ plugins {
id "com.github.sherter.google-java-format" version "0.8"
id "net.ltgt.errorprone" version "0.7" apply false
id "com.github.johnrengelman.shadow" version "2.0.4" apply false
id 'com.github.kt3k.coveralls' version '2.6.3' apply false
id 'com.android.application' version '3.5.0' apply false
id "com.github.nbaztec.coveralls-jacoco" version "1.2.5" apply false
id "com.android.application" version "3.5.0" apply false
}

repositories {
Expand Down
6 changes: 3 additions & 3 deletions gradle/dependencies.gradle
Expand Up @@ -51,11 +51,11 @@ def build = [
commonscli : "commons-cli:commons-cli:${versions.commonscli}",

// android stuff
buildToolsVersion: "28.0.3",
compileSdkVersion: 28,
buildToolsVersion: "30.0.3",
compileSdkVersion: 30,
ci: "true" == System.getenv("CI"),
minSdkVersion: 16,
targetSdkVersion: 28,
targetSdkVersion: 30,

]

Expand Down
11 changes: 0 additions & 11 deletions jar-infer/nullaway-integration-test/build.gradle
Expand Up @@ -15,9 +15,6 @@
*/
plugins {
id "java"
// For code coverage:
id 'jacoco'
id 'com.github.kt3k.coveralls'
}

sourceCompatibility = "1.8"
Expand All @@ -38,11 +35,3 @@ test {
maxHeapSize = "1024m"
jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}"
}

// From https://github.com/kt3k/coveralls-gradle-plugin
jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
}
7 changes: 5 additions & 2 deletions nullaway/build.gradle
Expand Up @@ -20,7 +20,7 @@ plugins {
id "java"
// For code coverage:
id 'jacoco'
id 'com.github.kt3k.coveralls'
id 'com.github.nbaztec.coveralls-jacoco'
}

sourceCompatibility = "1.8"
Expand Down Expand Up @@ -113,10 +113,13 @@ jacoco {
toolVersion = "0.8.2"
}

// From https://github.com/kt3k/coveralls-gradle-plugin
jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
}

coverallsJacoco {
reportPath = "nullaway/build/reports/jacoco/test/jacocoTestReport.xml"
}

0 comments on commit eed3fc0

Please sign in to comment.