-
Notifications
You must be signed in to change notification settings - Fork 5
95 lines (88 loc) · 3.1 KB
/
generate-regressions.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
name: TestDriver.ai / Generate / Regressions
permissions:
actions: read
contents: write
pull-requests: write
on:
workflow_call:
inputs:
website-url:
type: string
required: true
description: The URL of the website to test
base-branch:
type: string
required: true
description: The branch name of the pull request
secrets:
key:
required: true
description: The TestDriver API key
GH_TOKEN:
required: true
description: The GitHub token
jobs:
gather-markdown-files:
name: Setup Test Matrix (./testdriver/generate/*.md)
runs-on: ubuntu-latest
outputs:
markdown_files: ${{ steps.markdown_list.outputs.files }}
steps:
- name: Check out repository
uses: actions/checkout@v2
with:
ref: ${{ inputs.base-branch }}
- name: Find all markdown files and extract filenames
id: markdown_list
run: |
FILES=$(ls ./testdriver/generate/*.md)
FILENAMES=$(basename -a $FILES | sed 's/\.md$//')
FILES_JSON=$(echo "$FILENAMES" | jq -R -s -c 'split("\n")[:-1]')
echo "::set-output name=files::$FILES_JSON"
test:
name: Run Regressions
needs: gather-markdown-files
runs-on: ubuntu-latest
strategy:
matrix:
markdown: ${{ fromJson(needs.gather-markdown-files.outputs.markdown_files) }}
fail-fast: false
name: ${{ matrix.markdown }} # Using just the filename
steps:
- name: Check out repository
uses: actions/checkout@v2
with:
ref: ${{ inputs.base-branch }}
- name: Display filename being tested
run: |
echo "Running job for file: ${{ matrix.markdown }}.md"
- name: Read file content into environment variable
id: read_file
run: |
CONTENT=$(cat ./testdriver/generate/${{ matrix.markdown }}.md)
echo "MARKDOWN_CONTENT<<EOF" >> $GITHUB_ENV
echo "$CONTENT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Extract current branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- uses: testdriverai/action@main
with:
key: ${{ secrets.key }}
prompt: |
${{ env.MARKDOWN_CONTENT }} # Use the content of the file from the environment
1. /summarize
prerun: |
cd $env:TEMP
npm init -y
npm install dashcam-chrome
Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "--start-maximized", "--load-extension=$(pwd)/node_modules/dashcam-chrome/build", "${{ vars.TESTDRIVER_WEBSITE }}"
exit
create-pr: true
pr-title: "TestDriver.ai / Generate Test / ${{ matrix.markdown }}"
pr-branch: testdriver/regression-${{ matrix.markdown }}-${{ github.run_id }}-${{ github.run_attempt }}
pr-test-filename: ${{matrix.markdown}}.yml
env:
FORCE_COLOR: "3"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}