-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
50 lines (38 loc) · 1.35 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
## SPDX-FileCopyrightText: 2019 Shulhan <ms@kilabit.info>
## SPDX-License-Identifier: GPL-3.0-or-later
.PHONY: all lint test install build serve-doc
VERSION:=$(shell git describe --tags)
LDFLAGS:=-ldflags "-s -w -X 'git.sr.ht/~shulhan/ciigo.Version=$(VERSION)'"
DIR_BUILD:=_bin
all: test lint build
lint:
-fieldalignment ./...
-shadow ./...
-revive ./...
test:
find ./testdata -name "*.html" -delete
CGO_ENABLED=1 go test -failfast -v -race -p=1 -coverprofile=cover.out ./...
go tool cover -html=cover.out -o cover.html
install: build
mv _bin/ciigo $(GOBIN)
run-example:
DEBUG=1 go run ./cmd/ciigo-example
build:
mkdir -p $(DIR_BUILD)
CGO_ENABLED=0 go build $(LDFLAGS) -o $(DIR_BUILD) ./cmd/...
serve-doc:
go run ./cmd/ciigo serve _doc
.PHONY: chroot-setup chroot-test
chroot-setup:
sudo mkdir -p /var/lib/machines/arch.test
sudo pacstrap -c /var/lib/machines/arch.test base-devel systemd go
sudo mkdir /var/lib/machines/arch.test/root/ciigo
chroot-test:
sudo rsync -r . /var/lib/machines/arch.test/root/ciigo/
sudo systemd-nspawn --bind=/tmp \
--bind=$${HOME}/go/pkg:/root/go/pkg \
--bind=$${PWD}/../share:/root/share \
--bind=$${HOME}/.cache/go-build:/root/.cache/go-build \
-D /var/lib/machines/arch.test \
make -C /root/ciigo test
#sh -c "rm -rf /root/test; mkdir /root/test; stat /root/test; sleep 1; touch /root/test/file; stat /root/test"