.gitlab-ci.yml 2.91 KB
Newer Older
Connor Shea's avatar
Connor Shea committed
1 2
# This file is a template, and might need editing before it works on your project.
# Full project: https://gitlab.com/pages/nanoc
Connor Shea's avatar
Connor Shea committed
3
image: ruby:2.4
Connor Shea's avatar
Connor Shea committed
4

5
stages:
6
  - build
7 8 9
  - test
  - deploy

Connor Shea's avatar
Connor Shea committed
10
before_script:
11
  - ruby -v
12 13
  - bundle install --jobs 4 --path vendor

14
variables:
15 16 17 18
  BRANCH_CE: 'master'
  BRANCH_EE: 'master'
  BRANCH_OMNIBUS: 'master'
  BRANCH_RUNNER: 'master'
19

20 21
compile:
  stage: build
22 23
  script:
    - rake pull_repos
24
    - nanoc compile -VV
25 26 27
  artifacts:
    paths:
      - public
28
    expire_in: 1w
29 30 31 32 33
  cache:
    key: "$CI_BUILD_NAME/$CI_BUILD_REF_NAME"
    paths:
      - tmp/
      - vendor/ruby
34 35
  tags:
    - docker
36

37 38 39 40 41
internal_links:
  stage: test
  script:
    - nanoc check internal_links
  allow_failure: true
42 43 44 45
  cache:
    key: "$CI_BUILD_NAME/$CI_BUILD_REF_NAME"
    paths:
      - vendor/ruby
46 47
  tags:
    - docker
48 49
  dependencies:
    - compile
50 51 52
  # Skip this job when it's invoked by a cross project pipeline. That will speed
  # up the pipeline when a docs preview is triggered. We already check for
  # internal links in every MR anyway. For more info:
53 54
  # https://docs.gitlab.com/ee/development/writing_documentation.html#previewing-the-changes-live
  except:
55
    - pipelines
56

57 58 59 60
scss_lint:
  stage: test
  script:
    - bundle exec scss-lint
61 62 63 64
  cache:
    key: "$CI_BUILD_NAME/$CI_BUILD_REF_NAME"
    paths:
      - vendor/ruby
65 66
  tags:
    - docker
67 68 69
  # Skip this job when it's invoked by a cross project pipeline. That will speed
  # up the pipeline when a docs preview is triggered. The triggered pipeline is
  # always a branch off master which should be green anyway. For more info:
70 71
  # https://docs.gitlab.com/ee/development/writing_documentation.html#previewing-the-changes-live
  except:
72
    - pipelines
73

74 75
review:
  stage: deploy
76 77
  variables:
    GIT_STRATEGY: none
78
  before_script: []
79
  cache: {}
80
  script:
81
    - rsync -av --delete public /srv/nginx/pages/$CI_BUILD_REF_SLUG
82
  environment:
83 84
    name: review/$CI_BUILD_REF_SLUG
    url: http://$CI_BUILD_REF_SLUG.$APPS_DOMAIN
85 86
    on_stop: review_stop
  only:
87
    - branches@gitlab-com/gitlab-docs
88 89 90 91 92 93 94 95
  except:
    - master
  tags:
    - nginx
    - review-apps

review_stop:
  stage: deploy
96 97
  variables:
    GIT_STRATEGY: none
98
  before_script: []
99 100
  artifacts: {}
  cache: {}
101
  dependencies: []
102
  script:
103
    - rm -rf public /srv/nginx/pages/$CI_BUILD_REF_SLUG
104 105
  when: manual
  environment:
106
    name: review/$CI_BUILD_REF_SLUG
107
    action: stop
108
  only:
109
    - branches@gitlab-com/gitlab-docs
110 111
  except:
    - master
112 113 114 115
  tags:
    - nginx
    - review-apps

Connor Shea's avatar
Connor Shea committed
116
pages:
117
  stage: deploy
118 119 120 121
  variables:
    GIT_STRATEGY: none
  before_script: []
  cache: {}
122 123
  environment:
    name: production
124
    url: https://docs.gitlab.com
Connor Shea's avatar
Connor Shea committed
125
  script:
126 127
    # Symlink all README.html to index.html
    - for i in `find public -name README.html`; do ln -sf README.html $(dirname $i)/index.html; done
Connor Shea's avatar
Connor Shea committed
128 129
  artifacts:
    paths:
130
    - public
131
    expire_in: 1h
Connor Shea's avatar
Connor Shea committed
132
  only:
133
    - master@gitlab-com/gitlab-docs
134 135
  tags:
    - docker
136 137
  dependencies:
    - compile