-
Notifications
You must be signed in to change notification settings - Fork 12
107 lines (87 loc) · 2.8 KB
/
ci.yml
File metadata and controls
107 lines (87 loc) · 2.8 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
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
name: CI checks
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
merge_group:
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Required so we can lint commit messages.
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: DeterminateSystems/flake-checker-action@main
- name: Install uv
uses: astral-sh/setup-uv@v8.0.0
- name: Nix Format Check
run: nix fmt -- . --check
- name: Install the project
run: |
uv sync --all-extras --python 3.14
source .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Commit metadata
run: |
merge_base="$(git merge-base "origin/$GITHUB_BASE_REF" HEAD)" || {
echo >&2 "Failed to find fork point for origin/$GITHUB_BASE_REF."
exit 1
}
# Notes:
# * Merge commits are not checked. We always use rebases instead of
# merges to keep a linear history, which makes merge commits disappear
# ultimately, making them only a CI artifact which should not be
# checked.
scripts/lint_commits.py "$merge_base"
if: ${{ github.event_name == 'pull_request' }}
- name: License header check
run: scripts/license_check.py
- name: Dependency license check
run: |
# Ignore MPL 2.0 which is weak copy left
uv tool run licensecheck --zero --ignore-licenses "MPL 2.0" --requirements-paths ./pyproject.toml
- name: Lint with Ruff
run: |
ruff format --check
- name: Check with Ruff (All rules)
run: |
ruff check --statistics
continue-on-error: true
- name: Check with Ruff
run: |
ruff check --config=ruff-ci.toml --output-format=github
- name: Type check with pyright
run: |
pyright
continue-on-error: true
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.0.0
- name: Install the project
run: |
uv sync --all-extras --python ${{ matrix.python-version }}
source .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Test with pytest
run: |
pytest --strict