build: add Makefile with common developer targets
Adds make help/test/check/build/static/hooks/commit/publish wrapping the documented commands and the git workflow, and links them from DEVELOPMENT.md.
This commit is contained in:
parent
c171bf3943
commit
0e4fe009a8
2 changed files with 69 additions and 0 deletions
63
Makefile
Normal file
63
Makefile
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
# Phoebus OS developer targets.
|
||||
#
|
||||
# make help list targets
|
||||
# make test run both test suites
|
||||
# make check fmt + clippy + tests
|
||||
# make commit MSG="feat(rust): ..."
|
||||
# make publish push to the configured remote
|
||||
|
||||
SHELL := /bin/bash
|
||||
|
||||
.PHONY: help test test-bash test-rust fmt fmt-check clippy check build static vm hooks commit publish clean
|
||||
|
||||
help:
|
||||
@printf 'Phoebus OS targets:\n'
|
||||
@printf ' make test run Bash + Rust test suites\n'
|
||||
@printf ' make test-bash fast Bash suite only\n'
|
||||
@printf ' make test-rust cargo test --workspace\n'
|
||||
@printf ' make fmt cargo fmt --all\n'
|
||||
@printf ' make check fmt-check + clippy + tests\n'
|
||||
@printf ' make build release Rust installer\n'
|
||||
@printf ' make static static Rust installer (live environment)\n'
|
||||
@printf ' make hooks enable the committed git hooks\n'
|
||||
@printf ' make commit MSG="..." stage, check and commit\n'
|
||||
@printf ' make publish push to the configured remote\n'
|
||||
|
||||
test: test-bash test-rust
|
||||
|
||||
test-bash:
|
||||
bash installer/tests/run_tests.sh
|
||||
|
||||
test-rust:
|
||||
cd installer-rs && cargo test --workspace
|
||||
|
||||
fmt:
|
||||
cd installer-rs && cargo fmt --all
|
||||
|
||||
fmt-check:
|
||||
cd installer-rs && cargo fmt --all -- --check
|
||||
|
||||
clippy:
|
||||
cd installer-rs && cargo clippy --workspace --all-targets
|
||||
|
||||
check: fmt-check clippy test
|
||||
|
||||
build:
|
||||
cd installer-rs && cargo build --release -p phoebus-installer
|
||||
|
||||
static:
|
||||
cd installer-rs && RUSTFLAGS="-C target-feature=+crt-static" \
|
||||
cargo build --release -p phoebus-installer --target x86_64-unknown-linux-gnu
|
||||
|
||||
hooks:
|
||||
scripts/setup-hooks.sh
|
||||
|
||||
commit:
|
||||
@if [ -z "$(MSG)" ]; then echo 'usage: make commit MSG="feat(...): ..."'; exit 2; fi
|
||||
scripts/agent-commit.sh "$(MSG)"
|
||||
|
||||
publish:
|
||||
scripts/publish.sh
|
||||
|
||||
clean:
|
||||
cd installer-rs && cargo clean
|
||||
|
|
@ -107,6 +107,12 @@ unsquashfs -l image.squashfs # file listing
|
|||
unsquashfs -d /tmp/root image.squashfs etc/portage/make.conf
|
||||
```
|
||||
|
||||
## Make targets
|
||||
|
||||
`make help` lists the common tasks. `make test`, `make check`, `make build`,
|
||||
`make static`, `make hooks`, `make commit MSG="..."` and `make publish` wrap the
|
||||
commands above and the git workflow.
|
||||
|
||||
## Quality gates before commit
|
||||
|
||||
1. `installer/tests/run_tests.sh`
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue