forked from kruize/autotune
-
Notifications
You must be signed in to change notification settings - Fork 1
162 lines (142 loc) · 5.39 KB
/
test-on-comment.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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Kruize Remote monitoring functional tests
on:
issue_comment:
types: [created]
issue_type: [pull_request]
jobs:
functest:
if: contains(github.event.comment.body, 'run functional tests')
outputs:
workflow_url: ${{ steps.workflow_run_info.outputs.url }}
workflow_id: ${{ steps.workflow_run_info.outputs.id }}
runs-on: ubuntu-20.04
steps:
- name: Get workflow run info
run: |
echo "url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_OUTPUT
echo "id=$GITHUB_RUN_ID" >> $GITHUB_OUTPUT
echo "url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
echo "id=$GITHUB_RUN_ID"
id: workflow_run_info
- name: Debug Comment Content
run: echo "Comment :${{ github.event.comment.body }}"
- uses: actions/github-script@v6
id: get-pr
with:
script: |
const request = {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
}
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`)
try {
const result = await github.rest.pulls.get(request)
return result.data
} catch (err) {
core.setFailed(`Request failed with error ${err}`)
}
- name: Check out code
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/head
- name: Setup Minikube
uses: manusa/[email protected]
with:
minikube version: 'v1.16.0'
kubernetes version: 'v1.19.2'
- name: Build crc
run: |
echo Build crc
./build.sh -i autotune_operator:test_build
docker images | grep autotune
- name: Install Prometheus on minikube
run: |
echo Install Prometheus on minikube
cd scripts
./prometheus_on_minikube.sh -as
- name: Run Kruize remote monitoring functional tests on minikube
run: |
ps -ef | grep python
echo Running Kruize remote monitoring tests on minikube
cp ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml.old
sed -e "s/imagePullPolicy: Always/imagePullPolicy: IfNotPresent/g" ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml.old > ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml
cat ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml
cd tests
./test_autotune.sh -c minikube -i autotune_operator:test_build --testsuite=remote_monitoring_tests --resultsdir=${GITHUB_WORKSPACE}
- name: Capture ffdc logs
if: always()
run: |
./scripts/ffdc.sh -m crc -d ${GITHUB_WORKSPACE}/kruize_test_results
- name: Archive results
if: always()
run: |
cd ${GITHUB_WORKSPACE}
tar cvf kruize_test_results.tgz kruize_test_results
- name: Upload results
if: always()
uses: actions/upload-artifact@v3
with:
name: kruize_test_results
path: ./kruize_test_results.tar
retention-days: 2
reportFailure:
runs-on: ubuntu-latest
needs: [functest]
if: failure()
steps:
- name: Create comment
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }} Build(s) failed.
Workflow Run ID: [${{ needs.functest.outputs.workflow_id }}](${{ needs.functest.outputs.workflow_url }})
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})
reportCancelled:
runs-on: ubuntu-latest
needs: [functest]
if: cancelled()
steps:
- name: Create comment
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }} Build(s) cancelled.
Workflow Run ID: [${{ needs.functest.outputs.workflow_id }}](${{ needs.functest.outputs.workflow_url }})
`;
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: [functest]
if: success()
steps:
- name: Create comment
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
comment_body = `
@${{ github.actor }} Build(s) successful.
Workflow Run ID: [${{ needs.functest.outputs.workflow_id }}](${{ needs.functest.outputs.workflow_url }})
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})