-
Notifications
You must be signed in to change notification settings - Fork 4
119 lines (105 loc) · 3.91 KB
/
test_issue_blueprint.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
name: Test Blueprint Submission
on:
issues:
types: [ opened, reopened, edited ]
issue_comment:
types: [ created ]
jobs:
test_issue_blueprint:
# Run on issue creation and if /test-blueprint is commented
if: ${{ startsWith(github.event.issue.title, '[Blueprint]') && ( github.event_name == 'issues' || contains(github.event.comment.body, '/test-blueprint')) }}
runs-on: ubuntu-latest
steps:
# Check out repository
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: refs/heads/staging
persist-credentials: false
fetch-depth: 0
# Run script to parse issue
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install -r requirements.txt
- name: Parse Issue into Blueprint
env:
ISSUE_BODY: ${{ toJson(github.event.issue.body) }}
ISSUE_CREATOR: '${{ github.event.issue.user.login }}'
run: |
python entrypoint.py --parse-submission
- name: Run Pytest, write summary to workflow
if: always()
uses: dariocurr/pytest-summary@main
with:
paths: src/tests
options: --quiet
show: fail
# Comment on Issue with results if all passed
- name: Comment Successful Pytest Results
if: success()
uses: peter-evans/create-or-update-comment@5f728c3dae25f329afbe34ee4d08eef25569d79f
with:
issue-number: ${{ github.event.issue.number }}
body: |
# Validation Results
All tests passed succesfully. @CollinHeist will be along shortly to create the Blueprint with the `/create-blueprint` command.
- name: Comment Failing Pytest Results
if: failure()
uses: peter-evans/create-or-update-comment@5f728c3dae25f329afbe34ee4d08eef25569d79f
with:
issue-number: ${{ github.event.issue.number }}
body: |
# Validation Results
Validation has __failed__. See the [workflow summary](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
After correcting the Blueprint, new tests will be run automatically.
# Add labels for pass/failure
- name: Add Passing Label
if: success()
uses: actions/github-script@v7
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["passed-tests"]
})
- name: Add Failure Label
if: failure()
uses: actions/github-script@v7
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["failed-tests"]
})
# Remove old pass/failure labels
- name: Remove Success Label
if: ${{ failure() && contains(github.event.issue.labels.*.name, 'passed-tests') }}
uses: actions/github-script@v7
with:
script: |
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: ["passed-tests"]
})
- name: Remove Failure Label
if: ${{ success() && contains(github.event.issue.labels.*.name, 'failed-tests') }}
uses: actions/github-script@v7
with:
script: |
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: ["failed-tests"]
})