diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5a5b001eb..8f1b4ffe5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -44,7 +44,9 @@ jobs: uses: ./.github/actions/setup-nix with: authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - tools: tests.coverage.bin tests.testDoctests.bin tests.testSpecIdempotence.bin + tools: tests.coverage.bin tests.testDoctests.bin tests.testSpecIdempotence.bin cabalTools.update.bin + + - run: postgrest-cabal-update - name: Run coverage (IO tests and Spec tests against PostgreSQL 15) run: postgrest-coverage @@ -81,7 +83,9 @@ jobs: 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 + tools: tests.testSpec.bin tests.testIO.bin tests.testBigSchema.bin withTools.postgresql-${{ matrix.pgVersion }}.bin cabalTools.update.bin + + - run: postgrest-cabal-update - name: Run spec tests if: always() @@ -105,7 +109,10 @@ jobs: uses: ./.github/actions/setup-nix with: authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - tools: tests.testMemory.bin + tools: tests.testMemory.bin cabalTools.update.bin + + - run: postgrest-cabal-update + - name: Run memory tests run: postgrest-test-memory @@ -124,7 +131,10 @@ jobs: uses: ./.github/actions/setup-nix with: authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - tools: loadtest.loadtestAgainst.bin loadtest.report.bin + tools: loadtest.loadtestAgainst.bin loadtest.report.bin cabalTools.update.bin + + - run: postgrest-cabal-update + - name: Run loadtest env: TARGET_BRANCH: ${{ github.base_ref || github.ref_name }} diff --git a/nix/tools/cabalTools.nix b/nix/tools/cabalTools.nix index 042c02fcc..175e10a03 100644 --- a/nix/tools/cabalTools.nix +++ b/nix/tools/cabalTools.nix @@ -15,7 +15,6 @@ let withEnv = postgrest.env; } '' - ${cabal-install}/bin/cabal v2-update exec ${cabal-install}/bin/cabal v2-build ${devCabalOptions} "''${_arg_leftovers[@]}" ''; @@ -34,6 +33,17 @@ let exec ${cabal-install}/bin/cabal v2-clean ''; + update = + checkedShellScript + { + name = "postgrest-cabal-update"; + docs = "Update cabal's package list from hackage.haskell.org"; + workingDir = "/"; + } + '' + exec ${cabal-install}/bin/cabal v2-update + ''; + run = checkedShellScript { @@ -85,7 +95,6 @@ let export PGRST_DB_POOL_ACQUISITION_TIMEOUT export PGRST_JWT_SECRET - ${cabal-install}/bin/cabal v2-update ${cabal-install}/bin/cabal --builddir="dist-prof" v2-build --enable-profiling --disable-shared exe:postgrest ${cabal-install}/bin/cabal --builddir="dist-prof" v2-run -- \ postgrest +RTS -p -h -RTS "''${_arg_leftovers[@]}" @@ -111,6 +120,7 @@ buildToolbox inherit build clean + update run runProfiled repl; diff --git a/nix/tools/devTools.nix b/nix/tools/devTools.nix index a9d1e77f5..dd25d3bef 100644 --- a/nix/tools/devTools.nix +++ b/nix/tools/devTools.nix @@ -251,7 +251,6 @@ let } '' mkdir -p "$_arg_dumpdir" - ${cabal-install}/bin/cabal v2-update ${cabal-install}/bin/cabal v2-build ${devCabalOptions} \ --builddir="$tmpdir" \ --ghc-option=-ddump-minimal-imports \ diff --git a/nix/tools/tests.nix b/nix/tools/tests.nix index c27c9ee7c..88ca05f26 100644 --- a/nix/tools/tests.nix +++ b/nix/tools/tests.nix @@ -28,7 +28,6 @@ let withEnv = postgrest.env; } '' - ${cabal-install}/bin/cabal v2-update ${withTools.withPg} -f test/spec/fixtures/load.sql \ ${cabal-install}/bin/cabal v2-run ${devCabalOptions} test:spec -- "''${_arg_leftovers[@]}" ''; @@ -42,7 +41,6 @@ let withEnv = postgrest.env; } '' - ${cabal-install}/bin/cabal v2-update # This makes nix-env -iA tests.doctests.bin work. export NIX_GHC=${postgrest.env.NIX_GHC} ${cabal-install}/bin/cabal v2-run ${devCabalOptions} test:doctests @@ -57,7 +55,6 @@ let withEnv = postgrest.env; } '' - ${cabal-install}/bin/cabal v2-update ${withTools.withPg} -f test/spec/fixtures/load.sql \ ${runtimeShell} -c " \ ${cabal-install}/bin/cabal v2-run ${devCabalOptions} test:spec && \ @@ -85,7 +82,6 @@ let withEnv = postgrest.env; } '' - ${cabal-install}/bin/cabal v2-update ${cabal-install}/bin/cabal v2-build ${devCabalOptions} exe:postgrest ${cabal-install}/bin/cabal v2-exec -- ${withTools.withPg} -f test/io/fixtures.sql \ ${ioTestPython}/bin/pytest --ignore=test/io/test_big_schema.py --ignore=test/io/test_replica.py -v test/io "''${_arg_leftovers[@]}" @@ -101,7 +97,6 @@ let withEnv = postgrest.env; } '' - ${cabal-install}/bin/cabal v2-update ${cabal-install}/bin/cabal v2-build ${devCabalOptions} exe:postgrest ${cabal-install}/bin/cabal v2-exec -- ${withTools.withPg} -f test/io/big_schema.sql \ ${ioTestPython}/bin/pytest -v test/io/test_big_schema.py "''${_arg_leftovers[@]}" @@ -117,7 +112,6 @@ let withEnv = postgrest.env; } '' - ${cabal-install}/bin/cabal v2-update ${cabal-install}/bin/cabal v2-build ${devCabalOptions} exe:postgrest ${cabal-install}/bin/cabal v2-exec -- ${withTools.withPg} --replica -f test/io/replica.sql \ ${ioTestPython}/bin/pytest -v test/io/test_replica.py "''${_arg_leftovers[@]}" @@ -133,7 +127,6 @@ let withPath = [ jq ]; } '' - ${cabal-install}/bin/cabal v2-update ${withTools.withPg} -f test/spec/fixtures/load.sql \ ${cabal-install}/bin/cabal v2-run ${devCabalOptions} --verbose=0 -- \ postgrest --dump-schema @@ -162,7 +155,6 @@ let rm -rf coverage/* # build once before running all the tests - ${cabal-install}/bin/cabal v2-update ${cabal-install}/bin/cabal v2-build ${devCabalOptions} exe:postgrest lib:postgrest test:spec ( @@ -246,7 +238,6 @@ let withPath = [ curl ]; } '' - ${cabal-install}/bin/cabal v2-update ${cabal-install}/bin/cabal --builddir="dist-prof" v2-build --enable-profiling --disable-shared exe:postgrest ${cabal-install}/bin/cabal --builddir="dist-prof" v2-exec -- ${withTools.withPg} -f test/spec/fixtures/load.sql \ test/memory/memory-tests.sh