-
Notifications
You must be signed in to change notification settings - Fork 179
94 lines (82 loc) · 2.81 KB
/
analyses-snapshot-test.yaml
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
name: Analyses Snapshot Test
on:
workflow_dispatch:
inputs:
TARGET:
description: 'Target branch or tag'
required: true
default: 'edge'
TEST_SOURCE:
description: 'Target for the test code'
required: true
default: 'edge'
schedule:
- cron: '26 7 * * *' # 7:26 AM UTC
pull_request:
paths:
- 'api/**'
- 'shared-data/**/*'
- '!shared-data/js/**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-and-test:
timeout-minutes: 15
runs-on: ubuntu-latest
env:
TARGET: ${{ github.event.inputs.TARGET || github.head_ref || 'edge' }}
TEST_SOURCE: ${{ github.event.inputs.TEST_SOURCE || github.head_ref || 'edge' }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ env.TEST_SOURCE }}
- name: Docker Build
working-directory: app-testing
run: make build-opentrons-analysis
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pipenv'
cache-dependency-path: app-testing/Pipfile.lock
- name: Setup Python Dependencies
working-directory: app-testing
run: make setup
- name: Run Test
id: run_test
working-directory: app-testing
run: make snapshot-test
- name: Upload Report
if: '!cancelled()'
uses: actions/upload-artifact@v4
with:
name: test-report
path: app-testing/results/
- name: Handle Test Failure
if: failure()
working-directory: app-testing
run: make snapshot-test-update
- name: Create Snapshot update Request
id: create-pull-request
if: failure()
uses: peter-evans/create-pull-request@v5
with:
commit-message: 'fix(app-testing): snapshot failure capture'
title: 'fix(app-testing): snapshot failure capture'
body: 'This PR is an automated snapshot update request. Please review the changes and merge if they are acceptable or find you bug and fix it.'
branch: 'app-testing/${{ env.TARGET }}-from-${{ env.TEST_SOURCE}}'
base: ${{ env.TEST_SOURCE}}
- name: Comment on PR
if: failure() && github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const message = 'A PR has been opened to address analyses snapshot changes. Please review the changes here: https://github.com/${{ github.repository }}/pull/${{ steps.create-pull-request.outputs.pull-request-number }}';
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: message
});