-
Notifications
You must be signed in to change notification settings - Fork 939
146 lines (126 loc) · 4.7 KB
/
integration_test.yml
File metadata and controls
146 lines (126 loc) · 4.7 KB
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
name: Integration Tests
on:
schedule:
# Run every day at 1AM UTC
- cron: '0 1 * * *'
pull_request:
issue_comment:
types: [created]
workflow_dispatch:
inputs:
filter:
description: 'Package filter (e.g. aws kafka). Leave empty to run all.'
required: false
default: ''
type: string
jobs:
integration-test:
if: ${{ github.event_name != 'issue_comment' && github.event.inputs.filter == '' && (github.event_name != 'pull_request' || startsWith(github.event.pull_request.title, 'build(deps)')) }}
runs-on: ubuntu-latest-32
env:
CGO_ENABLED: 0
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Install Task
uses: ./.github/actions/setup-task
- name: Pull Latest Redpanda Image
run: task docker:pull-redpanda
- name: Run Integration Tests
run: task test:integration -- --output-dir "${{ runner.temp }}/integration"
timeout-minutes: 120
- name: Write Summary
if: always()
run: |
if [ -f "${{ runner.temp }}/integration/index.md" ]; then
cat "${{ runner.temp }}/integration/index.md" >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload Test Output
if: always()
uses: actions/upload-artifact@v7
with:
name: integration-test-output
path: ${{ runner.temp }}/integration/
retention-days: 7
integration-test-filter:
if: >-
(github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/integration ')) ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.filter != '') ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'run-integration-tests'))
runs-on: ubuntu-latest-32
env:
CGO_ENABLED: 0
steps:
- name: Check commenter permissions
if: ${{ github.event_name == 'issue_comment' }}
env:
GH_TOKEN: ${{ github.token }}
run: |
PERMISSION=$(gh api "repos/${{ github.repository }}/collaborators/${{ github.event.comment.user.login }}/permission" --jq '.permission')
if [[ "${PERMISSION}" != "admin" && "${PERMISSION}" != "write" ]]; then
echo "::error::User ${{ github.event.comment.user.login }} does not have write access"
exit 1
fi
- name: Parse filter from comment
if: ${{ github.event_name == 'issue_comment' }}
id: parse
env:
COMMENT_BODY: ${{ github.event.comment.body }}
run: |
FILTER=$(echo "${COMMENT_BODY}" | sed 's|^/integration ||')
echo "filter=${FILTER}" >> "$GITHUB_OUTPUT"
- name: Checkout PR branch
if: ${{ github.event_name == 'issue_comment' }}
uses: actions/checkout@v6
with:
ref: refs/pull/${{ github.event.issue.number }}/merge
- name: Checkout code
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Checkout code
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/checkout@v6
- name: Detect changed packages
if: ${{ github.event_name == 'pull_request' }}
id: detect
run: |
FILTERS=$(
git diff --name-only "$(git merge-base HEAD origin/${{ github.base_ref }})"...HEAD \
| { grep '^internal/impl/' || true; } \
| cut -d/ -f3 \
| sort -u \
| tr '\n' ' '
)
echo "filters=${FILTERS}" >> "$GITHUB_OUTPUT"
- name: Install Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Install Task
uses: ./.github/actions/setup-task
- name: Pull Latest Redpanda Image
run: task docker:pull-redpanda
- name: Run Integration Tests
env:
FILTER: ${{ steps.parse.outputs.filter || steps.detect.outputs.filters || github.event.inputs.filter }}
run: task test:integration -- --output-dir "${{ runner.temp }}/integration" ${FILTER}
timeout-minutes: 30
- name: Write Summary
if: always()
run: |
if [ -f "${{ runner.temp }}/integration/index.md" ]; then
cat "${{ runner.temp }}/integration/index.md" >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload Test Output
if: always()
uses: actions/upload-artifact@v7
with:
name: integration-test-output
path: ${{ runner.temp }}/integration/
retention-days: 7