-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(task): replace Make and PowerShell with Task
It will be good to have a single cross-platform build file. We currently have two, `Makefile` and `test.ps1`. They are complex enough we should avoid maintaining both at the same time.
- Loading branch information
Showing
8 changed files
with
185 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/attic/ | ||
/dist/ | ||
/.task/ | ||
|
||
*.bak | ||
*.exe | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
version: '3' | ||
|
||
vars: | ||
dist_dir: dist/ | ||
subdir: v2 | ||
test_binaries: | ||
- test/env | ||
- test/exit99 | ||
- test/hello | ||
- test/sleep | ||
|
||
env: | ||
CGO_ENABLED: 0 | ||
|
||
tasks: | ||
default: | ||
deps: | ||
- all | ||
|
||
all: | ||
desc: 'Build and test everything' | ||
deps: | ||
- build_readme | ||
- test | ||
|
||
build: | ||
desc: 'Build all components' | ||
deps: | ||
- build_readme | ||
- build_binaries | ||
|
||
build_binaries: | ||
desc: 'Build all necessary binaries' | ||
deps: | ||
- build_recur | ||
- build_test_binaries | ||
|
||
build_binary: | ||
desc: 'Build a single Go binary' | ||
internal: true | ||
cmds: | ||
- go build -o {{.out | q}} {{.src | q}} | ||
|
||
build_readme: | ||
desc: 'Generate README.md from template' | ||
deps: | ||
- build_recur | ||
dir: '{{.subdir}}' | ||
cmds: | ||
- go run ../script/render_template.go < ../README.template.md > ../README.md | ||
status: | ||
- README.template.md | ||
- '{{.subdir}}/main.go' | ||
generates: | ||
- README.md | ||
|
||
build_recur: | ||
desc: 'Build the recur binary' | ||
cmds: | ||
- task: build_binary | ||
vars: | ||
out: '{{.subdir | q}}/recur' | ||
src: ./{{.subdir | q}}/main.go | ||
sources: | ||
- '{{.subdir}}/main.go' | ||
generates: | ||
- '{{.subdir}}/recur' | ||
|
||
build_test_binaries: | ||
desc: 'Build all test binaries' | ||
deps: | ||
- build_test_env | ||
- build_test_exit99 | ||
- build_test_hello | ||
- build_test_sleep | ||
|
||
build_test_env: | ||
cmds: | ||
- task: build_binary | ||
vars: | ||
src: test/env.go | ||
out: test/env | ||
sources: | ||
- test/env.go | ||
generates: | ||
- test/env | ||
|
||
build_test_exit99: | ||
cmds: | ||
- task: build_binary | ||
vars: | ||
src: test/exit99.go | ||
out: test/exit99 | ||
sources: | ||
- test/exit99.go | ||
generates: | ||
- test/exit99 | ||
|
||
build_test_hello: | ||
cmds: | ||
- task: build_binary | ||
vars: | ||
src: test/hello.go | ||
out: test/hello | ||
sources: | ||
- test/hello.go | ||
generates: | ||
- test/hello | ||
|
||
build_test_sleep: | ||
cmds: | ||
- task: build_binary | ||
vars: | ||
src: test/sleep.go | ||
out: test/sleep | ||
sources: | ||
- test/sleep.go | ||
generates: | ||
- test/sleep | ||
|
||
clean: | ||
desc: 'Clean up generated files and binaries' | ||
cmds: | ||
- rm -f README.md | ||
- rm -f {{.subdir | q}}/recur | ||
- rm -f {{range .test_binaries}}{{. | q}} {{end}} | ||
|
||
release: | ||
desc: 'Prepare a release' | ||
dir: '{{.subdir}}' | ||
cmds: | ||
- go run ../script/release.go | ||
- mkdir -p ../{{.dist_dir | q}} | ||
- mv dist/* ../{{.dist_dir | q}} | ||
- rmdir dist/ | ||
|
||
test: | ||
desc: 'Run tests' | ||
deps: | ||
- build_binaries | ||
dir: '{{.subdir}}' | ||
cmds: | ||
- go test |