Repository navigation
141 lines (136 loc) · 4.59 KB
/
Copy pathbuild.yaml
File metadata and controls
141 lines (136 loc) · 4.59 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
name: dapr-python
on:
push:
branches:
- main
- feature/*
pull_request:
branches:
- main
- release-*
- feature/*
workflow_dispatch:
merge_group:
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Python 3.10
uses: actions/setup-python@v7
with:
python-version: '3.10'
- name: Install uv
uses: astral-sh/setup-uv@v10.3.0
- name: Install dependencies
run: uv sync --frozen --all-packages --group dev
- name: Run Autoformatter
run: |
uv run ruff check --fix && uv run ruff format
statusResult=$(git status -u --porcelain)
if [ -z "$statusResult" ]
then
exit 0
else
echo "Source files are not formatted correctly. Run 'uv run ruff check --fix && uv run ruff format'."
exit 1
fi
- name: Check Typing
run: uv run mypy
- name: Verify main is on a .dev version
if: github.ref == 'refs/heads/main' || github.base_ref == 'main'
run: |
uv run python -c "
from importlib.metadata import version
package_version = version('dapr')
assert '.dev' in package_version, (
f'main version must contain .dev (got {package_version!r}); see RELEASE.md'
)
"
build:
needs: lint
runs-on: ${{ matrix.os }}
permissions:
contents: read
id-token: write # codecov OIDC upload auth
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python_version: "3.10"
tox_env: py310
- os: ubuntu-latest
python_version: "3.11"
tox_env: py311
- os: ubuntu-latest
python_version: "3.12"
tox_env: py312
- os: ubuntu-latest
python_version: "3.13"
tox_env: py313
- os: ubuntu-latest
python_version: "3.14"
tox_env: py314
- os: windows-latest
python_version: "3.10"
tox_env: py310
- os: windows-latest
python_version: "3.13"
tox_env: py313
- os: macos-latest
python_version: "3.10"
tox_env: py310
- os: macos-latest
python_version: "3.13"
tox_env: py313
steps:
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python_version }}
- name: Install uv
uses: astral-sh/setup-uv@v10.3.0
- name: Install dependencies
run: uv sync --frozen --all-packages --group dev
- name: Run unit-tests
# The suite takes a few minutes. Without a limit, a hung test holds the runner for
# GitHub's 6-hour default; faulthandler dumps every thread's stack after 5 minutes
# in one test, so the log shows where it hung.
timeout-minutes: 20
# Windows defaults to PowerShell, which only reports the last command's exit code, so a
# pytest failure was hidden behind a successful `coverage xml`. bash -e stops on it.
shell: bash
run: |
uv run coverage run -m pytest tests -m "not e2e" --ignore=tests/integration --ignore=tests/examples --import-mode=importlib -o faulthandler_timeout=300
uv run coverage xml
- name: Upload test coverage
uses: codecov/codecov-action@v7
with:
# Tokenless uploads are rejected on the protected main branch ("Token
# required because branch is protected"), which left codecov comparing
# PRs against a stale base. OIDC authenticates uploads from this repo;
# fork PRs still fall back to tokenless.
use_oidc: true
# Surface upload failures on branch pushes so the main base report
# can't silently go stale again, without letting codecov outages
# block PRs or the merge queue.
fail_ci_if_error: ${{ github.event_name == 'push' }}
# Single stable check name to mark as required in branch protection, so the
# required-checks list doesn't go stale when the build matrix changes.
# Skipped required checks count as passing, hence `if: always()` plus an
# explicit result check instead of relying on `needs` alone.
build-complete:
needs: build
if: always()
runs-on: ubuntu-latest
steps:
- name: Fail unless the whole build matrix succeeded
run: |
if [ "${{ needs.build.result }}" != "success" ]; then
echo "build matrix result: ${{ needs.build.result }}"
exit 1
fi