.gitlab-ci.yml 1.79 KB
Newer Older
Bryan Richter's avatar
Bryan Richter committed
1
# This file's semantics are documented at
Bryan Richter's avatar
Bryan Richter committed
2
# https://docs.gitlab.com/ce/ci/yaml/README.html
Bryan Richter's avatar
Bryan Richter committed
3 4

stages:
Bryan Richter's avatar
Bryan Richter committed
5 6 7 8 9
  - deps
  - build
  - test
  - deploy-build
  - deploy
10 11

cache:
Bryan Richter's avatar
Bryan Richter committed
12
  paths:
13
    - .stack-work
Bryan Richter's avatar
Bryan Richter committed
14
    - .stack-test
15
    - "*/.stack-work" # subprojects (crowdmatch)
16
    - website/.shakespeare-sass
17
    - .stack-deploy
18
    - SnowdriftReboot.keter
Bryan Richter's avatar
Bryan Richter committed
19

Bryan's avatar
Bryan committed
20 21 22 23 24 25
# Don't even try to run for forks. It will fail anyway, because the sole
# runner is protected. This prevents an ugly stalled CI experience.
.only_parent: &only_parent
  only:
    - branches@sd/snowdrift

Bryan Richter's avatar
Bryan Richter committed
26
deps:
Bryan's avatar
Bryan committed
27
  <<: *only_parent
Bryan Richter's avatar
Bryan Richter committed
28 29 30 31 32 33 34 35
  stage: deps
  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"
Bryan Richter's avatar
Bryan Richter committed
36

Bryan Richter's avatar
Bryan Richter committed
37
# Build for test
38
test-build:
Bryan's avatar
Bryan committed
39
  <<: *only_parent
Bryan Richter's avatar
Bryan Richter committed
40 41
  stage: build
  script:
42 43
    - "touch website/src/Settings/StaticFiles.hs"
    - "stack build"
Bryan Richter's avatar
Bryan Richter committed
44 45

test:
Bryan's avatar
Bryan committed
46
  <<: *only_parent
Bryan Richter's avatar
Bryan Richter committed
47 48
  stage: test
  script: "./build.sh test"
49

Bryan Richter's avatar
Bryan Richter committed
50
# Build for deploy, using --pedantic
51
deploy-build:
Bryan's avatar
Bryan committed
52
  <<: *only_parent
Bryan Richter's avatar
Bryan Richter committed
53 54
  stage: deploy-build
  script:
Bryan's avatar
Bryan committed
55 56
    - DEPLOY=false ./s/deploy
  # Don't force pedantry on people.
Bryan Richter's avatar
Bryan Richter committed
57
  allow_failure: true
58 59

deploy:
Bryan Richter's avatar
Bryan Richter committed
60 61
  stage: deploy
  script:
Bryan's avatar
Bryan committed
62
    - BUILD=false ./s/deploy
Bryan Richter's avatar
Bryan Richter committed
63 64 65 66 67 68
  only:
    # Only deploy from master.
    #
    # This is not a security measure, since someone could push a branch that
    # changes this line. It's a convenience. Security is maintained by only
    # allowing production secrets to be sent to protected branches.
69
    - master@sd/snowdrift
Bryan's avatar
Bryan committed
70 71 72
  # The scheduled runs don't get deployed.
  except:
    - schedules
Bryan Richter's avatar
Bryan Richter committed
73 74 75 76
  when: manual
  environment:
    name: production
    url: https://snowdrift.coop