2023-08-10 05:26:57 +02:00
|
|
|
name: Tests
|
2022-01-20 06:38:54 +01:00
|
|
|
permissions: read-all
|
|
|
|
|
2019-09-15 20:32:12 +02:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
2022-08-12 06:17:38 +02:00
|
|
|
- main
|
2023-11-25 05:35:08 +01:00
|
|
|
workflow_dispatch:
|
2019-09-15 20:32:12 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
unit-tests:
|
|
|
|
name: Unit Tests
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
max-parallel: 4
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
2023-08-09 06:54:09 +02:00
|
|
|
go-version: ["1.21"]
|
2019-09-15 20:32:12 +02:00
|
|
|
steps:
|
|
|
|
- name: Set up Go
|
2023-03-20 23:59:28 +01:00
|
|
|
uses: actions/setup-go@v4
|
2019-09-15 20:32:12 +02:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- name: Checkout
|
2023-09-05 00:35:18 +02:00
|
|
|
uses: actions/checkout@v4
|
2019-09-15 20:32:12 +02:00
|
|
|
- name: Run unit tests
|
|
|
|
run: make test
|
|
|
|
|
|
|
|
integration-tests:
|
|
|
|
name: Integration Tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres:9.5
|
|
|
|
env:
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_DB: postgres
|
|
|
|
ports:
|
|
|
|
- 5432:5432
|
|
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
|
|
steps:
|
|
|
|
- name: Set up Go
|
2023-03-20 23:59:28 +01:00
|
|
|
uses: actions/setup-go@v4
|
2019-09-15 20:32:12 +02:00
|
|
|
with:
|
2023-08-09 06:54:09 +02:00
|
|
|
go-version: "1.21"
|
2019-09-15 20:32:12 +02:00
|
|
|
- name: Checkout
|
2023-09-05 00:35:18 +02:00
|
|
|
uses: actions/checkout@v4
|
2019-09-15 20:32:12 +02:00
|
|
|
- name: Install Postgres client
|
2022-08-22 00:23:15 +02:00
|
|
|
run: sudo apt update && sudo apt install -y postgresql-client
|
2019-09-15 20:32:12 +02:00
|
|
|
- name: Run integration tests
|
|
|
|
run: make integration-test
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
PGHOST: 127.0.0.1
|
|
|
|
PGPASSWORD: postgres
|