github.com/JarrahG/buffalocli@v0.0.0-20230801092127-b85bfd5d395a/internal/genny/ci/templates/dot-github/workflows/test.yml.tmpl (about)

     1  name: test
     2  
     3  on:
     4    push:
     5    pull_request:
     6  
     7  permissions:
     8    contents: read
     9  
    10  jobs:
    11    test:
    12      runs-on: ubuntu-latest
    13      {{ if eq .opts.DBType "postgres" -}}
    14      services:
    15        postgres:
    16          image: postgres:9.6-alpine
    17          env:
    18            POSTGRES_DB: {{.opts.App.Name.File}}_test
    19            POSTGRES_PASSWORD: postgres
    20          options: >-
    21            --health-cmd pg_isready
    22            --health-interval 10s
    23            --health-timeout 5s
    24            --health-retries 5
    25          ports:
    26            - 5432:5432
    27      {{- end }}
    28      steps:
    29        - uses: actions/checkout@v3
    30        - uses: actions/setup-go@v3
    31          with:
    32            go-version: ~1.18
    33            cache: true
    34        - name: setup
    35          run: |
    36            go install github.com/JarrahG/buffalocli/cmd/buffalo@latest
    37        - name: test
    38          {{ if eq .opts.DBType "postgres" -}}
    39          env:
    40            TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/{{.opts.App.Name.File}}_test?sslmode=disable
    41          {{- end }}
    42          run: |
    43            buffalo test