139 lines
4.3 KiB
YAML
139 lines
4.3 KiB
YAML
name: Test
|
|
|
|
on:
|
|
workflow_call:
|
|
secrets:
|
|
CACHIX_AUTH_TOKEN:
|
|
required: false
|
|
CODECOV_TOKEN:
|
|
required: false
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- v[0-9]+
|
|
paths:
|
|
- .github/workflows/test.yaml
|
|
- .github/workflows/report.yaml
|
|
- .github/actions/setup-nix/**
|
|
- default.nix
|
|
- nix/**
|
|
- .stylish-haskell.yaml
|
|
- cabal.project
|
|
- postgrest.cabal
|
|
- '**.hs'
|
|
- test/**
|
|
- '!**.md'
|
|
|
|
concurrency:
|
|
# Terminate all previous runs of the same workflow for pull requests
|
|
group: test-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
coverage:
|
|
name: Coverage
|
|
runs-on: ubuntu-22.04
|
|
defaults:
|
|
run:
|
|
# Hack for enabling color output, see:
|
|
# https://github.com/actions/runner/issues/241#issuecomment-842566950
|
|
shell: script -qec "bash --noprofile --norc -eo pipefail {0}"
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Setup Nix Environment
|
|
uses: ./.github/actions/setup-nix
|
|
with:
|
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
tools: tests.coverage.bin tests.testDoctests.bin tests.testSpecIdempotence.bin
|
|
|
|
- name: Run coverage (IO tests and Spec tests against PostgreSQL 15)
|
|
run: postgrest-coverage
|
|
- name: Upload coverage to codecov
|
|
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
|
|
with:
|
|
files: ./coverage/codecov.json
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
- name: Run doctests
|
|
if: always()
|
|
run: postgrest-test-doctests
|
|
|
|
- name: Check the spec tests for idempotence
|
|
if: always()
|
|
run: postgrest-test-spec-idempotence
|
|
|
|
|
|
postgres:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
pgVersion: ["9_6", 10, 11, 12, 13, 14, 15, 16]
|
|
name: PG ${{ matrix.pgVersion }}
|
|
runs-on: ubuntu-22.04
|
|
defaults:
|
|
run:
|
|
# Hack for enabling color output, see:
|
|
# https://github.com/actions/runner/issues/241#issuecomment-842566950
|
|
shell: script -qec "bash --noprofile --norc -eo pipefail {0}"
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Setup Nix Environment
|
|
uses: ./.github/actions/setup-nix
|
|
with:
|
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
tools: tests.testSpec.bin tests.testIO.bin tests.testBigSchema.bin withTools.postgresql-${{ matrix.pgVersion }}.bin
|
|
|
|
- name: Run spec tests
|
|
if: always()
|
|
run: postgrest-with-postgresql-${{ matrix.pgVersion }} postgrest-test-spec
|
|
|
|
- name: Run IO tests
|
|
if: always()
|
|
run: postgrest-with-postgresql-${{ matrix.pgVersion }} postgrest-test-io -vv
|
|
|
|
- name: Run IO tests on a big schema
|
|
if: always()
|
|
run: postgrest-with-postgresql-${{ matrix.pgVersion }} postgrest-test-big-schema -vv
|
|
|
|
|
|
memory:
|
|
name: Memory
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Setup Nix Environment
|
|
uses: ./.github/actions/setup-nix
|
|
with:
|
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
tools: memory.test.bin
|
|
- name: Run memory tests
|
|
run: postgrest-test-memory
|
|
|
|
|
|
loadtest:
|
|
name: Loadtest
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Setup Nix Environment
|
|
uses: ./.github/actions/setup-nix
|
|
with:
|
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
tools: loadtest.loadtestAgainst.bin loadtest.report.bin
|
|
- uses: WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce # v1.4.0
|
|
id: get-latest-tag
|
|
with:
|
|
prefix: v
|
|
- name: Run loadtest
|
|
run: |
|
|
postgrest-loadtest-against main ${{ steps.get-latest-tag.outputs.tag }}
|
|
postgrest-loadtest-report > loadtest/loadtest.md
|
|
- name: Upload report
|
|
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
|
|
with:
|
|
name: loadtest.md
|
|
path: loadtest/loadtest.md
|
|
if-no-files-found: error
|