-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (103 loc) · 3 KB
/
ci.yml
File metadata and controls
115 lines (103 loc) · 3 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
name: CI
on:
push:
branches: [main]
paths-ignore: ["*.md", "docs/**", "LICENSE"]
pull_request:
branches: [main]
merge_group:
permissions:
contents: read
checks: write
pull-requests: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
commit-lint:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: amannn/action-semantic-pull-request@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- run: uv sync --group dev
- run: uv run ruff check .
- run: uv run ruff format --check .
- name: Type check
run: uv run ty check
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.14"]
include:
- os: ubuntu-latest
python-version: "3.14"
coverage: true
name: "Test (${{ matrix.os }}, Python ${{ matrix.python-version }})"
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- run: uv python install ${{ matrix.python-version }}
- run: uv sync --group dev --python ${{ matrix.python-version }}
- name: Run tests
run: >-
uv run pytest --junit-xml=test-results.xml
${{ matrix.coverage && '--cov=custom_components --cov-report=xml --cov-fail-under=80' || '' }}
- name: Publish test report
if: always()
uses: dorny/test-reporter@v3
with:
name: "Tests (${{ matrix.os }}, Python ${{ matrix.python-version }})"
path: test-results.xml
reporter: java-junit
- name: Write summary
if: always()
shell: bash
run: |
echo "## Test Results — ${{ matrix.os }}, Python ${{ matrix.python-version }}" >> "$GITHUB_STEP_SUMMARY"
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- run: uv build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 7
markdown:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
- uses: DavidAnson/markdownlint-cli2-action@v23
ci-pass:
if: always()
needs: [commit-lint, lint, test, build, markdown]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Verify all jobs passed
run: |
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
echo "::error::One or more required jobs failed"
exit 1
fi
if [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
echo "::error::One or more required jobs were cancelled"
exit 1
fi