diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 8b19b98..8c6a9f0 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -12,7 +12,7 @@ services: volumes: - taskcafe-postgres:/var/lib/postgresql/data ports: - - 8855:5432 + - 8865:5432 mailhog: image: mailhog/mailhog:latest restart: always diff --git a/magefile.go b/magefile.go index bda4469..14ad331 100644 --- a/magefile.go +++ b/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 diff --git a/testing/docker-compose.dev.yml b/testing/docker-compose.dev.yml new file mode 100644 index 0000000..4bb1472 --- /dev/null +++ b/testing/docker-compose.dev.yml @@ -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 diff --git a/testing/docker-compose.latest.yml b/testing/docker-compose.latest.yml new file mode 100644 index 0000000..a9bd5be --- /dev/null +++ b/testing/docker-compose.latest.yml @@ -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