Nixify io and memory tests (#1538)

* Include tests for io and memory in the Nix environment.
* include spec tests in nix-shell by default
* install the io and memory tests in CI
This commit is contained in:
Remo Rechkemmer
2020-05-28 12:45:14 -05:00
committed by GitHub
parent 784ebe57d7
commit 69b09e312a
18 changed files with 211 additions and 108 deletions
+21 -4
View File
@@ -74,6 +74,8 @@ jobs:
- run:
name: run io tests
command: |
export PATH="~/.local/bin:$PATH"
stack install --fast -j1
test/io-tests.sh
# Run memory usage tests based on stack and docker.
@@ -111,12 +113,13 @@ jobs:
- ".stack-work"
key: v1-stack-prof-dependencies-{{ checksum "postgrest.cabal" }}-{{ checksum "stack.yaml" }}
- run:
name: build with profiling enabled
name: install with profiling enabled
command: |
stack build --profile -j1
stack install --profile -j1
- run:
name: run memory usage tests
command: |
export PATH="~/.local/bin:$PATH"
test/create_test_db "postgres://circleci@localhost" postgrest_test
test/memory-tests.sh
@@ -190,12 +193,20 @@ jobs:
nix-env -iA cachix -f https://cachix.org/api/v1/install
cachix use postgrest
- run:
name: Install testing scripts for all supported PostgreSQL versions
command: nix-env -f default.nix -iA tests
name: Install testing scripts
command: nix-env -f default.nix -iA tests tests.ioTests tests.memoryTests
# 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`.
#
# CircleCI looks for caches by prefix. When saving to the the cache
# below, we append the current time to the key ('-{{ epoch }}'), so a new
# cache will always be uploaded. If the `postgrest.cabal` and
# `nix/nixpkgs-version.nix` files are unchanged, the latest matching
# cache will be used. If there is no cache for those files, CircleCI will
# try the next, more general key and use the latest cache that matches
# it.
- restore_cache:
keys:
- nix-test-{{ checksum "postgrest.cabal" }}-{{ checksum "nix/nixpkgs-version.nix" }}
@@ -219,6 +230,12 @@ jobs:
- run:
name: Run the spec tests against PostgreSQL 12
command: postgrest-test-spec-postgresql-12
- run:
name: Run io tests
command: postgrest-test-io
- run:
name: Run memory tests
command: postgrest-test-memory
- save_cache:
paths:
- "~/.cabal"