-
Notifications
You must be signed in to change notification settings - Fork 1.5k
152 lines (133 loc) · 4.77 KB
/
pr-test.yml
File metadata and controls
152 lines (133 loc) · 4.77 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
147
148
149
150
151
152
name: PR test
on:
workflow_call:
inputs:
repo:
required: true
type: string
setup-env-vars:
required: false
default: ""
type: string
python-version:
required: false
default: ""
type: string
pytest-args:
description: "Arguments to pass to pytest"
required: false
type: string
default: ""
jobs:
compute-matrix:
uses: ./.github/workflows/compute-matrix.yml
# this job always fails in the merge queue due to lack of
# github.event.pull_request.head.sha and github.event.pull_request.base.sha,
# and we don't run tests in the merge queue now so it's not needed
if: github.event_name != 'merge_group'
with:
repo: "${{ inputs.repo }}"
test:
needs:
- compute-matrix
if: needs.compute-matrix.outputs.matrix != '[]' && github.event_name != 'merge_group'
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.compute-matrix.outputs.matrix) }}
uses: ./.github/workflows/test-target.yml
with:
job-name: "${{ matrix.name }}"
target: "${{ matrix.target }}"
target-env: "${{ matrix.target-env }}"
platform: "${{ matrix.platform }}"
runner: "${{ toJson(matrix.runner) }}"
repo: "${{ inputs.repo }}"
context: "pr"
# Options
# We never test Python in integrations-core, but some partners may want to keep testing it
# in marketplace and integrations-extras.
test-py2: ${{ inputs.repo != 'core' && (!matrix.python-support || contains(matrix.python-support, '2')) }}
test-py3: ${{ !matrix.python-support || contains(matrix.python-support, '3') }}
# For other repositories
setup-env-vars: "${{ inputs.setup-env-vars }}"
python-version: "${{ inputs.python-version }}"
pytest-args: ${{ inputs.pytest-args }}
secrets: inherit
test-minimum-base-package:
needs:
- compute-matrix
if: needs.compute-matrix.outputs.matrix != '[]' && github.event_name != 'merge_group'
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.compute-matrix.outputs.matrix) }}
uses: ./.github/workflows/test-target.yml
with:
job-name: "minimum-base-package-${{ matrix.name }}"
target: "${{ matrix.target }}"
target-env: "${{ matrix.target-env }}"
platform: "${{ matrix.platform }}"
runner: "${{ toJson(matrix.runner) }}"
repo: "${{ inputs.repo }}"
minimum-base-package: true
# Options
# We never test Python in integrations-core, but some partners may want to keep testing it
# in marketplace and integrations-extras.
test-py2: ${{ inputs.repo != 'core' && (!matrix.python-support || contains(matrix.python-support, '2')) }}
test-py3: ${{ !matrix.python-support || contains(matrix.python-support, '3') }}
# For other repositories
setup-env-vars: "${{ inputs.setup-env-vars }}"
python-version: "${{ inputs.python-version }}"
pytest-args: ${{ inputs.pytest-args }}
context: "pr"
secrets: inherit
save-event:
needs:
- test
- test-minimum-base-package
if: success() || failure()
uses: ./.github/workflows/save-event.yml
upload-coverage:
needs:
- test
- test-minimum-base-package
if: >
!github.event.repository.private &&
(success() || failure()) &&
inputs.pytest-args != '-m flaky'
runs-on: ubuntu-latest
permissions:
# needed for codecov, allows the action to get a JWT signed by Github
id-token: write
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download all coverage artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: coverage-*
path: coverage-reports
merge-multiple: false
- name: Upload coverage to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de
with:
use_oidc: true
directory: coverage-reports
fail_ci_if_error: false
check:
needs:
- test
- test-minimum-base-package
# In integrations-core and integrations-extras repos the tests are flaky enough that
# it would be a pain to merge PRs with the Merge Queue enabled.
# While we work on the tests, we skip the job if it's triggered by Merge Queue.
# Github treats skipped jobs as successful, thus we unblock the Merge Queue.
if: always() && github.event_name != 'merge_group'
runs-on: ubuntu-latest
steps:
- name: Check status of required jobs
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}
allowed-skips: test, test-minimum-base-package