██████╗ ██████╗ █████╗ ██████╗████████╗██╗ ██████╗ █████╗ ██╗ ██╗ ██╗
██╔══██╗██╔══██╗██╔══██╗██╔════╝╚══██╔══╝██║██╔════╝██╔══██╗██║ ██║ ██║
██████╔╝██████╔╝███████║██║ ██║ ██║██║ ███████║██║ ██║ ██║
██╔═══╝ ██╔══██╗██╔══██║██║ ██║ ██║██║ ██╔══██║██║ ██║ ██║
██║ ██║ ██║██║ ██║╚██████╗ ██║ ██║╚██████╗██║ ██║███████╗███████╗██║
╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝╚══════╝╚═╝
TODO: add status badges for https://github.com/Practicalli/{{scm/repo}} workflows and issues
TODO: Provide a meaningful description of the project
Project created with deps-new and the practicalli/service template
Run the service (clojure.main)
clojure -M:run/service
Run the greet function (clojure.exec), optionally passing a :name
key and value as arguments
clojure -X:run/greet :name '"team name"'
List all the available project tasks using the make
help
make
This project uses
make
tasks to run the Clojure tests, kaocha test runner and package the service into an uberjar. TheMakefile
usesclojure
commands and arguments that can be used directly if not usingmake
.
Start the REPL with the Practicalli REPL Reloaded aliases to include the custom user
namespace (dev/user.clj
) which provides additional tools for development (IntegrantREPL, add-libs hotload, find-deps, Portal data inspector)
make repl
Evaluate (start)
expression at the repl prompt to start the service. Several mulog events should be published to the terminal window.
Connect a clojure aware editor and start developing the code, evaluating changes as they are made.
(refresh)
will reload any changed namespaces
The local nREPL server port will be printed, along with a help menu showing the REPL Reloaded tools available.
:dev/reloaded
alias should be included in the editor command (jack-in) to start a REPL
Using an editor with Clojure LSP (or clj-kondo) integration provides diagnostic feedback on syntax and idomatic code use, as that code is typed into the editor and throughout an entire project.
.lsp/config.edn
provides exclusions where diagnostic warnings add no value, e.g. ignore unused public function warnings where those functions are part of the external interface of the project.
Run unit tests of the service using the kaocha test runner
make test
If additional libraries are required to support tests, add them to the
:test/env
alias definition indeps.edn
make test-watch
will run tests on file save, although changes to template.edn
may require cancelling the test watch (Control-c) and restarting. test-watch requires Practicalli Clojure CLI Config :test/watch
alias.
Check the code format before pushing commits to a shared repository, using cljstyle to check the Clojure format, MegaLinter to check format of all other files and kaocha test runner to test the Clojure code.
Before running the pre-commit-check
- install cljstyle{target=_blank}
- MegaLinter runs in a Docker container, so ensure Docker is running
make pre-commit-check
Run cljstyle only
make format-check
runs cljstyle and and prints a report if there are errorsmake format-fix
updates all files if there are errors (check the changes made viagit diff
)
Run MegaLinter only
make lint
runs all configured linters in.github/config/megalinter.yaml
make lint-fix
as above and applies fixes
Run Kaocha test runner only
make test
runs all unit tests in the project, stopping at first failing testmake test-watch
detect file changes and run all unit tests in the project, stopping at first failing test
Build an uberjar to deploy the service as a jar file
make build-uberjar
make build-config
displays the tools.build configurationmake build-clean
deletes the build assets (target
directory)
make docker-build
make docker-down
shuts down all services started withdocker-build
make docker-build-clean
Or build and run the service via the multi-stage Dockerfile
configuration as part of a CI workflow.
Copyright © 2024 Practicalli