diff options
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | build.yml | 7 | ||||
-rw-r--r-- | manager_test.go | 45 |
3 files changed, 5 insertions, 56 deletions
diff --git a/Makefile b/Makefile deleted file mode 100644 index 398cdc3..0000000 --- a/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -VERSION=v0.1.0 - -build: - go build -ldflags="-X 'main.Version=${VERSION}'" - -tar: build - git archive \ - -o midr-${VERSION}.tar.gz \ - --prefix=midr-${VERSION}/ HEAD @@ -2,7 +2,6 @@ image: alpine/latest packages: - rsync - - make - go sources: @@ -14,13 +13,17 @@ secrets: environment: deploy: builds@gabrielgio.me target: artifacts.gabrielgio.me/midr/ + VERSION: 0.1.0 GOPROXY: direct XZ_OPT: -9 tasks: - build: | cd midr - make tar + git archive \ + -o midr-${VERSION}.tar.gz \ + --prefix=midr-${VERSION}/ HEAD + - deploy: | cd midr sshopts="ssh -o StrictHostKeyChecking=no" diff --git a/manager_test.go b/manager_test.go deleted file mode 100644 index d0d2e35..0000000 --- a/manager_test.go +++ /dev/null @@ -1,45 +0,0 @@ -package main - -import ( - "errors" - "fmt" - "math/rand" - "os" - "strings" - "testing" - - "git.sr.ht/~gabrielgio/midr/yt" - "github.com/stretchr/testify/assert" -) - -const charset = "0123456789abcdef" - -func randomString(length int) string { - sb := strings.Builder{} - sb.Grow(length) - for i := 0; i < length; i++ { - sb.WriteByte(charset[rand.Intn(len(charset))]) - } - return sb.String() -} - -func exists(path string) bool { - _, err := os.Stat(path) - return !errors.Is(err, os.ErrNotExist) -} - -func TestDownloadProcess(t *testing.T) { - random := randomString(5) - tmp := fmt.Sprintf("/tmp/%s", random) - link := "https://www.youtube.com/watch?v=zGDzdps75ns" - yt.RunYtDlpProcess(link, tmp) - - full_tmp_path := fmt.Sprintf("%s/Small short test video.webm", tmp) - assert.True(t, exists(full_tmp_path), "it worked?") - - e := os.Remove(full_tmp_path) - if e != nil { - assert.FailNow(t, "File not removed properly") - } - -} |