mirror of
https://github.com/onyx-and-iris/gignore.git
synced 2025-03-31 10:51:19 +01:00
Some checks failed
Auto-Update Go Modules / update-go-modules (push) Has been cancelled
79 lines
1.7 KiB
YAML
79 lines
1.7 KiB
YAML
version: '3'
|
|
|
|
vars:
|
|
PROGRAM: gignore
|
|
SHELL: '{{if eq .OS "Windows_NT"}}powershell{{end}}'
|
|
BIN_DIR: bin
|
|
|
|
WINDOWS: '{{.BIN_DIR}}/{{.PROGRAM}}_windows_amd64.exe'
|
|
LINUX: '{{.BIN_DIR}}/{{.PROGRAM}}_linux_amd64'
|
|
GIT_COMMIT:
|
|
sh: git log -n 1 --format=%h
|
|
|
|
tasks:
|
|
default:
|
|
desc: Build the gignore project
|
|
cmds:
|
|
- task: build
|
|
|
|
build:
|
|
desc: Build the gignore project
|
|
deps: [vet]
|
|
cmds:
|
|
- task: build-windows
|
|
- task: build-linux
|
|
|
|
vet:
|
|
desc: Vet the code
|
|
deps: [fmt]
|
|
cmds:
|
|
- go vet ./...
|
|
|
|
fmt:
|
|
desc: Fmt the code
|
|
cmds:
|
|
- go fmt ./...
|
|
|
|
generate:
|
|
desc: |
|
|
Generate the gitignore.io templates.
|
|
This task will be skipped if the templates already exist.
|
|
You may use the `--force` flag to regenerate the templates.
|
|
cmds:
|
|
- go generate ./...
|
|
status:
|
|
- ls internal/registry/templates/gitignoreio/*.gitignore >/dev/null || exit 1
|
|
|
|
build-windows:
|
|
desc: Build the gignore project for Windows
|
|
cmds:
|
|
- GOOS=windows GOARCH=amd64 go build -o {{.WINDOWS}} -ldflags="-X main.Version={{.GIT_COMMIT}}" ./cmd/{{.PROGRAM}}
|
|
internal: true
|
|
|
|
build-linux:
|
|
desc: Build the gignore project for Linux
|
|
cmds:
|
|
- GOOS=linux GOARCH=amd64 go build -o {{.LINUX}} -ldflags="-X main.Version={{.GIT_COMMIT}}" ./cmd/{{.PROGRAM}}
|
|
internal: true
|
|
|
|
test:
|
|
desc: Run tests
|
|
cmds:
|
|
- go test ./...
|
|
|
|
install:
|
|
desc: Install the gignore project
|
|
deps: [generate]
|
|
cmds:
|
|
- go install ./cmd/{{.PROGRAM}}
|
|
|
|
clean:
|
|
desc: Clean the build artifacts
|
|
cmds:
|
|
- '{{.SHELL}} rm -r {{.BIN_DIR}}'
|
|
|
|
prune:
|
|
desc: Empty the gitignoreio template registry
|
|
cmds:
|
|
- '{{.SHELL}} rm internal/registry/templates/gitignoreio/*.gitignore'
|