Update mysql Docker tag to v9 #317
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v6 | |
test: | |
strategy: | |
matrix: | |
go-version: [1.17.x, 1.19.x, 1.20.x] | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:17 | |
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:9 | |
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@v5 | |
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@v5 | |
with: | |
go-version: 1.20.x | |
- | |
name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
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 |