mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-23 19:25:25 +03:00
testing/dstask: new aport
Personal task tracker designed to help you focus https://dstask.org/
This commit is contained in:
parent
2aea4ae768
commit
d88504baef
2 changed files with 108 additions and 0 deletions
58
testing/dstask/APKBUILD
Normal file
58
testing/dstask/APKBUILD
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
# Contributor: Michał Polański <michal@polanski.me>
|
||||||
|
# Maintainer: Michał Polański <michal@polanski.me>
|
||||||
|
pkgname=dstask
|
||||||
|
pkgver=0.24.1
|
||||||
|
pkgrel=0
|
||||||
|
pkgdesc="Personal task tracker designed to help you focus"
|
||||||
|
url="https://dstask.org/"
|
||||||
|
license="MIT"
|
||||||
|
arch="all"
|
||||||
|
makedepends="go git"
|
||||||
|
subpackages="
|
||||||
|
$pkgname-import:_import
|
||||||
|
$pkgname-bash-completion
|
||||||
|
$pkgname-zsh-completion
|
||||||
|
"
|
||||||
|
source="https://github.com/naggie/dstask/archive/v$pkgver/dstask-$pkgver.tar.gz
|
||||||
|
integration-tests.patch
|
||||||
|
"
|
||||||
|
|
||||||
|
export GOPATH="$srcdir"
|
||||||
|
export GOFLAGS="$GOFLAGS -trimpath -modcacherw"
|
||||||
|
|
||||||
|
build() {
|
||||||
|
_git_commit=$(zcat "$srcdir"/$pkgname-$pkgver.tar.gz | git get-tar-commit-id)
|
||||||
|
_build_date=$(date -u "+%Y-%m-%dT%TZ" ${SOURCE_DATE_EPOCH:+-d @$SOURCE_DATE_EPOCH})
|
||||||
|
_ldflags="-s -w
|
||||||
|
-X github.com/naggie/dstask.GIT_COMMIT=$_git_commit
|
||||||
|
-X github.com/naggie/dstask.VERSION=$pkgver-r$pkgrel
|
||||||
|
-X github.com/naggie/dstask.BUILD_DATE=$_build_date
|
||||||
|
"
|
||||||
|
|
||||||
|
go build -ldflags="$_ldflags" -v -o bin/dstask ./cmd/dstask
|
||||||
|
go build -ldflags="$_ldflags" -v -o bin/dstask-import ./cmd/dstask-import
|
||||||
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
go test ./...
|
||||||
|
}
|
||||||
|
|
||||||
|
_import() {
|
||||||
|
pkgdesc="Import tool for dstask"
|
||||||
|
amove usr/bin/dstask-import
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
install -Dm755 bin/dstask "$pkgdir"/usr/bin/dstask
|
||||||
|
install -Dm755 bin/dstask-import "$pkgdir"/usr/bin/dstask-import
|
||||||
|
|
||||||
|
install -Dm644 .dstask-bash-completions.sh \
|
||||||
|
"$pkgdir"/usr/share/bash-completion/completions/$pkgname
|
||||||
|
install -Dm644 .dstask-zsh-completions.sh \
|
||||||
|
"$pkgdir"/usr/share/zsh/site-functions/_$pkgname
|
||||||
|
}
|
||||||
|
|
||||||
|
sha512sums="
|
||||||
|
cd37e025620570d18d5fb7c47aa0e3174584828e71e58e2dc36dc7dd38bfcd5e96d8c924eb7391a2ef59b1dccdf8e514c6a64a009b20d03731378adcf6d82241 dstask-0.24.1.tar.gz
|
||||||
|
fefaca68b53248f77c09584393bb251af318704f0cf2cc79b927558a587aaaabda4d79c0d88836e1913d2697d2a3744f3fc760ab8ec4d36cb3957b61d9f68b40 integration-tests.patch
|
||||||
|
"
|
50
testing/dstask/integration-tests.patch
Normal file
50
testing/dstask/integration-tests.patch
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
Run integration tests against the dstask binary produced in the build step
|
||||||
|
|
||||||
|
diff --git a/integration/main_test.go b/integration/main_test.go
|
||||||
|
index 9464ba0..05539a5 100644
|
||||||
|
--- a/integration/main_test.go
|
||||||
|
+++ b/integration/main_test.go
|
||||||
|
@@ -4,7 +4,6 @@ import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
- "log"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"testing"
|
||||||
|
@@ -13,34 +12,12 @@ import (
|
||||||
|
"gotest.tools/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
-func TestMain(m *testing.M) {
|
||||||
|
- if err := compile(); err != nil {
|
||||||
|
- log.Fatalf("compile error: %v", err)
|
||||||
|
- }
|
||||||
|
- cleanup := func() {
|
||||||
|
- if err := os.Remove("dstask"); err != nil {
|
||||||
|
- log.Panic("could not remove integration test binary")
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- exitCode := m.Run()
|
||||||
|
- cleanup()
|
||||||
|
- os.Exit(exitCode)
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-func compile() error {
|
||||||
|
- // We expect to execute in the ./integration directory, and we will output
|
||||||
|
- // our test binary there.
|
||||||
|
- cmd := exec.Command("go", "build", "-mod=vendor", "-o", "./dstask", "../cmd/dstask/main.go")
|
||||||
|
- return cmd.Run()
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
// Create a callable closure that will run our test binary against a
|
||||||
|
// particular repository path. Any variables set in the environment will be
|
||||||
|
// passed to the test subprocess.
|
||||||
|
func testCmd(repoPath string) func(args ...string) ([]byte, *exec.ExitError, bool) {
|
||||||
|
return func(args ...string) ([]byte, *exec.ExitError, bool) {
|
||||||
|
- cmd := exec.Command("./dstask", args...)
|
||||||
|
+ cmd := exec.Command("../bin/dstask", args...)
|
||||||
|
env := os.Environ()
|
||||||
|
cmd.Env = append(env, fmt.Sprintf("DSTASK_GIT_REPO=%s", repoPath))
|
||||||
|
output, err := cmd.Output()
|
Loading…
Add table
Add a link
Reference in a new issue