Skip to content

Commit

Permalink
chore: Move to use make targets in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisjared committed Oct 28, 2024
1 parent 030349a commit ba4e54e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,27 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- uses: ./.github/actions/setup
- name: mypy
run: MYPYPATH=stubs uv run mypy src
run: make mypy

pre-commit:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: pre-commit
run: make pre-commit

docs:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- uses: ./.github/actions/setup
- name: docs
run: uv run mkdocs build

Expand Down
21 changes: 9 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@ export PRINT_HELP_PYSCRIPT
help: ## print short description of each target
@python3 -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

.PHONY: checks
checks: ## run all the linting checks of the codebase
@echo "=== pre-commit ==="; uv run pre-commit run --all-files || echo "--- pre-commit failed ---" >&2; \
echo "=== mypy ==="; MYPYPATH=stubs uv run mypy packages || echo "--- mypy failed ---" >&2; \
echo "======"
.PHONY: pre-commit
pre-commit: ## run all the linting checks of the codebase
uv run pre-commit run --all-files


.PHONY: mypy
mypy: ## run mypy on the codebase
MYPYPATH=stubs uv run --package ref-core mypy packages/ref-core
MYPYPATH=stubs uv run --package ref-metrics-example mypy packages/ref-metrics-example

.PHONY: ruff-fixes
ruff-fixes: ## fix the code using ruff
# format before and after checking so that the formatted stuff is checked and
# the fixed stuff is formatted
uv run ruff format
uv run ruff check --fix
uv run ruff format

Expand All @@ -52,14 +53,10 @@ test-metrics-example: ## run the tests
test: test-core test-metrics-example ## run the tests

# Note on code coverage and testing:
# You must specify cov=src as otherwise funny things happen when doctests are
# involved.
# If you want to debug what is going on with coverage, we have found
# that adding COVERAGE_DEBUG=trace to the front of the below command
# can be very helpful as it shows you if coverage is tracking the coverage
# of all of the expected files or not.
# We are sure that the coverage maintainers would appreciate a PR that improves
# the coverage handling when there are doctests and a `src` layout like ours.

.PHONY: docs
docs: ## build the docs
Expand Down

0 comments on commit ba4e54e

Please sign in to comment.