-
Notifications
You must be signed in to change notification settings - Fork 13
82 lines (69 loc) · 3.05 KB
/
Copy pathci.yml
File metadata and controls
82 lines (69 loc) · 3.05 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
name: Run pytest on PRs
on:
pull_request_target:
branches:
- '**'
types: [opened, synchronize, reopened, labeled]
schedule:
- cron: '0 2 * * 0'
env:
CI_LABEL: "ci-ok"
DBT_BASE_URL: ${{ secrets.DBT_BASE_URL }}
DBT_API_KEY: ${{ secrets.DBT_API_KEY }}
DBT_JOB_ID: ${{ secrets.DBT_JOB_ID }}
DBT_ACCOUNT_ID: ${{ secrets.DBT_ACCOUNT_ID }}
DBT_PROJECT_ID: ${{ secrets.DBT_PROJECT_ID }}
DBT_ENV_ID: ${{ secrets.DBT_ENV_ID }}
permissions: write-all
jobs:
check-run-approval:
# Gate fork PRs behind the CI_LABEL
runs-on: ubuntu-latest
steps:
- name: "Strip label on synchronize/reopen for labeled fork PRs"
if: ${{ github.event_name == 'pull_request_target' && (github.event.action == 'synchronize' || github.event.action == 'reopened') && github.event.pull_request.head.repo.full_name != github.repository && contains(github.event.pull_request.labels.*.name, env.CI_LABEL) }}
run: |
echo "Synchronizing PR, removing '${{ env.CI_LABEL }}' label"
gh pr edit ${{ github.event.pull_request.number }} --remove-label ${{ env.CI_LABEL }} --repo ${{ github.repository }}
msg="All pull request updates require re-approval of CI. No CI will be run."
echo "::error::$msg"
exit 1
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Require '${{ env.CI_LABEL }}' label on fork PRs"
if: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository && !contains(github.event.pull_request.labels.*.name, env.CI_LABEL) }}
run: |
msg="Pull request is from a public fork but does not have the '${{ env.CI_LABEL }}' label. No CI will be run."
echo "::error::$msg"
exit 1
test:
needs: check-run-approval
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout code
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # astral-sh/setup-uv@v3
- name: Run pytest (parallel)
if: matrix.python-version != '3.13'
run: make test-parallel
- name: Run pytest (full)
if: matrix.python-version == '3.13'
run: make test-full | tee pytest-coverage.txt && exit ${PIPESTATUS[0]}
- name: Pytest coverage comment
if: matrix.python-version == '3.13'
uses: MishaKav/pytest-coverage-comment@1bdbba85fb74a2fdc1ec66383acec1091610f82b # MishaKav/pytest-coverage-comment@v1
with:
pytest-coverage-path: ./pytest-coverage.txt
title: Coverage Report
badge-title: Coverage
junitxml-path: ./coverage.xml