name: test snapshot

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]
  schedule:
    - cron: '0 0 * * 5'

env:
  PG_SNAPSHOT_VERSION: "19"

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Build the Docker image
        run: docker build . --file docker/Dockerfile --tag "pgxtest:snapshot" --build-arg "PGVERSION=${{ env.PG_SNAPSHOT_VERSION }}" --build-arg "PGCHANNEL=bookworm-pgdg-snapshot"

      - name: Test
        run: docker run --rm -v `pwd`:/workspace "pgxtest:snapshot" /test.sh
