maintainer="Hoang Nguyen <folliekazetani@protonmail.com>"
pkgname=vals
pkgver=0.37.6
pkgrel=0
pkgdesc="Helm-like configuration values loader with support for various sources"
url="https://github.com/helmfile/vals"
arch="all"
license="Apache-2.0"
makedepends="go"
source="$pkgname-$pkgver.tar.gz::https://github.com/helmfile/vals/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() {
	go build -v \
		-o bin/$pkgname \
		-ldflags "-X main.version=v$pkgver -X main.commit=AlpineLinux" \
		./cmd/vals
}

check() {
	# TestValues_.* tests require the running backend services
	# Test_HttpJson test is flaky
	# Tests in pkg/providers/k8s module requires a kubeconfig file with a locally running k8s cluster
	# shellcheck disable=2046
	go test -skip 'TestValues_.*|Test_HttpJson' $(go list ./... | grep -v 'pkg/providers/k8s')
}

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

sha512sums="
cf6bd4640f3dc17a872a1d4c74ebbf313bc5daa25d21a3878c1c8efcf40e046ccd12681d3166eb54f6ca910e762ef034841f63eb90d6d390b95dbef986e8e086  vals-0.37.6.tar.gz
"
