add a Makefile (#191)

* add a Makefile

Based on advice from IRC, a makefile helps downstream packagers
understand how to build the software.

Signed-off-by: Xe Iaso <me@xeiaso.net>

* Apply review suggestions

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso 2025-04-02 19:57:28 -04:00 committed by GitHub
parent 573dfd099f
commit 266d8c0cc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 34 additions and 4 deletions

25
Makefile Normal file
View File

@ -0,0 +1,25 @@
NODE_MODULES = node_modules
.PHONY: build assets deps lint test
$(NODE_MODULES):
npm run assets
assets: $(NODE_MODULES)
deps: assets
npm ci
go mod download
build: deps
npm run build
@echo "Anubis is now built to ./var/anubis"
all: build
lint:
go vet ./...
staticcheck ./...
test:
npm run test

View File

@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Disabled running integration tests on Windows hosts due to it's reliance on posix features (see [#133](https://github.com/TecharoHQ/anubis/pull/133#issuecomment-2764732309)). - Disabled running integration tests on Windows hosts due to it's reliance on posix features (see [#133](https://github.com/TecharoHQ/anubis/pull/133#issuecomment-2764732309)).
- Added support for passing the ed25519 signing key in a file with `-ed25519-private-key-hex-file` or `ED25519_PRIVATE_KEY_HEX_FILE`. - Added support for passing the ed25519 signing key in a file with `-ed25519-private-key-hex-file` or `ED25519_PRIVATE_KEY_HEX_FILE`.
- Fixed minor typos - Fixed minor typos
- Added a Makefile to enable comfortable workflows for downstream packagers.
- Added `zizmor` for GitHub Actions static analysis - Added `zizmor` for GitHub Actions static analysis
- Fixed most `zizmor` findings - Fixed most `zizmor` findings
- Enabled Dependabot - Enabled Dependabot

View File

@ -22,20 +22,23 @@ In order to build a production-ready binary of Anubis, you need the following pa
## Install dependencies ## Install dependencies
```text ```text
go mod download make deps
npm ci
``` ```
This will download Go and NPM dependencies.
## Building static assets ## Building static assets
```text ```text
npm run assets make assets
``` ```
This will build all static assets (CSS, JavaScript) for distribution.
## Building Anubis to the `./var` folder ## Building Anubis to the `./var` folder
```text ```text
go build -o ./var/anubis ./cmd/anubis make build
``` ```
From this point it is up to you to make sure that `./var/anubis` ends up in the right place. You may want to consult the `./run` folder for useful files such as a systemd unit and `anubis.env.default` file. From this point it is up to you to make sure that `./var/anubis` ends up in the right place. You may want to consult the `./run` folder for useful files such as a systemd unit and `anubis.env.default` file.

View File

@ -7,6 +7,7 @@
"test": "npm run assets && go test ./...", "test": "npm run assets && go test ./...",
"test:integration": "npm run assets && go test -v ./internal/test", "test:integration": "npm run assets && go test -v ./internal/test",
"assets": "go generate ./... && ./web/build.sh && ./xess/build.sh", "assets": "go generate ./... && ./web/build.sh && ./xess/build.sh",
"build": "npm run assets && go build -o ./var/anubis ../cmd/anubis",
"dev": "npm run assets && go run ./cmd/anubis --use-remote-address", "dev": "npm run assets && go run ./cmd/anubis --use-remote-address",
"container": "npm run assets && go run ./cmd/containerbuild" "container": "npm run assets && go run ./cmd/containerbuild"
}, },