lockbox

password manager
Log | Files | Refs | README | LICENSE

commit 20a38ad24ffcc5cd517e751cf14a778efd07daf3
parent 21fdd316515724234159014f13b3143702810dd1
Author: Sean Enck <sean@ttypty.com>
Date:   Thu, 17 Oct 2024 22:50:31 -0400

convert from make -> just

Diffstat:
M.github/workflows/build.yml | 10+++++-----
M.gitignore | 2+-
DMakefile | 33---------------------------------
MREADME.md | 6+++---
Ajustfile | 22++++++++++++++++++++++
Mtests/run.sh | 2+-
6 files changed, 32 insertions(+), 43 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml @@ -15,17 +15,17 @@ jobs: strategy: matrix: os: - - name: ubuntu-latest + - name: ubuntu-24.04 image: null - deps: "echo no deps" + deps: "sudo apt-get update && sudo apt-get install just" display: ubuntu - name: ubuntu-latest image: alpine:latest - deps: "apk add make" + deps: "apk add just" display: alpine - name: macos-latest image: null - deps: "echo no deps" + deps: "brew install just" display: macos runs-on: ${{ matrix.os.name }} name: ${{ matrix.os.display }} @@ -40,4 +40,4 @@ jobs: - name: "deps" run: ${{ matrix.os.deps }} - name: "build" - run: make check VERSION=${GITHUB_SHA} + run: just version=${GITHUB_SHA} check diff --git a/.gitignore b/.gitignore @@ -1,2 +1,2 @@ -build/ +target/ testdata/ diff --git a/Makefile b/Makefile @@ -1,33 +0,0 @@ -BUILD := build/ -TESTDIR := internal/ tests/ -TARGET := $(BUILD)lb -VERSION ?= $(shell git log -n 1 --format=%h) -VARS := LOCKBOX_ENV=none -DESTDIR := /usr/local/bin -GOFLAGS := -trimpath -buildmode=pie -mod=readonly -modcacherw -buildvcs=false - -all: $(TARGET) - -build: $(TARGET) - -$(TARGET): cmd/main.go internal/**/*.go go.* internal/app/doc/* internal/app/shell/* -ifeq ($(VERSION),) - $(error version not set) -endif - go build $(GOFLAGS) -ldflags "$(LDFLAGS) -X main.version=$(VERSION)" -o $@ cmd/main.go - -unittests: - $(VARS) go test ./... - -check: unittests runs - -runs: $(TARGET) - cd tests && $(VARS) ./run.sh - -clean: - @rm -rf $(BUILD) - @find $(TESTDIR) -type f -wholename "*testdata*" -delete - @find $(TESTDIR) -type d -empty -delete - -install: - install -m755 $(TARGET) $(DESTDIR)/lb diff --git a/README.md b/README.md @@ -121,11 +121,11 @@ Setup the `.gitattributes` for the repository to include ## build -Requires `make` +Requires `just` Clone this repository and: ``` -make +just ``` -_run `make check` to run tests_ +_run `just check` to run tests_ diff --git a/justfile b/justfile @@ -0,0 +1,22 @@ +goflags := "-trimpath -buildmode=pie -mod=readonly -modcacherw -buildvcs=false" +target := "target" +version := `git log -n 1 --format=%h` +object := target / "lb" +ldflags := env_var_or_default("LDFLAGS", "") + +default: build + +build: + mkdir -p "{{target}}" + go build {{goflags}} -ldflags "{{ldflags}} -X main.version={{version}}" -o "{{object}}" cmd/main.go + +unittest: + LOCKBOX_ENV=none go test ./... + +check: unittest build + cd tests && LOCKBOX_ENV=none ./run.sh + +clean: + rm -f "{{object}}" + find internal/ tests/ -type f -wholename "*testdata*" -delete + find internal/ tests/ -type d -empty -delete diff --git a/tests/run.sh b/tests/run.sh @@ -1,5 +1,5 @@ #!/bin/sh -LB_BINARY=../build/lb +LB_BINARY=../target/lb DATA="testdata/$1" ENV="$DATA/env" CLIP_WAIT=1