Adds inWithTransaction
helper to get transaction status
#427
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test | |
on: | |
push: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: ${{ github.ref_name != 'main' }} | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
test: | |
name: Build and Test | |
runs-on: ubuntu-22.04 | |
strategy: | |
max-parallel: 6 | |
matrix: | |
pg-version: ["pg13", "pg17"] | |
stack-yaml: ["stack-lts-18.28-ghc-8.10.7.yaml", | |
"stack-lts-19.33-ghc-9.0.2.yaml", | |
"stack-lts-20.26-ghc-9.2.8.yaml", | |
"stack-lts-21.22-ghc-9.4.8.yaml", | |
"stack-nightly-2024-10-22-ghc-9.8.3.yaml", | |
"stack.yaml"] | |
include: | |
# Only test the default 'stack.yaml' for the "middle" postgresql versions to reduce the | |
# load on CI | |
- pg-version: "pg14" | |
stack-yaml: "stack.yaml" | |
- pg-version: "pg15" | |
stack-yaml: "stack.yaml" | |
- pg-version: "pg16" | |
stack-yaml: "stack.yaml" | |
permissions: | |
packages: write | |
contents: read | |
actions: read | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v4 | |
env: | |
cache-version: build-v2 | |
stack-yaml-path: "orville-postgresql/${{ matrix.stack-yaml }}" | |
with: | |
key: ${{ env.cache-version }}-${{ hashFiles( env.stack-yaml-path ) }}-${{ hashFiles('orville-postgresql/package.yaml') }} | |
restore-keys: | | |
${{ env.cache-version }}-${{ hashFiles( env.stack-yaml-path ) }}- | |
${{ env.cache-version }}- | |
path: | | |
./stack-root | |
- name: Build dev environment | |
run: | | |
set -e | |
cd orville-postgresql | |
docker compose build -q | |
- name: Run Tests | |
run: | | |
set -e | |
cd orville-postgresql | |
PG_VERSION=${{ matrix.pg-version }} | |
cp compose.override.github.yml compose.override.yml | |
docker compose run \ | |
--rm \ | |
dev \ | |
stack --stack-yaml ${{ matrix.stack-yaml }} test \ | |
--ghc-options=-j --flag orville-postgresql:ci | |
docker compose run --rm dev chmod -R +r /stack-root | |
formatting-check: | |
name: Formatting Check | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache/restore@v4 | |
env: | |
cache-version: format-v1 | |
with: | |
key: ${{ env.cache-version }}-${{ hashFiles('orville-postgresql/stack*.yaml') }}-${{ hashFiles('orville-postgresql/package.yaml') }} | |
restore-keys: | | |
${{ env.cache-version }}- | |
path: | | |
./stack-root | |
- name: Build dev environment | |
run: | | |
set -e | |
cd orville-postgresql | |
docker compose build -q | |
- name: Format and Check for Diff | |
run: | | |
set -e | |
cd orville-postgresql | |
cp compose.override.github.yml compose.override.yml | |
docker compose run \ | |
--rm \ | |
dev \ | |
sh -c ./scripts/format-repo.sh | |
sh -c scripts/format-check-ci.sh | |
cabal-check: | |
name: Cabal Check | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache/restore@v4 | |
env: | |
cache-version: format-v1 | |
with: | |
key: ${{ env.cache-version }}-${{ hashFiles('orville-postgresql/stack*.yaml') }}-${{ hashFiles('orville-postgresql/package.yaml') }} | |
restore-keys: | | |
${{ env.cache-version }}- | |
path: | | |
./stack-root | |
- name: Build dev environment | |
run: | | |
set -e | |
cd orville-postgresql | |
docker compose build -q | |
- name: Check for Hackage issues | |
run: | | |
set -e | |
cd orville-postgresql | |
cp compose.override.github.yml compose.override.yml | |
docker compose run \ | |
--rm \ | |
dev \ | |
cabal check | |
cabal-latest-build: | |
name: Cabal Build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache/restore@v4 | |
env: | |
cache-version: format-v1 | |
with: | |
key: ${{ env.cache-version }}-${{ hashFiles('orville-postgresql/stack*.yaml') }}-${{ hashFiles('orville-postgresql/package.yaml') }} | |
restore-keys: | | |
${{ env.cache-version }}- | |
path: | | |
./stack-root | |
- name: Build dev environment | |
run: | | |
set -e | |
cd orville-postgresql | |
docker compose build -q | |
- name: Build with cabal and latest ghc+deps | |
run: | | |
set -e | |
cd orville-postgresql | |
cp compose.override.github.yml compose.override.yml | |
docker compose run \ | |
--rm \ | |
dev \ | |
scripts/cabal-latest.sh |