-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
73 lines (64 loc) · 1.65 KB
/
Makefile
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
# SPDX-FileCopyrightText: 2024 Alec Delaney
#
# SPDX-License-Identifier: MIT
.PHONY: lint
lint:
@pre-commit run ruff --all-files
.PHONY: format
format:
@pre-commit run ruff-format --all-files
.PHONY: check
check:
@pre-commit run --all-files
.PHONY: docs
docs:
@sphinx-build -E -W -b html docs docs/_build
.PHONY: prepare
prepare: check test docs
.PHONY: test-prep
test-prep:
ifeq "$(OS)" "Windows_NT"
-@mkdir testmount
-@xcopy tests\assets\info_uf2.txt testmount
-@subst T: testmount
else ifeq "$(shell uname -s)" "Linux"
-@truncate testfs -s 1M
[email protected] -F12 -S512 testfs
-@mkdir testmount
-@sudo mount -o loop,user,umask=000 testfs testmount/
-@cp tests/assets/info_uf2.txt testmount/
else ifeq "$(shell uname -s)" "Darwin"
-@hdiutil create -size 512m -volname TESTMOUNT -fs FAT32 testfs.dmg
-@hdiutil attach testfs.dmg
-@cp tests/assets/info_uf2.txt /Volumes/TESTMOUNT
else
@echo "Current OS not supported"
@exit 1
endif
-@git clone https://github.com/adafruit/circuitpython tests/sandbox/circuitpython --depth 1
.PHONY: test
test:
-@"${MAKE}" test-prep --no-print-directory
-@"${MAKE}" test-run --no-print-directory
-@"${MAKE}" test-clean --no-print-directory
.PHONY:
test-run:
@coverage run -m pytest
-@coverage report
-@coverage html
.PHONY: test-clean
test-clean:
ifeq "$(OS)" "Windows_NT"
-@subst T: /d
-@python scripts\rmdir.py testmount
-@python scripts\rmdir.py tests\sandbox\circuitpython
else ifeq "$(shell uname -s)" "Linux"
-@sudo umount testmount
-@sudo rm -rf testmount
-@rm testfs -f
-@rm -rf tests/sandbox/circuitpython
else
-@hdiutil detach /Volumes/TESTMOUNT
-@rm testfs.dmg -f
-@rm -rf tests/sandbox/circuitpython
endif