-
Notifications
You must be signed in to change notification settings - Fork 5.1k
133 lines (133 loc) · 5.26 KB
/
commands-for-testing-tool.yml
File metadata and controls
133 lines (133 loc) · 5.26 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
name: Run Testing Tool Commands
on:
issue_comment:
types: [created]
jobs:
set-params:
# Only allow slash commands on pull request (not on issues)
if: ${{ github.event.issue.pull_request }}
runs-on: ubuntu-latest
outputs:
repo: ${{ steps.getref.outputs.repo }}
ref: ${{ steps.getref.outputs.ref }}
comment-id: ${{ steps.comment-info.outputs.comment-id }}
command: ${{ steps.regex.outputs.first_match }}
steps:
- name: Get PR repo and ref
id: getref
run: |
pr_info="$(curl ${{ github.event.issue.pull_request.url }})"
echo ref="$(echo $pr_info | jq -r '.head.ref')" >> $GITHUB_OUTPUT
echo repo="$(echo $pr_info | jq -r '.head.repo.full_name')" >> $GITHUB_OUTPUT
- name: Get comment id
id: comment-info
run: |
echo comment-id="${{ github.event.comment.id }}" >> $GITHUB_OUTPUT
- name: Get command
id: regex
uses: AsasInnab/regex-action@v1
with:
regex_pattern: "^/[a-zA-Z0-9_/-]+"
regex_flags: "i"
search_string: ${{ github.event.comment.body }}
helps-run:
runs-on: ubuntu-latest
if: |
needs.set-params.outputs.command == '/help-full' ||
needs.set-params.outputs.command == '/help' ||
needs.set-params.outputs.command == '/list-scenarios'
needs: set-params
steps:
- name: Update comment for processing
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ needs.set-params.outputs.comment-id }}
reactions: eyes, rocket
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Pull Testing Tool docker image
run: ./tools/bin/pull_image.sh -i airbyte/airbyte-e2e-testing-tool:latest
- name: Create input and output folders
run: |
mkdir secrets
mkdir result
- name: Run docker container with params
run: docker run -v $(pwd)/secrets:/secrets -v $(pwd)/result:/result airbyte/airbyte-e2e-testing-tool:latest ${{ github.event.comment.body }}
- name: Read file with results
id: read_file
uses: andstor/file-reader-action@v1
with:
path: "result/log"
- name: Add Success Comment
if: needs.set-params.outputs.comment-id && success()
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ needs.set-params.outputs.comment-id }}
body: |
> :white_check_mark: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
${{ steps.read_file.outputs.contents }}
reactions: +1
- name: Add Failure Comment
if: needs.set-params.outputs.comment-id && failure()
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ needs.set-params.outputs.comment-id }}
body: |
> :x: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
reactions: -1
scenarios-run:
runs-on: ubuntu-latest
if: |
needs.set-params.outputs.command == '/run-scenario' ||
needs.set-params.outputs.command == '/run-scenario-local'
needs: set-params
steps:
- name: Update comment for processing
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ needs.set-params.outputs.comment-id }}
reactions: eyes, rocket
- name: Checkout Airbyte
uses: actions/checkout@v3
with:
repository: ${{ needs.set-params.outputs.repo }}
ref: ${{ needs.set-params.outputs.ref }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Pull Testing Tool docker image
run: ./tools/bin/pull_image.sh -i airbyte/airbyte-e2e-testing-tool:latest
- name: Change wrapper permissions
run: |
mkdir secrets
mkdir result
- name: Run Airbyte
run: docker compose up -d
- name: Connect to secret manager
uses: jsdaniell/create-json@1.1.2
with:
name: "/secrets/service_account_credentials.json"
json: ${{ secrets.GCP_GSM_CREDENTIALS_FOR_TESTING_TOOL }}
- name: Run docker container with params
run: docker run -v $(pwd)/secrets:/secrets -v $(pwd)/result:/result airbyte/airbyte-e2e-testing-tool:latest ${{ github.event.comment.body }}
- name: Read file with results
id: read_file
uses: andstor/file-reader-action@v1
with:
path: "result/log"
- name: Add Success Comment
if: needs.set-params.outputs.comment-id && success()
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ needs.set-params.outputs.comment-id }}
body: |
> :white_check_mark: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
${{ steps.read_file.outputs.contents }}
reactions: +1
- name: Add Failure Comment
if: needs.set-params.outputs.comment-id && failure()
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ needs.set-params.outputs.comment-id }}
body: |
> :x: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
reactions: -1