-
Notifications
You must be signed in to change notification settings - Fork 293
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
Changes from all commits
b2e12f3
43c8a56
80187fd
ea3f82d
4cf8e7c
915e71c
b5eab42
f556ee5
bbf5e03
6607c96
4e316bb
a10762a
4a1966f
589d035
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
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' | ||
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,9 +15,6 @@ | |
*/ | ||
plugins { | ||
id "java" | ||
// For code coverage: | ||
id 'jacoco' | ||
id 'com.github.kt3k.coveralls' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coverage plugin has multi-project support. But: That said, it's worth having JarInfer coverage in the future as well, just not high priority. |
||
} | ||
|
||
sourceCompatibility = "1.8" | ||
|
@@ -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 | ||
} | ||
} |
There was a problem hiding this comment.
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.