-
Notifications
You must be signed in to change notification settings - Fork 24
56 lines (56 loc) · 2.1 KB
/
run-tests.yml
File metadata and controls
56 lines (56 loc) · 2.1 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
name: Run Tests
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch: {}
concurrency:
group: run-tests-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
run_tests:
name: Run tests
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check for non-markdown changes
id: filter
env:
GH_TOKEN: ${{ github.token }}
run: |
has_code=true
pr_number="${{ github.event.pull_request.number }}"
if [ -n "$pr_number" ] && files=$(gh api --paginate "repos/${{ github.repository }}/pulls/${pr_number}/files" --jq '.[].filename') && [ -n "$files" ]; then
has_code=false
while IFS= read -r file; do
if [[ ! "$file" =~ \.md$ ]]; then
has_code=true
break
fi
done <<< "$files"
fi
echo "has_code_changes=$has_code" >> "$GITHUB_OUTPUT"
- name: Checkout PR
if: steps.filter.outputs.has_code_changes == 'true'
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: Lint GitHub Actions workflows
if: steps.filter.outputs.has_code_changes == 'true'
uses: docker://rhysd/actionlint:1.7.12@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667
with:
args: -color
- name: Set up Python environment
if: steps.filter.outputs.has_code_changes == 'true'
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
enable-cache: true
cache-dependency-glob: requirements.txt
activate-environment: true
python-version: "3.12"
- name: Install dependencies
if: steps.filter.outputs.has_code_changes == 'true'
run: |
uv pip install -r requirements.txt
uv pip install 'pytest>=8,<9' 'pytest-subtests>=0.13,<1'
- name: Run webhook control-plane tests
if: steps.filter.outputs.has_code_changes == 'true'
run: python -m pytest tests