Skip to content

Update postgres Docker tag to v16 #225

Update postgres Docker tag to v16

Update postgres Docker tag to v16 #225

Workflow file for this run

on: [push, pull_request]
name: CI
jobs:
golangci-lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
test:
strategy:
matrix:
go-version: [1.17.x, 1.19.x, 1.20.x]
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: glloq_user
POSTGRES_PASSWORD: glloq_password
POSTGRES_DB: glloq
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:8
env:
MYSQL_USER: glloq_user
MYSQL_PASSWORD: glloq_password
MYSQL_DATABASE: glloq
MYSQL_ROOT_PASSWORD: root_pwd
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Test
# Quotes for "-coverprofile=cover.out" are required for Windows because of the "." in the argument name.
run: go test -v -covermode=atomic "-coverprofile=profile.cov" ./...
env:
POSTGRES_DSN: postgres://glloq_user:glloq_password@localhost:5432/glloq?sslmode=disable
MYSQL_DSN: mysql://glloq_user:glloq_password@localhost:3306/glloq
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
if: matrix.go-version == '1.20.x'
with:
path-to-profile: profile.cov
goreleaser:
needs: test
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
-
name: Docker Login
if: success() && startsWith(github.ref, 'refs/tags/v')
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Clear Docker credentials.
if: always()
run: |
rm -f ${HOME}/.docker/config.json