# This file's semantics are documented at
# https://docs.gitlab.com/ee/ci/yaml/README.html

stages:
- deps
- build
- test

cache:
    paths:
    - .stack-work
    - .stack-test
    - "*/.stack-work"
    - website/.shakespeare-sass

deps:
    stage: deps
    only:
    - branches@sd/snowdrift
    script:
        # I did these steps manually on the system, since I'm using the shell
        # runner for now.
        #- apt-get --quiet update
        #- apt-get --quiet --assume-yes install curl postgresql libgmp-dev libpq-dev
        #- curl -sSL https://get.haskellstack.org/ | sh
        "stack test --no-run-tests --only-dependencies --install-ghc"

build:
    stage: build
    only:
    - branches@sd/snowdrift
    script:
    - "touch website/src/Settings/StaticFiles.hs"
    - "stack build"

test:
    stage: test
    only:
    - branches@sd/snowdrift
    script: "./build.sh test"

# This file's semantics are documented at
# https://docs.gitlab.com/ee/ci/yaml/README.html

stages:
- deps
- build
- test
- deploy

cache:
    paths:
    - .stack-work
    - .stack-test
    - "*/.stack-work" # subprojects (crowdmatch)
    - website/.shakespeare-sass
    - .stack-deploy

deps:
    stage: deps
    only:
    - branches@sd/snowdrift
    script:
        # I did these steps manually on the system, since I'm using the shell
        # runner for now.
        #- apt-get --quiet update
        #- apt-get --quiet --assume-yes install curl postgresql libgmp-dev libpq-dev
        #- curl -sSL https://get.haskellstack.org/ | sh
        "stack test --no-run-tests --only-dependencies --install-ghc"

test-build:
    stage: build
    only:
    - branches@sd/snowdrift
    script:
    - "touch website/src/Settings/StaticFiles.hs"
    - "stack build"

test:
    stage: test
    only:
    - branches@sd/snowdrift
    script: "./build.sh test"

deploy-build:
    stage: test
    only:
    - branches@sd/snowdrift
    script:
    - DEPLOY=false ./keter.sh
    allow_failure: true

deploy:
    stage: deploy
    script:
    - BUILD=false ./keter.sh
    only:
    # Will only work from master; this also acts as an access control,
    # since only people with commit access to master will be able to deploy.
    - branches@sd/snowdrift
    when: manual
    environment:
        name: production
        url: https://snowdrift.coop

Add deploy to CI pipeline
Add deploy to CI pipeline
