chore: set up backend tests

This commit is contained in:
Gregor Kleen 2019-11-08 13:51:04 +01:00
parent 43aff72314
commit ca8edfd731

View File

@ -1,14 +1,22 @@
default:
image: fpco/stack-build:lts-13.21
services:
- postgres:latest
variables:
STACK_ROOT: "${CI_PROJECT_DIR}/.stack"
CHROME_BIN: "/usr/bin/chromium-browser"
POSTGRES_DB: uniworx_test
POSTGRES_USER: uniworx
POSTGRES_PASSWORD: uniworx
PGHOST: postgres
stages:
- setup
- frontend:build
- yesod:build
- lint
- test
npm install:
@ -44,6 +52,16 @@ frontend:build:
dependencies:
- npm install
frontend:lint:
stage: lint
script:
- npm run frontend:lint
before_script: *npm
needs:
- npm install
dependencies:
- npm install
yesod:build:dev:
stage: yesod:build
script:
@ -61,12 +79,40 @@ yesod:build:dev:
- .stack-work
artifacts:
paths:
- bin/uniworx
- bin/
name: "${CI_JOB_NAME}"
expire_in: "1 week"
dependencies:
- frontend:build
only:
- '${CI_COMMIT_REF_SLUG} !~ /^v[0-9].*/'
yesod:build:
stage: yesod:build
script:
- stack build --copy-bins --local-bin-path $(pwd)/bin --flag uniworx:-library-only --flag uniworx:-dev --flag uniworx:pedantic
needs:
- frontend:build
before_script:
- apt-get update
- apt-get install -y --no-install-recommends locales-all
- ln -s $(which g++-7) $(dirname $(which g++-7))/g++
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- .stack
- .stack-work
artifacts:
paths:
- bin/
name: "${CI_JOB_NAME}"
dependencies:
- frontend:build
only:
- '${CI_COMMIT_REF_SLUG} =~ /^v[0-9].*/'
frontend:test:
stage: test
script:
@ -80,3 +126,48 @@ frontend:test:
- apt-get install -y --no-install-recommends chromium-browser
dependencies:
- npm install
hlint:dev:
stage: lint
script:
- stack test --fast --flag uniworx:-library-only --flag uniworx:dev --flag uniworx:pedantic uniworx:test:hlint
needs:
- frontend:build
- yesod:build:dev # For caching
before_script:
- apt-get update
- apt-get install -y --no-install-recommends locales-all
- ln -s $(which g++-7) $(dirname $(which g++-7))/g++
dependencies:
- frontend:build
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- .stack
- .stack-work
only:
- '${CI_COMMIT_REF_SLUG} !~ /^v[0-9].*/'
yesod:test:dev:
stage: test
script:
- stack test --coverage --fast --flag uniworx:-library-only --flag uniworx:-dev --flag uniworx:pedantic --skip hlint
needs:
- frontend:build
- yesod:build:dev # For caching
before_script:
- apt-get update
- apt-get install -y --no-install-recommends locales-all
- ln -s $(which g++-7) $(dirname $(which g++-7))/g++
dependencies:
- frontend:build
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- .stack
- .stack-work
only:
- '${CI_COMMIT_REF_SLUG} !~ /^v[0-9].*/'