maintainer="Hoang Nguyen <folliekazetani@protonmail.com>"
pkgname=vals
pkgver=0.41.0
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() {
	# 0.38.0: Test_HttpJson/Error_getting_document_from_location_jsonquery.LoadURL
	# fails at vals_httpjson_test.go:151
	# TestValues_.* tests require the running backend services
	# Tests in pkg/providers/k8s module requires a kubeconfig file with a locally running k8s cluster
	# shellcheck disable=2046
	go test -skip 'Test_HttpJson|TestValues_.*' \
		$(go list ./... | grep -v 'pkg/providers/k8s')
}

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

sha512sums="
40e50c00af035558a29d0267724302089daa6756a839ba95a145d86fbbc37f709449e698b640919cf8e6e143fca655d59527310bf43351e0396b2793da20edda  vals-0.41.0.tar.gz
"
