github.com/segakazzz/buffalo@v0.16.22-0.20210119082501-1f52048d3feb/genny/ci/templates/-dot-gitlab-ci.yml.tmpl (about) 1 before_script: 2 {{- if eq .opts.DBType "postgres" }} 3 - apt-get update && apt-get install -y postgresql-client 4 {{- else if eq .opts.DBType "mysql" }} 5 - apt-get update && apt-get install -y mysql-client 6 {{- end }} 7 - ln -s /builds /go/src/$(echo "{{.opts.App.PackagePkg}}" | cut -d "/" -f1) 8 - cd /go/src/{{.opts.App.PackagePkg}} 9 - mkdir -p public/assets 10 - go get -u github.com/gobuffalo/buffalo/buffalo 11 - go mod download 12 - export PATH="$PATH:$GOPATH/bin" 13 14 stages: 15 - test 16 17 .test-vars: &test-vars 18 variables: 19 GO_ENV: "test" 20 {{- if eq .opts.DBType "postgres" }} 21 POSTGRES_DB: "{{.opts.App.Name.File}}_test" 22 {{- else if eq .opts.DBType "mysql" }} 23 MYSQL_DATABASE: "{{.opts.App.Name.File}}_test" 24 MYSQL_ROOT_PASSWORD: "root" 25 {{- end }} 26 TEST_DATABASE_URL: "{{.testDbUrl}}" 27 28 # Golang version choice helper 29 .use-golang-image: &use-golang-latest 30 image: golang:latest 31 32 .use-golang-image: &use-golang-1-8 33 image: golang:1.8 34 35 test: 36 # Change to "<<: *use-golang-latest" to use the latest Go version 37 <<: *use-golang-1-8 38 <<: *test-vars 39 stage: test 40 services: 41 {{- if eq .opts.DBType "mysql" }} 42 - mysql:5 43 {{- else if eq .opts.DBType "postgres" }} 44 - postgres:latest 45 {{- end }} 46 script: 47 - buffalo test