-
Notifications
You must be signed in to change notification settings - Fork 34
166 lines (140 loc) · 11.1 KB
/
kepubify.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
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
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
run: |
if [[ "${GITHUB_REF}" == "refs/tags/"* ]]; then
echo ::set-output name=version::${GITHUB_REF#refs/tags/}
else
echo ::set-output name=version::${GITHUB_SHA:0:7}
fi
- name: Build
run: |
echo "kepubify ${{steps.version.outputs.version}}"
mkdir build
- {name: Build - kepubify-linux-64bit,
uses: "docker://golang:1.17-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/kepubify-linux-64bit ./cmd/kepubify"}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: amd64}}
- {name: Build - kepubify-linux-32bit,
uses: "docker://golang:1.17-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/kepubify-linux-32bit ./cmd/kepubify"}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: 386}}
- {name: Build - kepubify-linux-arm,
uses: "docker://golang:1.17-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/kepubify-linux-arm ./cmd/kepubify"}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: arm, GOARM: 7}}
- {name: Build - kepubify-linux-armv6,
uses: "docker://golang:1.17-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/kepubify-linux-armv6 ./cmd/kepubify"}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: arm, GOARM: 6}}
- {name: Build - kepubify-linux-arm64,
uses: "docker://golang:1.17-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/kepubify-linux-arm64 ./cmd/kepubify"}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: arm64}}
- {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=${{steps.version.outputs.version}}\" -trimpath -o ./build/kepubify-darwin-64bit ./cmd/kepubify"}, env: {CGO_ENABLED: 0, GOOS: darwin, GOARCH: amd64}}
- {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=${{steps.version.outputs.version}}\" -trimpath -o ./build/kepubify-darwin-arm64 ./cmd/kepubify"}, env: {CGO_ENABLED: 0, GOOS: darwin, GOARCH: arm64}}
- {name: Build - kepubify-windows-64bit.exe,
uses: "docker://golang:1.17-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/kepubify-windows-64bit.exe ./cmd/kepubify"}, env: {CGO_ENABLED: 0, GOOS: windows, GOARCH: amd64}}
- {name: Build - kepubify-windows-32bit.exe,
uses: "docker://golang:1.17-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/kepubify-windows-32bit.exe ./cmd/kepubify"}, env: {CGO_ENABLED: 0, GOOS: windows, GOARCH: 386}}
- {name: Build - kepubify-windows-arm64.exe,
uses: "docker://golang:1.17-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/kepubify-windows-arm64.exe ./cmd/kepubify"}, env: {CGO_ENABLED: 0, GOOS: windows, GOARCH: arm64}}
- {name: Build - covergen-linux-64bit,
uses: "docker://golang:1.17-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/covergen-linux-64bit ./cmd/covergen"}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: amd64}}
- {name: Build - covergen-linux-32bit,
uses: "docker://golang:1.17-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/covergen-linux-32bit ./cmd/covergen"}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: 386}}
- {name: Build - covergen-linux-arm,
uses: "docker://golang:1.17-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/covergen-linux-arm ./cmd/covergen"}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: arm, GOARM: 7}}
- {name: Build - covergen-linux-armv6,
uses: "docker://golang:1.17-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/covergen-linux-armv6 ./cmd/covergen"}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: arm, GOARM: 6}}
- {name: Build - covergen-linux-arm64,
uses: "docker://golang:1.17-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/covergen-linux-arm64 ./cmd/covergen"}, env: {CGO_ENABLED: 0, GOOS: linux, GOARCH: arm64}}
- {name: Build - covergen-darwin-64bit,
uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/covergen-darwin-64bit ./cmd/covergen"}, env: {CGO_ENABLED: 0, GOOS: darwin, GOARCH: amd64}}
- {name: Build - covergen-darwin-arm64,
uses: "docker://golang:1.16-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/covergen-darwin-arm64 ./cmd/covergen"}, env: {CGO_ENABLED: 0, GOOS: darwin, GOARCH: arm64}}
- {name: Build - covergen-windows-64bit.exe,
uses: "docker://golang:1.17-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/covergen-windows-64bit.exe ./cmd/covergen"}, env: {CGO_ENABLED: 0, GOOS: windows, GOARCH: amd64}}
- {name: Build - covergen-windows-32bit.exe,
uses: "docker://golang:1.17-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -trimpath -o ./build/covergen-windows-32bit.exe ./cmd/covergen"}, env: {CGO_ENABLED: 0, GOOS: windows, GOARCH: 386}}
- {name: Build - covergen-windows-arm64.exe,
uses: "docker://golang:1.17-alpine", with: {entrypoint: go, args: "build -v -ldflags \"-s -w -X main.version=${{steps.version.outputs.version}}\" -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.17.5-main", with: {entrypoint: /crossbuild,
args: "--platforms linux/amd64 --build-cmd \"CGO_ENABLED=1 go build -v -ldflags '-s -w -X main.version=${{steps.version.outputs.version}}' -trimpath -o ./build/seriesmeta-linux-64bit ./cmd/seriesmeta\""}}
- {name: Build - seriesmeta-linux-arm,
uses: "docker://docker.elastic.co/beats-dev/golang-crossbuild:1.17.5-armhf", with: {entrypoint: /crossbuild,
args: "--platforms linux/armv7 --build-cmd \"CGO_ENABLED=1 go build -v -ldflags '-s -w -X main.version=${{steps.version.outputs.version}}' -trimpath -o ./build/seriesmeta-linux-arm ./cmd/seriesmeta\""}}
- {name: Build - seriesmeta-linux-arm64,
uses: "docker://docker.elastic.co/beats-dev/golang-crossbuild:1.17.5-arm", with: {entrypoint: /crossbuild,
args: "--platforms linux/arm64 --build-cmd \"CGO_ENABLED=1 go build -v -ldflags '-s -w -X main.version=${{steps.version.outputs.version}}' -trimpath -o ./build/seriesmeta-linux-arm64 ./cmd/seriesmeta\""}}
- {name: Build - seriesmeta-darwin-64bit,
uses: "docker://docker.elastic.co/beats-dev/golang-crossbuild:1.16.9-darwin-debian10", with: {entrypoint: /crossbuild,
args: "--platforms darwin/amd64 --build-cmd \"CGO_ENABLED=1 go build -v -ldflags '-s -w -X main.version=${{steps.version.outputs.version}}' -trimpath -o ./build/seriesmeta-darwin-64bit ./cmd/seriesmeta\""}}
- {name: Build - seriesmeta-windows-64bit.exe,
uses: "docker://docker.elastic.co/beats-dev/golang-crossbuild:1.17.5-main", with: {entrypoint: /crossbuild,
args: "--platforms windows/amd64 --build-cmd \"CGO_ENABLED=1 go build -v -ldflags '-s -w -X main.version=${{steps.version.outputs.version}}' -trimpath -o ./build/seriesmeta-windows-64bit.exe ./cmd/seriesmeta\""}}
- 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.version}}