Run the spec test suite from the nix build job (#1503)
* Add caching to the tests run in CI with Nix
This commit is contained in:
+18
-3
@@ -400,18 +400,33 @@ jobs:
|
|||||||
nix-env -iA cachix -f https://cachix.org/api/v1/install
|
nix-env -iA cachix -f https://cachix.org/api/v1/install
|
||||||
cachix use postgrest
|
cachix use postgrest
|
||||||
- run:
|
- run:
|
||||||
name: Build the dynamic Postgrest executable
|
name: Build the dynamic PostgREST executable
|
||||||
command: |
|
command: |
|
||||||
# We build the dynamic postgrest executable first in order to fail fast if anything
|
# We build the dynamic postgrest executable first in order to fail fast if anything
|
||||||
# should be wrong with the source code.
|
# should be wrong with the source code.
|
||||||
nix-build -A postgrest
|
nix-build -A postgrest
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
- v1-cabal-nix-dependencies-{{ checksum "postgrest.cabal" }}
|
||||||
|
- run:
|
||||||
|
name: Run the spec tests against all supported PostgreSQL versions
|
||||||
|
command: |
|
||||||
|
# Our utility scripts use cabal to run the tests, which will pick up all the libraries that
|
||||||
|
# are built with Nix. So this should only ever build the PostgREST itself and be reasonably
|
||||||
|
# quick. We accelerate that part further by caching `~/.cabal` and `dist-newstyle`.
|
||||||
|
nix-shell --run postgrest-test-spec-all
|
||||||
|
- save_cache:
|
||||||
|
paths:
|
||||||
|
- "~/.cabal"
|
||||||
|
- "dist-newstyle"
|
||||||
|
key: v1-cabal-nix-dependencies-{{ checksum "postgrest.cabal" }}
|
||||||
- run:
|
- run:
|
||||||
name: Build all derivations from default.nix and push results to Cachix
|
name: Build all derivations from default.nix and push results to Cachix
|
||||||
command: |
|
command: |
|
||||||
# We only push to the binary cache if the trigger for the build was not a pull request
|
# We only push to the binary cache if the trigger for the build was not a pull request
|
||||||
# or if the pull request was from an internal branch. CircleCI is configured to not make
|
# or if the pull request was from an internal branch. CircleCI is configured to not make
|
||||||
# the CACHIX_SIGNING_KEY secret available to those builds, which is required for pushing
|
# the CACHIX_SIGNING_KEY secret, which is required for pushing to the cache, available to
|
||||||
# to the cache.
|
# any other builds.
|
||||||
if [ -z "${CI_PULL_REQUEST:-""}" ] || [ "${CIRCLE_PR_USERNAME:-""}" == "PostgREST" ]; then
|
if [ -z "${CI_PULL_REQUEST:-""}" ] || [ "${CIRCLE_PR_USERNAME:-""}" == "PostgREST" ]; then
|
||||||
echo "Building and caching all derivations..."
|
echo "Building and caching all derivations..."
|
||||||
nix-build | cachix push postgrest
|
nix-build | cachix push postgrest
|
||||||
|
|||||||
Reference in New Issue
Block a user