diff --git a/.circleci/config.yml b/.circleci/config.yml index 36377a1..643685b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,16 +2,18 @@ version: 2 jobs: build: docker: - - image: circleci/golang:1.12 + - image: circleci/golang:1.15 steps: - checkout - - run: make compile + - run: sh -c "$(curl -ssL https://taskfile.dev/install.sh)" -- -d -b /usr/bin + - run: task cli-cover-report release: docker: - - image: circleci/golang:1.12 + - image: circleci/golang:1.15 steps: - checkout - - run: GO111MODULE=off go get -u github.com/gobuffalo/packr/v2/packr2 + - run: sh -c "$(curl -ssL https://taskfile.dev/install.sh)" -- -d -b /usr/bin + - run: task tools download-reveal - run: curl -sL https://git.io/goreleaser | bash workflows: version: 2 diff --git a/.gitignore b/.gitignore index 3d616ba..dced6f2 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,7 @@ goveal !goveal/ # gorelease -dist/ \ No newline at end of file +dist/ + +#Taskfile +.task/ \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index aab6240..768a5f9 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,11 +1,7 @@ project_name: goveal before: hooks: - - mkdir -p ./assets/reveal - - ./download_revealjs.sh - - go mod download - - go build -v ./... - - packr2 + - task test builds: - main: ./cmd/goveal/main.go binary: goveal diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..b7ee1f0 --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,85 @@ +version: '3' + +vars: + DEBUG_PORT: 2345 + REVEALJS_VERSION: 4.1.0 + BINARY_NAME: goveal + OUT_DIR: ./out + GO_BUILD_ARGS: -ldflags="-w -s" + CMD_PACKAGE: github.com/baez90/go-reveal-slides/cmd/goveal + +emv: + CGO_ENABLED: 0 + +tasks: + clean: + cmds: + - rm -f debug {{ .BINARY_NAME }} + - rm -rf ./dist {{ .OUT_DIR }} + - pkger clean + + format: + cmds: + - go fmt ./... + + deps: + sources: + - go.mod + - go.sum + cmds: + - go mod download + - go mod tidy + + test: + sources: + - ./**/*.go + deps: + - deps + cmds: + - go test -coverprofile={{ .OUT_DIR }}/cov-raw.out -v ./... + - cat {{ .OUT_DIR }}/cov-raw.out | grep -v "generated" > {{ .OUT_DIR }}/cov.out + + cli-cover-report: + cmds: + - go tool cover -func={{ .OUT_DIR }}/cov.out + + html-cover-report: + cmds: + - go tool cover -html={{ .OUT_DIR }}/cov.out -o {{ .OUT_DIR }}/coverage.html + + build: + deps: + - deps + sources: + - ./**/*.go + cmds: + - pkger + - go build {{ .GO_BUILD_ARGS }} -o {{ .BINARY_NAME }} {{ .CMD_PACKAGE }} + + run: + deps: + - deps + cmds: + - go run {{ .CMD_PACKAGE }} serve ./examples/slides.md + + debug: + cmds: + - dlv debug --headless --listen=127.10.10.2:{{ .DEBUG_PORT }} --api-version=2 {{ .CMD_PACKAGE }} --build-flags="-tags debug" -- serve --config ./examples/goveal.yaml ./examples/slides.md + + snapshot-release: + cmds: + - goreleaser --snapshot --skip-publish --rm-dist + + tools: + cmds: + - go get -u github.com/markbates/pkger/cmd/pkger + + download-reveal: + cmds: + - rm -rf ./assets/reveal + - mkdir -p ./assets/reveal + - curl -sL https://github.com/hakimel/reveal.js/archive/{{ .REVEALJS_VERSION }}.tar.gz | tar -xvz --strip-components=1 -C ./assets/reveal --wildcards "*.js" --wildcards "*.css" --wildcards "*.html" --wildcards "*.woff" --wildcards "*.ttf" --exclude "test" --exclude "gruntfile.js" --exclude "examples/*.html" + - mkdir -p ./assets/reveal/plugin/menu ./assets/reveal/plugin/mouse-pointer + - git clone https://github.com/denehyg/reveal.js-menu.git ./assets/reveal/plugin/menu + - curl -L -o ./assets/reveal/plugin/mouse-pointer/mouse-pointer.js https://raw.githubusercontent.com/caiofcm/plugin-revealjs-mouse-pointer/master/mouse-pointer.js + - rm -f ./assets/reveal/plugin/menu/{bower.json,CONTRIBUTING.md,LICENSE,package.json,README.md,.gitignore,gulpfile.js,package-lock.json} \ No newline at end of file diff --git a/assets/template/reveal-markdown.tmpl b/assets/template/reveal-markdown.tmpl index 5dcd28f..2494c36 100644 --- a/assets/template/reveal-markdown.tmpl +++ b/assets/template/reveal-markdown.tmpl @@ -6,18 +6,18 @@ goveal - - - + + + - +
-
- - - - - + + + + +