-
Notifications
You must be signed in to change notification settings - Fork 3
88 lines (80 loc) · 2.92 KB
/
yevis-test-pr-with-nig-gpu.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
name: "yevis-test-pr-with-nig-gpu"
on:
pull_request_target:
branches:
- main
types:
- opened
- synchronize
- reopened
issue_comment:
types:
- created
# https://docs.github.com/ja/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
permissions:
pull-requests: write
actions: read
jobs:
test:
runs-on: self-hosted
if: >
(github.event_name == 'issue_comment' &&
contains(github.event.comment.html_url, '/pull/') &&
startsWith(github.event.comment.body, '/re-run') &&
contains(github.event.issue.labels.*.name, 'nig-gpu')) ||
(github.event_name == 'pull_request_target' &&
contains(github.event.pull_request.labels.*.name, 'nig-gpu'))
steps:
- name: "Set environment variables"
id: set-env
run: |
if [[ "${{ github.event_name }}" == "issue_comment" ]]; then
echo "PR_URL=${{ github.event.issue.html_url }}" >> $GITHUB_ENV
echo "PR_NUM=${{ github.event.issue.number }}" >> $GITHUB_ENV
elif [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
echo "PR_URL=${{ github.event.pull_request.html_url }}" >> $GITHUB_ENV
echo "PR_NUM=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
fi
- name: "Run tests"
id: test
run: |
mkdir -p ./test-logs ./test-results
SAPPORO_RUN_DIR=${PWD}/test-results \
yevis test \
--verbose \
--fetch-ro-crate \
--from-pr ${PR_URL} \
--wes-location http://172.19.7.164:1122 \
2>&1 | tee ./test-logs/yevis-log.txt
exit ${PIPESTATUS[0]}
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "List test results"
run: ls -lR ./test-results > ./test-logs/test-results-list.txt
- name: "Upload test logs"
uses: actions/upload-artifact@v3
with:
name: yevis-test-logs
path: test-logs/*
if-no-files-found: ignore
- name: "Comment to the pull request"
run: |
if [[ "${{ steps.test.outcome }}" == "success" ]]; then
gh pr --repo ${{ github.repository }} edit ${PR_NUM} --remove-label invalid
else
gh pr --repo ${{ github.repository }} edit ${PR_NUM} --add-label invalid
fi
COMMENT=$(cat <<EOF
## Test results
- Test status: ${{ steps.test.outcome }}
- Test URL: https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}
- Test logs artifact: yevis-test-logs
EOF
)
gh pr --repo ${{ github.repository }} comment ${PR_NUM} --body "${COMMENT}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Check test status"
if: steps.test.outcome != 'success'
run: exit 1