-
Notifications
You must be signed in to change notification settings - Fork 1
151 lines (127 loc) · 4.43 KB
/
autorun.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
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
---
name: autorun
on:
workflow_dispatch:
inputs:
branch:
description: 'The branch with changes e.g. "changes/xx/yyyyyy/zz"'
required: true
default: 'master'
jobs:
summary_info:
runs-on: ubuntu-latest
steps:
- name: Add Summary Information for Gerrit and repository branch
run: |
PR_NUMBER=$(echo "${{ github.event.inputs.branch }}" | cut -d '/' -f 3)
echo "### Change Information" >> $GITHUB_STEP_SUMMARY
echo "- **Gerrit Review**: https://review.spdk.io/gerrit/c/spdk/spdk/+/${GERRIT_REVIEW_URL}${PR_NUMBER}" >> $GITHUB_STEP_SUMMARY
echo "- **GitHub Branch**: https://github.com/${{ github.repository_owner }}/${{ vars.SPDK_REPOS_NAME }}/commits/${{ github.event.inputs.branch }}" >> $GITHUB_STEP_SUMMARY
source-archive:
runs-on: ubuntu-latest
container: ghcr.io/${{ github.repository_owner }}/spdk-community-ci:poc
steps:
- name: Checkout SPDK repository
uses: actions/[email protected]
with:
repository: ${{ github.repository_owner }}/${{ vars.SPDK_REPOS_NAME }}
ref: ${{ github.event.inputs.branch }}
token: ${{ secrets.GHPA_TOKEN }}
submodules: 'recursive'
fetch-depth: 0
path: spdk
- name: Create a tarball, of the repository, to preserve file permissions
run: |
cd spdk
tar -czf ../repository.tar.gz .
- name: Upload the repository as an artifact
uses: actions/[email protected]
with:
name: repository
path: repository.tar.gz
autorun_unittest:
needs: source-archive
timeout-minutes: 35
runs-on: [self-hosted, linux, x64, qemuhost]
env:
REPOSITORY_TARBALL_PATH: ${{ github.workspace }}/repository.tar.gz
container:
image: ghcr.io/${{ github.repository_owner }}/spdk-community-ci:poc
options: --privileged
steps:
- name: Runner-prep, clean up self-hosted left-overs
run: |
ls -lh
ps aux | grep qemu || true
pkill -f qemu || true
rm -rf $HOME/guests || true
rm -rf * || true
ps aux | grep qemu || true
ls -lh
- name: Setup CIJOE and pipx
run: |
pipx install cijoe -f
pipx ensurepath
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Checkout CI repository
uses: actions/[email protected]
with:
path: ci
- name: Download the SPDK repository
uses: actions/[email protected]
with:
name: repository
- name: qemu-guest, provision
run: |
cd ci/cijoe
cijoe guest_kill guest_bootimg guest_start guest_misc tgz_transfer tgz_unpack \
--monitor \
--config configs/qemuhost-with-guest-fedora-40.toml \
--workflow workflows/autorun_in_qemu.yaml \
--output report_prep_guest
- name: qemu-guest, autorun
run: |
cd ci/cijoe
cijoe autorun output_listing retrieve_autorun_output guest_shutdown \
--monitor \
--config configs/qemuhost-with-guest-fedora-40.toml \
--workflow workflows/autorun_in_qemu.yaml \
--output report_autorun
- name: Upload Artifacts
uses: actions/[email protected]
if: always()
with:
path: /tmp/autorun_output
name: autorun_unittest_artifacts
- name: Upload Report
uses: actions/[email protected]
if: always()
with:
path: |
ci/cijoe/report_autorun
ci/cijoe/report_prep_guest
name: report-autorun-in-qemu
report:
runs-on: ubuntu-latest
needs:
- source-archive
- autorun_unittest
if: always()
steps:
- name: Conditional behavior based on job status
run: |
set -e
PR_NUMBER=$(echo "${{ github.event.inputs.branch }}" | cut -d '/' -f 3)
REV=$(echo "${{ github.event.inputs.branch }}" | cut -d '/' -f 4)
if [[ "${{ needs.autorun_unittest.result }}" == "success" ]]; then
echo "All jobs succeeded."
VOTE=1
else
echo "One or more jobs failed."
VOTE=-1
fi
curl -X POST https://review.spdk.io/gerrit/a/changes/$PR_NUMBER/revisions/$REV/review \
-H "Content-Type: application/json" \
-d "{ 'message': '$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID', 'labels': {'Community-CI': $VOTE}}" \
--user "spdk-community-ci-samsung:${{ secrets.GERRIT_PASSWORD }}" \
--fail-with-body