-
Notifications
You must be signed in to change notification settings - Fork 22
65 lines (62 loc) · 2.23 KB
/
ci.yml
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
name: Test all the things
on:
push:
pull_request:
issue_comment:
types: [ created ]
permissions:
checks: write
pull-requests: read
contents: read
jobs:
ci:
if: (github.event.issue.pull_request && contains(github.event.comment.body, 'please rerun tests')) || !github.event.issue
runs-on: ubuntu-latest
name: Java ${{ matrix.java }}
strategy:
matrix:
java: [ 8, 11, 17, 21 ]
fail-fast: false
steps:
- name: Get PR branch
uses: xt0rted/pull-request-comment-branch@v2
id: comment-branch
if: github.event.issue.pull_request
- uses: actions/checkout@v3
if: (!github.event.issue)
- uses: actions/checkout@v3
with:
ref: ${{ steps.comment-branch.outputs.head_ref }}
if: github.event.issue.pull_request
- name: Set up JDK ${{ matrix.java }}
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
cache: 'gradle'
- name: Test
run: |
# Conditionally run different commands based on the Java version
if [[ "${{ matrix.java }}" == "8" ]]; then
./gradlew wrapper --gradle-version=8.4-rc-1 :agent:spec && ./gradlew wrapper --gradle-version=8.4-rc-1 agent:publishToMavenLocal
else
./travis-test.sh
fi
- name: Report status
if: github.event.issue.pull_request
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/$GITHUB_REPOSITORY/check-runs \
-f "name=Test all the things / Java ${{ matrix.java }}" -f "head_sha=${{ steps.comment-branch.outputs.head_ref }}" -f "status=completed" \
-f "output[title]=Requested test" -f "conclusion=success" -f "target_url=https://github.com/$GITHUB_REPOSITORY/actions/runs/${{ github.run_id }}" -f "output[summary]=Manually triggered test succeeded"