-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
66 lines (57 loc) · 1.87 KB
/
Taskfile.yaml
File metadata and controls
66 lines (57 loc) · 1.87 KB
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
version: '3'
env:
APP_ENV: dev
DATABASE_URL: '{{.DATABASE_URL | default "postgres://test:test@localhost:5435/gomin?sslmode=disable"}}'
tasks:
build:
desc: Builds a local executable, outputs to out/bin/gomin
cmds:
- mkdir -p out/bin
- cp cmd/config.yaml out/bin
- go build -mod vendor -o out/bin/gomin cmd/main.go
clean:
desc: Cleans up build artifacts, including out, bin, and test reports
cmds:
- rm -fr ./bin
- rm -fr ./out
- rm -f ./junit-report.xml checkstyle-report.xml ./coverage.xml ./profile.cov yamllint-checkstyle.xml
d.build:
desc: Builds the docker iamge, marks it as latest
cmds:
- docker build -t ghcr.io/pauljamescleary/gomin:latest .
d.down:
desc: Shuts down all docker containers in the docker compose file
cmds:
- docker-compose down
d.up:
desc: Starts up all docker containers, builds and runs the API as well
cmds:
- docker-compose up -d --build
db.migrate:
desc: Runs the database migration, ensures that the local postgres database is running
deps: [db.up]
cmds:
- |
atlas schema apply \
--auto-approve \
--url "$DATABASE_URL" \
--to "file://database/schema.hcl" \
--dev-url "docker://postgres/15"
db.up:
desc: Starts the database WITHOUT migrations
cmds:
- docker-compose up -d db
server.run:
desc: Starts the database, runs migrations, builds the server, and starts the server
deps: [db.migrate,build]
cmds:
- ./out/bin/gomin -configpath "{{ .TASKFILE_DIR }}/out/bin/config.yaml"
env:
APP_DB_URL: "postgres://test:test@localhost:5435/gomin"
APP_PORT: 1323
test:
desc: Runs all of the tests in all of the go source directories
cmds:
- (rm /tmp/unit_coverage.out || echo "Deleted Old files")
- go mod vendor
- go test -test.v ./...