Skip to content
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

Setup GitHub Actions CI and SNAPSHOT uploading #440

Merged
merged 14 commits into from
Jan 5, 2021
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
5 changes: 5 additions & 0 deletions .buildscript/check_git_clean.sh
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could test the snapshot upload out by changing the branch here temporarily, and then changing it back. I'm also ok with just testing on 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-
Comment on lines +56 to +67
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using eskatos/gradle-command-action might reduce the boilerplate necessary to set up proper caching for Gradle builds.

https://github.com/eskatos is working for Gradle, so it's not some random 3rd party GitHub action.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Thanks! :)

- 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
Original file line number Diff line number Diff line change
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: Gmj9s887BQhPfGA2IRGBm0gusqS8L9ED8HnCUOge32fbL1huIjUx9xDfi9vsmecoIDQQOzRga33EcQCy1Yuba3KVuk2I8pk2z5OsMBf+1iR/qRO7/QNSCEqo9pTA8AVdNfpQqM6QLGpO064a1b7c35i/aRenUYDuIZlrVUhzr9v0QQ7QURjBsnQJkRd2Xb5AEDqlFQoaIRpnFlPl/B8sXQTiOratgnBp1kDm5tOZDZ6TqWdyLn0p3u4Qf6u8h6bJ3LUG0C7i48oS8qGwelZd0v1+GmivGI7bjbQw9ghBRjEIti9nW9bGkcYna1Q1EjkUJymJ4ilpKiSNEDwLtztEBiI3pSQ3NX1DJAdWsiA+XFQtId+Xi6b/u0R6VM4hCH0bWAtIASVafrY5Ad3tGbU0QMQENYoDI7odFoMwaWLMAJ3VtmfHrrDoqtBxFm2U37Lk3pDhulC9cx+elIwsQKY0s8p2V9UbWuXGgbIlcthqhST/+3CU+apwb2/Eq2DRF/gu05SnzEQnyjiL+XY8caF/qnVChD5j8LdoMaNCbzWG2qfHIxUtgIvGd/683pzshDbKW4CYST10Q5FFtsaCv6pMkCV+aLK53OQQY5PnfHPeIJQCqijcWFv+dS8mnx0WwvKhaVzGg97QX6p+Ok+9HAzkyovRwDLeGqcSlQQKyCXSW/A=
- secure: SiG/TzM0GQiwUrsW6Zq+5HirIxtiOOa/bjeBR50uzN2yOccK7ysqeLYNxgmO9Iu+76mMMccWfdSaP78YgjbY6aGoxGP3rOwt469AdUhXK+hslupKpnJI2UX0sYFl39mXmnHiRe/3W17aZA9NfinJyKJVBy2Bzm2aglN6kvHtS6qcBVGU35P0PIc6IwJQrJz17CcCEa7BVmKTGQPLXLQN8NrcCAjjiT5Egu3jJ6zEBzhk75xg63RM/SAV4gdRHJqo6JOZuGL9wIrvVZzc9s3jBB7BfJnSNw3W2A28JA5snfddyn+h+GTRFVhOywUToBNxplyPIiEwAkWsiAx1tpm1JPtI7tUN+TgLEj/qZgu0VIlC8jKuZ9JwtFUaprUaEGqQwiI/XjRuQYgFxiXqhqI2DVhNgBvQp1fUvEf5UD+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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/
plugins {
id "java"
// For code coverage:
id 'jacoco'
id 'com.github.kt3k.coveralls'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage plugin has multi-project support. But:
a) It's a bit convoluted
b) We have never had proper coverage support for JarInfer before (this bit above is long broken)
c) We mostly care about coverage for core NullAway

That said, it's worth having JarInfer coverage in the future as well, just not high priority.

}

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
Original file line number Diff line number Diff line change
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"
}