1
1
mirror of https://github.com/aelve/guide.git synced 2024-12-23 12:52:31 +03:00

[Travis] Test loading the official database

This commit is contained in:
Artyom 2016-04-08 18:33:33 +03:00
parent 60bbc6d71f
commit 5c64b2f36b
4 changed files with 26 additions and 3 deletions

View File

@ -66,6 +66,7 @@ script:
- cabal test - cabal test
- cabal check - cabal check
- cabal sdist # tests that a source-distribution can be generated - cabal sdist # tests that a source-distribution can be generated
- ./scripts/test-official.sh
# Check that the resulting source distribution can be built & installed. # Check that the resulting source distribution can be built & installed.
# If there are no other `.tar.gz` files in `dist`, this can be even simpler: # If there are no other `.tar.gz` files in `dist`, this can be even simpler:

20
scripts/test-official.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
set -ev
# Test that the official database can be loaded
if [ -d "state" ]; then
mv state state-old
fi
git clone --depth 1 https://github.com/aelve/guide-database.git
mv guide-database state
cabal build
dist/build/guide/guide --dry-run
rm -rf state
if [ -d "state-old" ]; then
mv state-old state
fi

View File

@ -451,6 +451,11 @@ main = do
_categoriesDeleted = [], _categoriesDeleted = [],
_pendingEdits = [], _pendingEdits = [],
_editIdCounter = 0 } _editIdCounter = 0 }
do args <- getArgs
when (args == ["--dry-run"]) $ do
db :: DB <- openLocalStateFrom "state/" (error "couldn't load state")
closeAcidState db
exitSuccess
-- When we run in GHCi and we exit the main thread, the EKG thread (that -- When we run in GHCi and we exit the main thread, the EKG thread (that
-- runs the localhost:5050 server which provides statistics) may keep -- runs the localhost:5050 server which provides statistics) may keep
-- running. This makes running this in GHCi annoying, because you have to -- running. This makes running this in GHCi annoying, because you have to

View File

@ -252,9 +252,6 @@ genVer tyName ver constructors = do
[] []
return [decl] return [decl]
-- TODO: [easy] add a test that takes data from aelve/guide-database and
-- checks that the data can be loaded
data MigrateConstructor = CopyM Name | CustomM Name ExpQ data MigrateConstructor = CopyM Name | CustomM Name ExpQ
migrateVer :: Name -> Int -> [MigrateConstructor] -> Q Exp migrateVer :: Name -> Int -> [MigrateConstructor] -> Q Exp