Skip to content

Load active incidents gracefully #25

Load active incidents gracefully

Load active incidents gracefully #25

Workflow file for this run

name: SQL
on:
push:
branches:
- main
pull_request: {}
jobs:
sql:
name: ${{ matrix.database.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
database:
- {type: PGSQL, port: 5432, name: PostgreSQL 9.6, image: "postgres:9.6"}
- {type: PGSQL, port: 5432, name: PostgreSQL 10, image: "postgres:10"}
- {type: PGSQL, port: 5432, name: PostgreSQL 11, image: "postgres:11"}
- {type: PGSQL, port: 5432, name: PostgreSQL 12, image: "postgres:12"}
- {type: PGSQL, port: 5432, name: PostgreSQL 13, image: "postgres:13"}
- {type: PGSQL, port: 5432, name: PostgreSQL latest, image: "postgres:latest"}
env:
DATABASE_NAME: notifications
services:
${{ matrix.database.type }}:
image: ${{ matrix.database.image }}
env:
POSTGRES_PASSWORD: notifications
POSTGRES_DB: ${{ env.DATABASE_NAME }}
# Wait until postgres becomes ready
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- ${{ matrix.database.port }}:${{ matrix.database.port }}
steps:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: Checkout code
uses: actions/checkout@v4
- name: Importing ${{ matrix.database.type }} Schema
if: ${{ matrix.database.type == 'PGSQL' }}
run: |
cat ${{ github.workspace }}/schema/pgsql/schema.sql | psql -U postgres -d ${{ env.DATABASE_NAME }}
- name: Download dependencies
run: go get -v -t -d ./...
- name: Run tests
env:
NOTIFICATIONS_TESTS_DB_TYPE: ${{ matrix.database.type }}
NOTIFICATIONS_TESTS_DB: ${{ env.DATABASE_NAME }}
NOTIFICATIONS_TESTS_DB_USER: postgres
NOTIFICATIONS_TESTS_DB_PASSWORD: notifications
NOTIFICATIONS_TESTS_DB_HOST: 127.0.0.1
NOTIFICATIONS_TESTS_DB_PORT: ${{ matrix.database.port }}
timeout-minutes: 10
run: go test -v -timeout 5m ./...