forked from adoptium/TKG
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (101 loc) · 3.73 KB
/
testTKG.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: "Run TKG Tests"
on:
issue_comment:
types: [created]
jobs:
testTKG:
runs-on: ubuntu-latest
if: startsWith(github.event.comment.body, 'run tkg-test')
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: refs/pull/${{ github.event.issue.number }}/head
- name: Set up JDK
uses: actions/setup-java@9704b39bf258b59bc04b50fa2dd55e9ed76b47a8 # v4.1.0
with:
distribution: 'temurin'
java-version: 11
- name: Create success comment
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }} TKG test build started, workflow Run ID: [${{ GITHUB.RUN_ID }}](${{ GITHUB.SERVER_URL }}/${{ GITHUB.REPOSITORY }}/actions/runs/${{ GITHUB.RUN_ID }})
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})
- name: parse options
env:
COMMENT_BODY: ${{ github.event.comment.body }}
run: |
echo "TKG_TEST_OPTIONS=`echo '${{ env.COMMENT_BODY }}' | sed 's/.*run tkg-test\(.*\)/\1/'`" >> $GITHUB_ENV
- name: run script
env:
TEST_JDK_HOME: ${{ env.JAVA_HOME }}
TEST_OPTIONS: ${{ env.TKG_TEST_OPTIONS }}
run: |
sudo apt-get install ant-contrib -y
cd scripts/testTKG
python testRunner.py $TEST_OPTIONS
reportFailure:
runs-on: ubuntu-latest
needs: [testTKG]
if: failure()
steps:
- name: Create comment
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }} Build(s) failed, workflow Run ID: [${{ GITHUB.RUN_ID }}](${{ GITHUB.SERVER_URL }}/${{ GITHUB.REPOSITORY }}/actions/runs/${{ GITHUB.RUN_ID }})
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})
reportCancel:
runs-on: ubuntu-latest
needs: [testTKG]
if: cancelled()
steps:
- name: Create comment
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }} Build(s) cancelled, workflow Run ID: [${{ GITHUB.RUN_ID }}](${{ GITHUB.SERVER_URL }}/${{ GITHUB.REPOSITORY }}/actions/runs/${{ GITHUB.RUN_ID }})
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})
reportSuccess:
runs-on: ubuntu-latest
needs: [testTKG]
if: success()
steps:
- name: Create comment
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }} Build(s) successful, workflow Run ID: [${{ GITHUB.RUN_ID }}](${{ GITHUB.SERVER_URL }}/${{ GITHUB.REPOSITORY }}/actions/runs/${{ GITHUB.RUN_ID }})
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})