summaryrefslogtreecommitdiff
path: root/testing/regal/APKBUILD
blob: 18ef837f9fb02a06e840ece6a524158af74e761b (plain)
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
51
52
53
54
# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=regal
pkgver=0.16.0
pkgrel=0
pkgdesc="Linter for Rego files"
url="https://docs.styra.com/regal"
arch="all"
license="Apache-2.0"
makedepends="go"
subpackages="
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/StyraInc/regal/archive/refs/tags/v$pkgver.tar.gz"
options="net" # download Go modules

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	local _goldflags="
	-X github.com/styrainc/regal/pkg/version.Version=v$pkgver
	-X github.com/styrainc/regal/pkg/version.Commit=AlpineLinux
	-X github.com/styrainc/regal/pkg/version.Timestamp=$(date -u "+%Y-%m-%dT%H:%M:%S%z" ${SOURCE_DATE_EPOCH:+-d @$SOURCE_DATE_EPOCH})
	-X github.com/styrainc/regal/pkg/version.Hostname=alpinelinux.org
	"

	go build -v -ldflags "$_goldflags" .

	for shell in bash fish zsh; do
		./regal completion $shell > regal.$shell
	done
}

check() {
	go test ./...
}

package() {
	install -Dm755 regal -t "$pkgdir"/usr/bin/

	install -Dm644 regal.bash \
		"$pkgdir"/usr/share/bash-completion/completions/regal
	install -Dm644 regal.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/regal.fish
	install -Dm644 regal.zsh \
		"$pkgdir"/usr/share/zsh/site-functions/_regal
}

sha512sums="
cc449e00507e3e645798fda02258330e0ab577e80d478b08dc29bdff4607c5311e9e12dd65e1a5cc6a0dddee5442e6b0c38216b276bd42b124e425b003671586  regal-0.16.0.tar.gz
"