build!: replace make with task (#171)

* build!: replace make with task

allows easy windows building (besides literally go build)
down the line because getting make on windows is dumb
and even if you do it probably wouldnt work as intended
on there

(i also find task more intuitive for simple things)

* ci: use task in build workflow instead of make

* style: remove whitespace errors in task file

* docs: add task in changelog

* docs: fix link to task

* docs: change message for task notice
lua-history
sammy 2022-07-09 08:44:53 -07:00 committed by GitHub
parent d27ce26be0
commit e0694c8862
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 31 deletions

View File

@ -26,8 +26,10 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: '1.17.7'
- name: Download Task
run: 'sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d'
- name: Build
run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} make
run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} ./bin/task
- uses: actions/upload-artifact@v2
if: matrix.goos == 'windows'
with:

View File

@ -1,6 +1,10 @@
# 🎀 Changelog
## Unreleased
**NOTE:** Hilbish now uses [Task] insead of Make for builds.
[Task]: https://taskfile.dev/#/
### Added
- Inline hints, akin to fish and the others.
To make a handler for hint text, you can set the `hilbish.hinter` function.

View File

@ -1,30 +0,0 @@
PREFIX ?= /usr
BINDIR ?= $(PREFIX)/bin
LIBDIR ?= $(PREFIX)/share/hilbish
MY_GOFLAGS = -ldflags "-s -w"
all: dev
dev: MY_GOFLAGS = -ldflags "-s -w -X main.gitCommit=$(shell git rev-parse --short HEAD) -X main.gitBranch=$(shell git rev-parse --abbrev-ref HEAD)"
dev: build
build:
go build $(MY_GOFLAGS)
install:
install -v -d "$(DESTDIR)$(BINDIR)/" && install -m 0755 -v hilbish "$(DESTDIR)$(BINDIR)/hilbish"
mkdir -p "$(DESTDIR)$(LIBDIR)"
cp -r libs docs emmyLuaDocs nature .hilbishrc.lua "$(DESTDIR)$(LIBDIR)"
grep -qxF "$(DESTDIR)$(BINDIR)/hilbish" /etc/shells || echo "$(DESTDIR)$(BINDIR)/hilbish" >> /etc/shells
uninstall:
rm -vrf \
"$(DESTDIR)$(BINDIR)/hilbish" \
"$(DESTDIR)$(LIBDIR)"
sed -i '/hilbish/d' /etc/shells
clean:
go clean
.PHONY: all dev build install uninstall clean

36
Taskfile.yaml 100644
View File

@ -0,0 +1,36 @@
# https://taskfile.dev
version: '3'
vars:
PREFIX: '{{default "/usr" .PREFIX}}'
bindir__: '{{.PREFIX}}/bin'
BINDIR: '{{default .bindir__ .BINDIR}}'
libdir__: '{{.PREFIX}}/share/hilbish'
LIBDIR: '{{default .libdir__ .LIBDIR}}'
GOFLAGS: '-ldflags "-s -w"'
tasks:
default:
cmds:
- go build {{.GOFLAGS}}
vars:
GOFLAGS: '-ldflags "-s -w -X main.gitCommit=$(git rev-parse --short HEAD) -X main.gitBranch=$(git rev-parse --abbrev-ref HEAD)"'
build:
cmds:
- go build {{.GOFLAGS}}
install:
cmds:
- install -v -d "{{.DESTDIR}}{{.BINDIR}}/" && install -m 0755 -v hilbish "{{.DESTDIR}}{{.BINDIR}}/hilbish"
- mkdir -p "{{.DESTDIR}}{{.LIBDIR}}"
- cp -r libs docs emmyLuaDocs nature .hilbishrc.lua {{.DESTDIR}}{{.LIBDIR}}
- grep -qxF "{{.DESTDIR}}{{.BINDIR}}/hilbish" /etc/shells || echo "{{.DESTDIR}}{{.BINDIR}}/hilbish" >> /etc/shells
uninstall:
cmds:
- rm -vrf
"{{.DESTDIR}}{{.BINDIR}}/hilbish"
"{{.DESTDIR}}{{.LIBDIR}}"
- sed -i '/hilbish/d' /etc/shells