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: default:
image: fpco/stack-build:lts-13.21 image: fpco/stack-build:lts-13.21
services:
- postgres:latest
variables: variables:
STACK_ROOT: "${CI_PROJECT_DIR}/.stack" STACK_ROOT: "${CI_PROJECT_DIR}/.stack"
CHROME_BIN: "/usr/bin/chromium-browser" CHROME_BIN: "/usr/bin/chromium-browser"
POSTGRES_DB: uniworx_test
POSTGRES_USER: uniworx
POSTGRES_PASSWORD: uniworx
PGHOST: postgres
stages: stages:
- setup - setup
- frontend:build - frontend:build
- yesod:build - yesod:build
- lint
- test - test
npm install: npm install:
@ -44,6 +52,16 @@ frontend:build:
dependencies: dependencies:
- npm install - npm install
frontend:lint:
stage: lint
script:
- npm run frontend:lint
before_script: *npm
needs:
- npm install
dependencies:
- npm install
yesod:build:dev: yesod:build:dev:
stage: yesod:build stage: yesod:build
script: script:
@ -61,12 +79,40 @@ yesod:build:dev:
- .stack-work - .stack-work
artifacts: artifacts:
paths: paths:
- bin/uniworx - bin/
name: "${CI_JOB_NAME}" name: "${CI_JOB_NAME}"
expire_in: "1 week" expire_in: "1 week"
dependencies: dependencies:
- frontend:build - 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: frontend:test:
stage: test stage: test
script: script:
@ -80,3 +126,48 @@ frontend:test:
- apt-get install -y --no-install-recommends chromium-browser - apt-get install -y --no-install-recommends chromium-browser
dependencies: dependencies:
- npm install - 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].*/'