-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathjustfile
More file actions
160 lines (137 loc) · 3.93 KB
/
Copy pathjustfile
File metadata and controls
160 lines (137 loc) · 3.93 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
export PATH := x"$PATH:$HOME/.local/bin"
tested_python_versions := "3.10 3.11 3.12 3.13"
default:
@just --list
[arg("docs",long,value="1")]
install-debian-deps docs="0":
#!/usr/bin/env bash
set -euo pipefail
apt-get update -qq
apt-get install -y --no-install-recommends \
curl \
git \
python3-dev \
python3-pip \
python3-venv \
nodejs \
npm \
g++ \
make \
yosys
if [[ {{docs}} == "1" ]];then apt-get install -y texlive-full imagemagick make chromium; fi
curl -LsSf https://astral.sh/uv/install.sh | sh
# Run all checks intended for execution before committing code.
pre-commit:
#!/usr/bin/env bash
set -euo pipefail
uv sync --extra lint
uv run pre-commit install
uv run pre-commit run --all-files
# Run all configured linting checks with correction.
lint:
#!/usr/bin/env bash
set -euo pipefail
uv sync --extra lint
uv run pre-commit run --all-files
# Run all configured linting checks.
test-lint:
#!/usr/bin/env bash
set -euo pipefail
uv sync --extra lint
source .venv/bin/activate
uv run pre-commit run check-yaml-extension --all-files
uv run ruff format --check
uv run ruff check
uv run codespell
# Run static type checking using Pyright.
[arg("compare",long,value="1")]
pyright compare="0":
#!/usr/bin/env bash
set -euo pipefail
uv sync --extra tests
if [[ {{compare}} == "1" ]];then uv run scripts/pyright_check.py --compare; else uv run scripts/pyright_check.py; fi
# Execute tests for a specific Python version.
test version="3.10":
#!/usr/bin/env bash
set -euo pipefail
uv sync --python python{{version}} --extra tests
uv run pytest \
-rs \
--cov-report html:cov_html \
--cov=topwrap \
--cov-config=pyproject.toml \
tests
# Execute tests on every Python version supported in CI.
test-all-python-versions:
#!/usr/bin/env bash
set -euo pipefail
for version in {{tested_python_versions}}; do
just test "$version"
done
# Update generated dataflow or specification test data.
[arg("dataflow",long,value="1")]
[arg("specification",long,value="1")]
update-testdata dataflow="0" specification="0":
#!/usr/bin/env bash
set -euo pipefail
uv sync --extra tests
if [[ {{dataflow}} == "1" ]];then uv run tests/update_test_data.py --dataflow; fi
if [[ {{specification}} == "1" ]];then uv run tests/update_test_data.py --specification; fi
# Run tests specific to the KPM server component.
test-kpm-server:
#!/usr/bin/env bash
set -euo pipefail
uv run scripts/kpm_server_check.py
# Remove locally cached files created by topwrap. target is one of "git", "kpm-build" or "all".
clean-cache target="all":
#!/usr/bin/env bash
uv sync
uv run topwrap clean-cache --target {{target}}
# Build the project.
build:
#!/usr/bin/env bash
set -euo pipefail
uv sync --extra deploy
uv run pyproject-build
# Create distributable packages.
package:
#!/usr/bin/env bash
set -euo pipefail
uv sync --extra deploy
source .venv/bin/activate
uv run .github/scripts/package_cores.py ./build/export
# Run examples
examples:
#!/usr/bin/env bash
set -euo pipefail
uv sync
source .venv/bin/activate
python3 -m ensurepip
EXAMPLES=(constant hdmi inout pwm soc)
for EXAMPLE in "${EXAMPLES[@]}"; do
pushd "$PWD"/examples/"$EXAMPLE"
make ci
popd
done
# Build docs
docs:
#!/usr/bin/env bash
set -euo pipefail
npm install -g @mermaid-js/mermaid-cli
uv sync --extra docs --extra tests
source .venv/bin/activate
shopt -s globstar
mkdir -p docs/build/kpm_jsons
for p in ./examples/**/Makefile; do
if [[ $p == *"/Caliptra/"* ]]; then continue; fi
DIR="$(dirname $p)"
NAME=$(echo "$DIR" | sed 's/.\/examples\///' | sed 's/\//_/')
cd $DIR
make kpm_spec.json kpm_dataflow.json
cd -
mv "$DIR/kpm_spec.json" "docs/build/kpm_jsons/spec_$NAME.json"
mv "$DIR/kpm_dataflow.json" "docs/build/kpm_jsons/data_$NAME.json"
done
make -C docs html
make -C docs latexpdf
cp docs/build/latex/topwrap.pdf docs/build/html