maintainer="Hoang Nguyen <folliekazetani@protonmail.com>"
pkgname=helm-unittest
pkgver=0.8.2
pkgrel=0
pkgdesc="Helm plugin to run unit test for Helm charts"
url="https://github.com/helm-unittest/helm-unittest"
arch="all"
license="MIT"
makedepends="go"
checkdepends="yq-go"
install="helm-unittest.pre-install"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/helm-unittest/helm-unittest/archive/refs/tags/v$pkgver.tar.gz
	fix-test-case-32bit.patch
	"
options="net" # download Go modules

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

build() {
	go build -v ./cmd/helm-unittest/
}

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

package() {
	install -Dm755 $pkgname "$pkgdir/usr/share/helm/plugins/unittest/bin/untt"

	cat <<-EOF > "$pkgdir/usr/share/helm/plugins/unittest/plugin.yaml"
	name: "unittest"
	version: "$pkgver"
	usage: "unittest for helm charts"
	description: "Unit test for helm chart in YAML with ease to keep your chart functional and robust."
	platformCommand:
	  - os: "$(go env GOOS)"
	    arch: "$(go env GOARCH)"
	    command: "\${HELM_PLUGIN_DIR}/bin/untt"
	EOF
}

sha512sums="
451f64a10ddef03b3a3cb3d6b84209978b051edb5d2c3086aab48cf37f4a5405536342c5d16b35d3b312d4e755c5e1141e4ff7a381e6d6153b90f62908e5f714  helm-unittest-0.8.2.tar.gz
500105396c20e3040e12dd0494dbf92e1d0fb01b0a51e3e0f47110ee5241ca9aabc5f5f056d44bf8e7a81a6de2f9c4771e6486e441fb14a0a265015367dd7c83  fix-test-case-32bit.patch
"
