refactor: add docker testing targets to magefile
This commit is contained in:
parent
56e925a48d
commit
aeb97a30d8
@ -12,7 +12,7 @@ services:
|
||||
volumes:
|
||||
- taskcafe-postgres:/var/lib/postgresql/data
|
||||
ports:
|
||||
- 8855:5432
|
||||
- 8865:5432
|
||||
mailhog:
|
||||
image: mailhog/mailhog:latest
|
||||
restart: always
|
||||
|
20
magefile.go
20
magefile.go
@ -98,8 +98,10 @@ func (Backend) GenFrontend() error {
|
||||
}
|
||||
|
||||
func flagEnv() map[string]string {
|
||||
hash, _ := sh.Output("git", "rev-parse", "--short", "HEAD")
|
||||
fmt.Println("[ignore] fatal: no tag matches")
|
||||
hash, err := sh.Output("git", "rev-parse", "--short", "HEAD")
|
||||
if err != nil {
|
||||
fmt.Println("[ignore] fatal: no tag matches")
|
||||
}
|
||||
tag, err := sh.Output("git", "describe", "--exact-match", "--tags")
|
||||
if err != nil {
|
||||
tag = "nightly"
|
||||
@ -160,6 +162,20 @@ func Build() {
|
||||
mg.SerialDeps(Frontend.Build, Backend.GenMigrations, Backend.GenFrontend, Backend.Build)
|
||||
}
|
||||
|
||||
// Latest is namespace for commands interacting with docker test setups
|
||||
type Latest mg.Namespace
|
||||
|
||||
func (Latest) Up() error {
|
||||
return sh.RunV("docker-compose", "-p", "taskcafe-latest", "-f", "testing/docker-compose.latest.yml", "up")
|
||||
}
|
||||
|
||||
// Test is namespace for commands interacting with docker test setups
|
||||
type Dev mg.Namespace
|
||||
|
||||
func (Dev) Up() error {
|
||||
return sh.RunV("docker-compose", "-p", "taskcafe-dev", "-f", "testing/docker-compose.dev.yml", "up")
|
||||
}
|
||||
|
||||
// Docker is namespace for commands interacting with docker
|
||||
type Docker mg.Namespace
|
||||
|
||||
|
26
testing/docker-compose.dev.yml
Normal file
26
testing/docker-compose.dev.yml
Normal file
@ -0,0 +1,26 @@
|
||||
version: "3"
|
||||
services:
|
||||
web:
|
||||
build: ../
|
||||
ports:
|
||||
- "6677:3333"
|
||||
depends_on:
|
||||
- postgres
|
||||
networks:
|
||||
- taskcafe-dev-test
|
||||
environment:
|
||||
TASKCAFE_DATABASE_HOST: postgres
|
||||
TASKCAFE_MIGRATE: "true"
|
||||
postgres:
|
||||
image: postgres:12.3-alpine
|
||||
restart: always
|
||||
networks:
|
||||
- taskcafe-dev-test
|
||||
environment:
|
||||
POSTGRES_USER: taskcafe
|
||||
POSTGRES_PASSWORD: taskcafe_test
|
||||
POSTGRES_DB: taskcafe
|
||||
|
||||
networks:
|
||||
taskcafe-dev-test:
|
||||
driver: bridge
|
33
testing/docker-compose.latest.yml
Normal file
33
testing/docker-compose.latest.yml
Normal file
@ -0,0 +1,33 @@
|
||||
version: "3"
|
||||
services:
|
||||
web:
|
||||
image: taskcafe/taskcafe:latest
|
||||
# build: .
|
||||
ports:
|
||||
- "6688:3333"
|
||||
depends_on:
|
||||
- postgres
|
||||
networks:
|
||||
- taskcafe-latest-test
|
||||
environment:
|
||||
TASKCAFE_DATABASE_HOST: postgres
|
||||
TASKCAFE_MIGRATE: "true"
|
||||
postgres:
|
||||
image: postgres:12.3-alpine
|
||||
restart: always
|
||||
networks:
|
||||
- taskcafe-latest-test
|
||||
environment:
|
||||
POSTGRES_USER: taskcafe
|
||||
POSTGRES_PASSWORD: taskcafe_test
|
||||
POSTGRES_DB: taskcafe
|
||||
volumes:
|
||||
- taskcafe-latest-postgres:/var/lib/postgresql/data
|
||||
|
||||
volumes:
|
||||
taskcafe-latest-postgres:
|
||||
external: false
|
||||
|
||||
networks:
|
||||
taskcafe-latest-test:
|
||||
driver: bridge
|
Loading…
Reference in New Issue
Block a user