Skip to content

build(deps): bump github.com/creasty/defaults from 1.7.0 to 1.8.0 #446

build(deps): bump github.com/creasty/defaults from 1.7.0 to 1.8.0

build(deps): bump github.com/creasty/defaults from 1.7.0 to 1.8.0 #446

name: Tests with database
on:
push:
branches:
- main
pull_request: {}
jobs:
mysql:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image:
- mysql:5.7
- mysql:8.0
- mysql:8
- mysql:latest
- mariadb:10.2
- mariadb:10.3
- mariadb:10.4
- mariadb:10.5
- mariadb:10.6
- mariadb:10
- mariadb:11.0
- mariadb:11.1
- mariadb:11.2
- mariadb:latest
env:
NOTIFICATIONS_TESTS_DB_TYPE: mysql
NOTIFICATIONS_TESTS_DB: notifications
NOTIFICATIONS_TESTS_DB_USER: root
NOTIFICATIONS_TESTS_DB_PASSWORD: notifications
NOTIFICATIONS_TESTS_DB_HOST: 127.0.0.1
NOTIFICATIONS_TESTS_DB_PORT: 3306
services:
mysql:
image: ${{ matrix.image }}
env:
MYSQL_ROOT_PASSWORD: ${{ env.NOTIFICATIONS_TESTS_DB_PASSWORD }}
MYSQL_DATABASE: ${{ env.NOTIFICATIONS_TESTS_DB }}
# Wait until MySQL becomes ready
options: >-
--health-cmd "${{ (startsWith(matrix.image, 'mysql:') || startsWith(matrix.image, 'mariadb:10')) && 'mysqladmin ping' || 'healthcheck.sh --connect --innodb_initialized' }}"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 3306:3306
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Checkout code
uses: actions/checkout@v4
- name: Importing Schema
run: >
mysql -h127.0.0.1 -u$NOTIFICATIONS_TESTS_DB_USER -p$NOTIFICATIONS_TESTS_DB_PASSWORD
$NOTIFICATIONS_TESTS_DB < ${{ github.workspace }}/schema/mysql/schema.sql
- name: Download dependencies
run: go get -v -t -d ./...
- name: Run tests
timeout-minutes: 10
# By default, multiple packages may be tested in parallel in different
# processes. Passing -p 1 reduces this to one process to prevent test
# cases in different packages from accessing the same database. Note
# that t.Parallel() only affects parallelism within one process, i.e.
# within the tests of one package.
run: go test -v -timeout 5m -p 1 ./...
postgresql:
name: PostgreSQL ${{ matrix.version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: ["9.6", "10", "11", "12", "13", "14", "15", "latest"]
env:
NOTIFICATIONS_TESTS_DB_TYPE: pgsql
NOTIFICATIONS_TESTS_DB: notifications
NOTIFICATIONS_TESTS_DB_USER: postgres
NOTIFICATIONS_TESTS_DB_PASSWORD: notifications
NOTIFICATIONS_TESTS_DB_HOST: 127.0.0.1
NOTIFICATIONS_TESTS_DB_PORT: 5432
services:
postgres:
image: postgres:${{ matrix.version }}
env:
POSTGRES_PASSWORD: ${{ env.NOTIFICATIONS_TESTS_DB_PASSWORD }}
POSTGRES_DB: ${{ env.NOTIFICATIONS_TESTS_DB }}
# Wait until postgres becomes ready
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Checkout code
uses: actions/checkout@v4
- name: Importing Schema
env:
PGPASSWORD: ${{ env.NOTIFICATIONS_TESTS_DB_PASSWORD }}
run: |
psql -U postgres -w -h 127.0.0.1 -d ${{ env.NOTIFICATIONS_TESTS_DB }} < ${{ github.workspace }}/schema/pgsql/schema.sql
- name: Download dependencies
run: go get -v -t -d ./...
- name: Run tests
timeout-minutes: 10
# By default, multiple packages may be tested in parallel in different
# processes. Passing -p 1 reduces this to one process to prevent test
# cases in different packages from accessing the same database. Note
# that t.Parallel() only affects parallelism within one process, i.e.
# within the tests of one package.
run: go test -v -timeout 5m -p 1 ./...