1
1
mirror of https://github.com/aelve/guide.git synced 2024-11-25 18:56:52 +03:00
guide/Makefile
Vladislav Sabanov e371f8d129 Load into postgres and check it. (#383)
* Insert all categories from Acid to Postgres

* Check postgres == acidstate

* Fix schema

* Redo the way undocumented definitions are counted (#381)

* Redo the way undocumented definitions are counted

* Fix YAML

* Fix a typo

* Generate swagger.json for branches (#380)

* Generate swagger.json for branches

* Fix

* Fix again

* Fix once more

* [skip ci] Regenerate swagger.json

* Don't log debug info to stdout

* Push even if the branch is ahead

* Fix

* Empty

* [skip ci] Regenerate swagger.json

* Don't use "skip ci"

* Enable all unobjectionable extensions (#384)

* Enable OverloadedStrings by default

* Remove pragmas for default extensions

* Enable some other extensions

* Enable TemplateHaskell

* Add logger

* Update cli

* Fix orders updater

* Cut UTC off. Precision 12 -> 9

* Delete item (trait) from category (item) if it marked 'deleted'
And add item (trait) to category (item) if it not marked 'deleted'

* Remove pragmas

* Update makefile, and check untill True with remote base

* Add check equality in travis

* Fix travis: wait for postgres

* Fix travis. Use native service

* Fix redirection

* Fix condition

* Make checks simple

* Refactor on comments. Everything but the last one.
Dumb or not dumb is still the question. (Concerning queries)
2019-08-23 07:49:44 +00:00

70 lines
2.1 KiB
Makefile

SHELL := /bin/bash
# Build the project
.PHONY: back
back:
stack build --fast
# Run tests
.PHONY: back/test
back/test:
stack test --fast
# Download the official database
.PHONY: back/db
back/db:
rm -rf back/state
git clone --depth 1 https://github.com/aelve/guide-database.git
mv guide-database back/state
(cd back/state && gzip -d *.gz)
# Test that the official database can be loaded
.PHONY: back/test-db
back/test-db: back
if [ -d back/state ]; then mv back/state back/state-old; fi
git clone --depth 1 https://github.com/aelve/guide-database.git
mv guide-database back/state
(cd back/state && gzip -d *.gz)
(cd back/state && git branch -v && git status && ls)
stack exec --cwd back -- guide dry-run
rm -rf back/state
if [ -d back/state-old ]; then mv back/state-old back/state; fi
# Run the backend
.PHONY: back/run
back/run:
stack exec --cwd back -- guide
# Load AcidState base to Postgres and check equality.
# Postgres should be installed already.
# 'Guide' base should be created already and clear.
.PHONY: back/load-into-postgres
back/load-into-postgres:
stack exec --cwd back -- guide load-into-postgres
# Create a Docker image for the backend; will only work on Travis because
# the binary has to have been compiled on Ubuntu Xenial (the OS used in the
# Docker file).
#
# Assumes Guide has been built with Stack.
.PHONY: back/travis-docker
back/travis-docker:
rm -rf docker/back/files && mkdir docker/back/files
git clone --depth 1 https://github.com/aelve/guide-database.git \
docker/back/files/state
(cd docker/back/files/state && gzip -d *.gz)
rm -rf docker/back/files/state/.git
cp "$$(stack path --local-install-root)/bin/guide" docker/back/files/
cp -R back/{static,templates} docker/back/files/
docker build docker/back -t quay.io/aelve/guide:$(tag)
rm -rf docker/back/files
# Create a Docker image for the front;
.PHONY: front/travis-docker
front/travis-docker:
rm -rf docker/front/files && mkdir docker/front/files
cp -R front/dist docker/front/files/
cd ./docker/front/files/dist/ && export NODE_ENV=production && npm install
docker build docker/front -t quay.io/aelve/guide:$(tag)
rm -rf docker/front/files