Skip to content

chore(ci): add PostgreSQL 17 to build matrix #99

chore(ci): add PostgreSQL 17 to build matrix

chore(ci): add PostgreSQL 17 to build matrix #99

Workflow file for this run

name: test
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "test"
test:
name: test
strategy:
matrix:
# version must be string, otherwise it will be converted to float
# and the trailing zero will be removed. 1.20 -> 1.2
go-version: [ "1.22", "1.23" ]
postgres-version: [ 17, 16, 15, 14, 13, 12 ]
# Ensure that all combinations of Go and Postgres versions will run
continue-on-error: true
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Environment variables that are available to all jobs and steps in this workflow
env:
TEST_POSTGRES_DSN: postgres://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable
# Services are Docker containers that are run during a job
services:
# Start the postgres database
postgres:
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout
uses: actions/checkout@v4
# Setting up Go in the runner
- name: setup go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
# Disabled because of incompatibility with Matrix Strategy
# # Cache Go build cache and modcache
# - name: cache deps
# uses: actions/cache@v3
# with:
# path: |
# ~/.cache/go-build
# ~/go/pkg/mod
# key: ${{ runner.os }}}-go-${{ matrix.go-version }}-postgres-${{ matrix.postgres-version }}-${{ hashFiles('**/go.sum') }}
# restore-keys: |
# ${{ runner.os }}-go-${{ matrix.go-version }}-
# Runs Go tests
- name: test
run: go test ./...