From 2b4cbc343a0eff8a95b89393b7dc0d37963d2aaf Mon Sep 17 00:00:00 2001 From: Patrick Gaskin Date: Sat, 3 Jul 2021 11:18:46 -0400 Subject: [PATCH] all: Switch to GitHub Actions --- .appveyor.yml | 14 --- .drone.star | 113 ----------------------- .github/workflows/kepubify.yml | 158 +++++++++++++++++++++++++++++++++ .travis.yml | 14 --- README.md | 2 +- 5 files changed, 159 insertions(+), 142 deletions(-) delete mode 100644 .appveyor.yml delete mode 100644 .drone.star create mode 100644 .github/workflows/kepubify.yml delete mode 100644 .travis.yml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 673437d..0000000 --- a/.appveyor.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: '{build}' - -image: Visual Studio 2019 - -build_script: -- cmd: C:\go116\bin\go.exe run -mod=readonly ./cmd/kepubify --help - -test_script: -- cmd: C:\go116\bin\go.exe test -mod=readonly -run "^TestMod_" github.com/pgaskin/kepubify/_/html/golang.org/x/net/html -v -- cmd: C:\go116\bin\go.exe test -mod=readonly -v ./kepub -- cmd: C:\go116\bin\go.exe test -mod=readonly -v ./cmd/kepubify -- cmd: C:\go116\bin\go.exe test -mod=readonly -tags zip117 -v ./cmd/kepubify - -deploy: off diff --git a/.drone.star b/.drone.star deleted file mode 100644 index ecae78f..0000000 --- a/.drone.star +++ /dev/null @@ -1,113 +0,0 @@ -go = "1.16.4" - -pipeline = [{ - "name": pname, - "kind": "pipeline", - "type": "docker", - "steps": [{ - "name": name, - "image": "golang:%s-buster" % (go), - "commands": [cmd], - } for (name, cmd) in psteps], - "trigger": { - "event": { - "exclude": ["promote"], - }, - }, - "depends_on": pdep, -} for (pname, psteps, pdep) in [ - ("kepub", [ - ("test-html", "go test -mod=readonly -run \"^TestMod_\" github.com/pgaskin/kepubify/_/html/golang.org/x/net/html -v"), - ("test", "go test -mod=readonly ./kepub -v -cover"), - ("test-zip117", "go test -mod=readonly -tags zip117 ./kepub -v -cover"), - ], []), - ("kepubify", [ - ("test", "go test -mod=readonly ./cmd/kepubify -v -cover"), - ("test-zip117", "go test -mod=readonly -tags zip117 ./cmd/kepubify -v -cover"), - ("run", "go run -mod=readonly ./cmd/kepubify --help"), - ], ["kepub"]), - ("covergen", [ - ("test", "go test -mod=readonly ./cmd/covergen -v -cover"), - ("run", "go run -mod=readonly ./cmd/covergen --help"), - ], []), - ("seriesmeta", [ - ("test", "go test -mod=readonly ./cmd/seriesmeta -v -cover"), - ("run", "go run -mod=readonly ./cmd/seriesmeta --help"), - ], []), -]] + [{ - "name": "release", - "kind": "pipeline", - "type": "docker", - "steps": [{ - "name": "notes", - "image": "golang:%s-buster" % (go), - "commands": [ - "mkdir -p build", - "git fetch --tags", - "git describe --tags --always | tee build/version", - "git log \"$(git describe --tags --abbrev=0 HEAD~1)..HEAD\" --oneline --format='%h %s' | tee build/notes.md", - ] - }] + [{ - "name": "x-%s-%s" % (app, platform.replace("/", "-")), - "image": "docker.elastic.co/beats-dev/golang-crossbuild:%s-%s" % (go, img), - "environment": { - "GO111MODULE": "on", - }, - "command": [ - "--platforms", platform, - "--build-cmd", "go env; CGO_ENABLED=%s go build -ldflags \"-s -w -X main.version=$(cat build/version)\" -tags zip117 -o \"build/%s%s\" %s" % (cgo, app, suffix, "./cmd/" + app), - ], - } for (img, platform, suffix) in [ - ("main", "linux/amd64", "-linux-64bit"), - ("main", "linux/386", "-linux-32bit"), - ("arm", "linux/armv6", "-linux-arm"), - ("arm", "linux/arm64", "-linux-arm64"), - ("darwin", "darwin/amd64", "-darwin-64bit"), - ("main", "windows/amd64", "-windows-64bit.exe"), - ("main", "windows/386", "-windows-32bit.exe"), - ] for (app, cgo) in [ - ("kepubify", "0"), - ("covergen", "0"), - ("seriesmeta", "1"), - ]] + [{ - "name": "ls", - "image": "golang:%s-buster" % (go), - "commands": [ - "apt update && apt install -y file", - "file build/*", - "ls -lah build/*", - ], - }, { - "name": "release", - "image": "plugins/github-release", - "settings": { - "api_key": { - "from_secret": "GITHUB_TOKEN", - }, - "notes": "build/notes.md", - "draft": True, - "files": [ - "build/kepubify*", - "build/covergen*", - "build/seriesmeta*", - ], - }, - }], - "trigger": { - "ref": [ - "refs/tags/v*", - ], - "event": { - "exclude": ["promote"], - }, - }, - "depends_on": [ - "kepub", - "kepubify", - "covergen", - "seriesmeta", - ], -}] - -def main(ctx): - return pipeline diff --git a/.github/workflows/kepubify.yml b/.github/workflows/kepubify.yml new file mode 100644 index 0000000..8e4de25 --- /dev/null +++ b/.github/workflows/kepubify.yml @@ -0,0 +1,158 @@ +name: kepubify + +on: [push, pull_request] + +jobs: + test: + name: test - Go ${{matrix.go}}${{fromJSON(format('["", " - {0}"]', matrix.tags))[matrix.tags != '']}} + runs-on: ubuntu-latest + + container: + image: golang:${{matrix.go}}-alpine3.13 + + strategy: + matrix: + go: + - 1.16 + - 1.17-rc + tags: + - "" + include: + - {go: 1.16, tags: zip117} + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Tools + run: apk update && apk add --no-cache wine freetype libpng gcc libc-dev + + - name: Build + run: go build${{fromJSON(format('["", " -tags {0}"]', matrix.tags))[matrix.tags != '']}} -v ./... + + - name: Test (kepub) + run: go test${{fromJSON(format('["", " -tags {0}"]', matrix.tags))[matrix.tags != '']}} -v -cover ./kepub + + - name: Test (kepubify) + run: go test${{fromJSON(format('["", " -tags {0}"]', matrix.tags))[matrix.tags != '']}} -v -cover ./cmd/kepubify + + - name: Test - Wine (kepub) + env: + WINEPREFIX: /tmp/wine + WINEDEBUG: -all + GOOS: windows + run: go test${{fromJSON(format('["", " -tags {0}"]', matrix.tags))[matrix.tags != '']}} -v -cover -exec wine64 ./kepub + + - name: Test - Wine (kepubify) + env: + WINEPREFIX: /tmp/wine + WINEDEBUG: -all + GOOS: windows + run: go test${{fromJSON(format('["", " -tags {0}"]', matrix.tags))[matrix.tags != '']}} -v -cover -exec wine64 ./cmd/kepubify + + - name: Benchmark (kepub) + run: go test${{fromJSON(format('["", " -tags {0}"]', matrix.tags))[matrix.tags != '']}} -bench=. -benchmem ./kepub + + - name: Run (kepubify) + run: go run${{fromJSON(format('["", " -tags {0}"]', matrix.tags))[matrix.tags != '']}} ./cmd/kepubify --help + + - name: Run (covergen) + run: go run${{fromJSON(format('["", " -tags {0}"]', matrix.tags))[matrix.tags != '']}} ./cmd/covergen --help + + - name: Run (seriesmeta) + run: go run${{fromJSON(format('["", " -tags {0}"]', matrix.tags))[matrix.tags != '']}} ./cmd/seriesmeta --help + + build-release: + name: build + runs-on: ubuntu-latest + + needs: + - test + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Version + id: version + if: startsWith(github.ref, 'refs/tags/v') + run: | + echo ::set-output name=tag::${GITHUB_REF#refs/tags/} + + - name: Build + run: | + mkdir build + + - {name: Build - kepubify-linux-64bit, + uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: build -tags zip117 -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/kepubify-linux-64bit ./cmd/kepubify}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: amd64, VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - kepubify-linux-32bit, + uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: build -tags zip117 -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/kepubify-linux-32bit ./cmd/kepubify}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: 386, VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - kepubify-linux-arm, + uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: build -tags zip117 -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/kepubify-linux-arm ./cmd/kepubify}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: arm, GOARM: 7, VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - kepubify-linux-arm64, + uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: build -tags zip117 -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/kepubify-linux-arm64 ./cmd/kepubify}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: arm64, VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - kepubify-darwin-64bit, + uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: build -tags zip117 -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/kepubify-darwin-64bit ./cmd/kepubify}, env: {CGO_ENABLED: 0, GOOS: darwin, GOARCH: amd64, VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - kepubify-darwin-arm64, + uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: build -tags zip117 -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/kepubify-darwin-arm64 ./cmd/kepubify}, env: {CGO_ENABLED: 0, GOOS: darwin, GOARCH: arm64, VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - kepubify-windows-64bit.exe, + uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: build -tags zip117 -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/kepubify-windows-64bit.exe ./cmd/kepubify}, env: {CGO_ENABLED: 0, GOOS: windows, GOARCH: amd64, VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - kepubify-windows-32bit.exe, + uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: build -tags zip117 -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/kepubify-windows-32bit.exe ./cmd/kepubify}, env: {CGO_ENABLED: 0, GOOS: windows, GOARCH: 386, VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - kepubify-windows-arm64.exe, + uses: "docker://golang:1.17-rc-alpine", with: {entrypoint: go, args: build -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/kepubify-windows-arm64.exe ./cmd/kepubify}, env: {CGO_ENABLED: 0, GOOS: windows, GOARCH: arm64, VER: "${{steps.version.outputs.tag}}"}} + + - {name: Build - covergen-linux-64bit, + uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: build -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/covergen-linux-64bit ./cmd/covergen}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: amd64, VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - covergen-linux-32bit, + uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: build -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/covergen-linux-32bit ./cmd/covergen}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: 386, VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - covergen-linux-arm, + uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: build -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/covergen-linux-arm ./cmd/covergen}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: arm, GOARM: 7, VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - covergen-linux-arm64, + uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: build -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/covergen-linux-arm64 ./cmd/covergen}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: arm64, VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - covergen-darwin-64bit, + uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: build -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/covergen-darwin-64bit ./cmd/covergen}, env: {CGO_ENABLED: 0, GOOS: darwin, GOARCH: amd64, VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - covergen-darwin-arm64, + uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: build -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/covergen-darwin-arm64 ./cmd/covergen}, env: {CGO_ENABLED: 0, GOOS: darwin, GOARCH: arm64, VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - covergen-windows-64bit.exe, + uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: build -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/covergen-windows-64bit.exe ./cmd/covergen}, env: {CGO_ENABLED: 0, GOOS: windows, GOARCH: amd64, VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - covergen-windows-32bit.exe, + uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: build -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/covergen-windows-32bit.exe ./cmd/covergen}, env: {CGO_ENABLED: 0, GOOS: windows, GOARCH: 386, VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - covergen-windows-arm64.exe, + uses: "docker://golang:1.17-rc-alpine", with: {entrypoint: go, args: build -v -ldflags "-s -w -X main.version=$VER" -trimpath -o ./build/covergen-windows-arm64.exe ./cmd/covergen}, env: {CGO_ENABLED: 0, GOOS: windows, GOARCH: arm64}} + + - {name: Build - seriesmeta-linux-64bit, + uses: "docker://docker.elastic.co/beats-dev/golang-crossbuild:1.16.4-main", with: {entrypoint: /crossbuild, + args: --platforms linux/amd64 --build-cmd "CGO_ENABLED=0 go build -v -ldflags '-s -w -X main.version=$VER' -trimpath -o ./build/seriesmeta-linux-64bit ./cmd/seriesmeta"}, env: {VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - seriesmeta-linux-arm, + uses: "docker://docker.elastic.co/beats-dev/golang-crossbuild:1.16.4-armhf", with: {entrypoint: /crossbuild, + args: --platforms linux/armv7 --build-cmd "CGO_ENABLED=0 go build -v -ldflags '-s -w -X main.version=$VER' -trimpath -o ./build/seriesmeta-linux-arm ./cmd/seriesmeta"}, env: {VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - seriesmeta-linux-arm64, + uses: "docker://docker.elastic.co/beats-dev/golang-crossbuild:1.16.4-arm", with: {entrypoint: /crossbuild, + args: --platforms linux/arm64 --build-cmd "CGO_ENABLED=0 go build -v -ldflags '-s -w -X main.version=$VER' -trimpath -o ./build/seriesmeta-linux-arm64 ./cmd/seriesmeta"}, env: {VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - seriesmeta-darwin-64bit, + uses: "docker://docker.elastic.co/beats-dev/golang-crossbuild:1.16.4-darwin", with: {entrypoint: /crossbuild, + args: --platforms darwin/amd64 --build-cmd "CGO_ENABLED=0 go build -v -ldflags '-s -w -X main.version=$VER' -trimpath -o ./build/seriesmeta-darwin-64bit ./cmd/seriesmeta"}, env: {VER: "${{steps.version.outputs.tag}}"}} + - {name: Build - seriesmeta-windows-64bit.exe, + uses: "docker://docker.elastic.co/beats-dev/golang-crossbuild:1.16.4-main", with: {entrypoint: /crossbuild, + args: --platforms windows/amd64 --build-cmd "CGO_ENABLED=0 go build -v -ldflags '-s -w -X main.version=$VER' -trimpath -o ./build/seriesmeta-windows-64bit.exe ./cmd/seriesmeta"}, env: {VER: "${{steps.version.outputs.tag}}"}} + + - name: List + run: | + cd build + ls -lah + file * + + - name: Upload + uses: actions/upload-artifact@v2 + with: + name: Build + path: build + + - name: Release + if: startsWith(github.ref, 'refs/tags/v') + run: | + gh release create --draft --title $VER $VER build/* + env: + GH_TOKEN: ${{secrets.GH_TOKEN}} + VER: ${{steps.version.outputs.tag}} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bf2e0df..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -os: -- osx - -language: go - -go: -- 1.16.x - -script: -- go run -mod=readonly ./cmd/kepubify --help -- go test -mod=readonly -run "^TestMod_" github.com/pgaskin/kepubify/_/html/golang.org/x/net/html -v -- go test -mod=readonly -v ./kepub -- go test -mod=readonly -v -tags zip117 ./kepub -- go test -mod=readonly -v ./cmd/kepubify diff --git a/README.md b/README.md index bcabab4..8b00abd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

kepubify

-[![](https://img.shields.io/github/v/release/pgaskin/kepubify)](https://github.com/pgaskin/kepubify/releases/latest) [![](https://img.shields.io/drone/build/pgaskin/kepubify/master)](https://cloud.drone.io/pgaskin/kepubify) [![](https://img.shields.io/drone/build/pgaskin/kepubify/master?label=linux%20build)](https://cloud.drone.io/pgaskin/kepubify) [![](https://img.shields.io/appveyor/ci/pgaskin/kepubify/master?label=windows%20build)](https://ci.appveyor.com/project/pgaskin/kepubify/branch/master) [![](https://img.shields.io/travis/com/pgaskin/kepubify/master?label=macOS%20build)](https://travis-ci.com/pgaskin/kepubify) ![](https://img.shields.io/github/go-mod/go-version/pgaskin/kepubify) [![](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/mod/github.com/pgaskin/kepubify/v4?tab=versions) [![](https://goreportcard.com/badge/github.com/pgaskin/kepubify)](https://goreportcard.com/report/github.com/pgaskin/kepubify) +[![](https://img.shields.io/github/v/release/pgaskin/kepubify)](https://github.com/pgaskin/kepubify/releases/latest) [![kepubify](https://github.com/pgaskin/kepubify/actions/workflows/kepubify.yml/badge.svg?branch=master)](https://github.com/pgaskin/kepubify/actions/workflows/kepubify.yml) ![](https://img.shields.io/github/go-mod/go-version/pgaskin/kepubify) [![](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/mod/github.com/pgaskin/kepubify/v4?tab=versions) [![](https://goreportcard.com/badge/github.com/pgaskin/kepubify)](https://goreportcard.com/report/github.com/pgaskin/kepubify) Kepubify converts EPUBs to KEPUBS. Kepubify also includes two standalone utilities which do not depend on kepubify (and don't conflict with Calibre): [covergen](./cmd/covergen)