-
Notifications
You must be signed in to change notification settings - Fork 60
73 lines (70 loc) · 3.29 KB
/
pr.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: pull request flow
on: pull_request
jobs:
gradle-java8:
name: Java 8 build
runs-on: ubuntu-latest
steps:
# see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions
# for more context objects you can print for debugging builds
# - name: print github context
# env:
# GITHUB_CONTEXT: ${{ toJson(github) }}
# run: echo -e "$GITHUB_CONTEXT"
- name: checkout code
uses: actions/checkout@v2
with:
# checkout the PR head and not the merge branch at refs/pull/:prNumber/merge
# see https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull-request-event-pull_request
# for default PR checkout behaviour and https://github.com/actions/checkout for action docs
ref: ${{ github.event.pull_request.head.sha }}
# bring in all history because the gradle versions plugin needs to "walk back" to the closest ancestor tag
# to figure out what version this is. optimizing this is left as a challenge to future committers
fetch-depth: 0
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: create/restore gradle wrapper cache
# see inspiration here - https://docs.github.com/en/actions/language-and-framework-guides/building-and-testing-java-with-gradle#caching-dependencies
uses: actions/cache@v2
with:
path: ~/.gradle/wrapper
key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: create/restore gradle cache
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: gradle-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}
- name: Build with Gradle
# add --info or --debug below for more details when trying to understand issues
run: ./gradlew clean build javadoc --stacktrace --warning-mode all --no-daemon --parallel --scan
- name: Generate aggregate coverage report
run: ./gradlew codeCoverageReport --no-daemon
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./build/reports/jacoco/report.xml
- name: Upload coverage to Coveralls
# looks like its impossible to get this to work from a PR so long as a token is required to submit a coverage report.
# see https://github.community/t/make-secrets-available-to-builds-of-forks/16166 for more details
env:
# github actions not supported out-of-the-box (yet?). see https://github.com/kt3k/coveralls-gradle-plugin
CI_NAME: github-actions
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: ./gradlew coveralls --no-daemon
gradle-javaLatestLTS:
name: Latest Java LTS build
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Set up latest LTS JDK
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build with Gradle
run: ./gradlew clean build javadoc --stacktrace --warning-mode all --no-daemon