Skip to content

Commit

Permalink
Merge pull request #43 from tekktrik/dev/infrastructure
Browse files Browse the repository at this point in the history
Add additional infrastructure
  • Loading branch information
tekktrik committed Feb 24, 2024
2 parents 02fe5b5 + a6365ff commit 5cfe829
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 30 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,15 @@ jobs:
- name: Run pre-commit via make
run: |
make check
- name: Run pytest via coverage.py
- name: Prepare tests
run : |
make test-prep
- name: Run tests
run: |
make test
make test-run
- name: Clean up after tests
run: |
make test-clean
- name: Create coverage.py XML report
run: |
coverage xml -o coverage_${{ matrix.os }}_${{ matrix.py-version }}.xml
Expand Down
57 changes: 32 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,49 @@ format:
check:
@pre-commit run --all-files

.PHONY: test
test:
# Test setup
.PHONY: test-prep
test-prep:
ifeq "$(OS)" "Windows_NT"
@mkdir testmount
@xcopy tests\assets\info_uf2.txt testmount
@subst T: testmount
-@mkdir testmount
-@xcopy tests\assets\info_uf2.txt testmount
-@subst T: testmount
else ifeq "$(shell uname -s)" "Linux"
@truncate testfs -s 1M
@mkfs.vfat -F12 -S512 testfs
@mkdir testmount
@sudo mount -o loop,user,umask=000 testfs testmount/
@cp tests/assets/info_uf2.txt testmount/
-@truncate testfs -s 1M
-@mkfs.vfat -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
-@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

# Run tests
.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
-@coverage report
-@coverage html

# Test cleanup
.PHONY: test-clean
test-clean:
ifeq "$(OS)" "Windows_NT"
@subst T: /d
@python scripts/rmdir.py testmount
-@subst T: /d
-@python scripts/rmdir.py testmount
else ifeq "$(shell uname -s)" "Linux"
@sudo umount testmount
@sudo rm -rf testmount
@rm testfs
-@sudo umount testmount
-@sudo rm -rf testmount
-@rm testfs -f
else
@hdiutil detach /Volumes/TESTMOUNT
@rm testfs.dmg
-@hdiutil detach /Volumes/TESTMOUNT
-@rm testfs.dmg -f
endif
3 changes: 3 additions & 0 deletions circfirm/py.typed
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2024 Alec Delaney, for Adafruit Industries

SPDX-License-Identifier: MIT
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ classifiers = [
"Operating System :: Unix",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS",
"Typing :: Typed",
]
dynamic = ["version", "dependencies", "optional-dependencies"]

[project.urls]
Homepage = "https://github.com/tekktrik/circfirm"
Repository = "https://github.com/tekktrik/circfirm.git"
Issues = "https://github.com/tekktrik/circfirm/issues"

[project.scripts]
circfirm = "circfirm.cli:cli"
Expand All @@ -58,9 +60,6 @@ circfirm = "circfirm.cli:cli"
packages = ["circfirm"]
include-package-data = true

[tool.setuptools.package-data]
templates = ["*.yaml"]

[tool.setuptools.dynamic.version]
file = "VERSION"

Expand Down

0 comments on commit 5cfe829

Please sign in to comment.