.gitlab-ci.yml 2.04 KB
Newer Older
1
image: python:3.7
Brandon's avatar
Brandon committed
2

Brandon's avatar
Brandon committed
3
stages:
Brandon's avatar
Brandon committed
4
  - build
5
  - test
Brandon's avatar
Brandon committed
6
  - deploy
7 8
  - post-deploy

Brandon's avatar
Brandon committed
9 10
markdown_lint:
  image: node
Brandon's avatar
Brandon committed
11
  stage: test
Brandon's avatar
Brandon committed
12
  script:
Brandon's avatar
Brandon committed
13
    - npm install -g markdownlint-cli
Brandon's avatar
Brandon committed
14
    - bash util/lint-changes.sh
Brandon's avatar
Brandon committed
15
  allow_failure: true
Brandon's avatar
Brandon committed
16 17
  except:
    - master@NERSC/nersc.gitlab.io
Brandon's avatar
Brandon committed
18

19 20
filesize:
  image: ubuntu:latest
Brandon's avatar
Brandon committed
21
  stage: test
Brandon's avatar
Brandon committed
22 23
  before_script:
    - apt-get update && apt-get install -y git
24 25 26
  script:
    - bash util/filesize.sh
  allow_failure: true
Brandon's avatar
Brandon committed
27 28
  except:
    - master@NERSC/nersc.gitlab.io
29

Brandon's avatar
Brandon committed
30
mkdocs_build:
Brandon's avatar
Brandon committed
31
  stage: build
Brandon's avatar
Brandon committed
32
  script:
Brandon's avatar
Brandon committed
33
    - mkdir -p .build_cache
Brandon's avatar
Brandon committed
34
    - pip install --upgrade --cache-dir=.build_cache -r requirements.txt
Brandon's avatar
Brandon committed
35
    - mkdocs --verbose build
Brandon's avatar
Brandon committed
36 37 38 39
  artifacts:
    paths:
    - public
    expire_in: 1 week
Brandon's avatar
Brandon committed
40
  cache:
Brandon's avatar
Brandon committed
41
    key: ${CI_JOB_NAME}
Brandon's avatar
Brandon committed
42 43
    paths:
      - .build_cache
44 45 46 47 48

check_internal_links:
  stage: build
  script:
    - bash util/check-internal-links.sh
Brandon's avatar
Brandon committed
49 50 51 52
    
check_links:
  stage: test
  script:
Brandon's avatar
Brandon committed
53 54
    - mkdir -p .links_cache
    - pip install --cache-dir=.links_cache -r util/requirements.txt
Brandon's avatar
Brandon committed
55
    - python util/scrape_urls.py public
Brandon's avatar
Brandon committed
56
  allow_failure: true
Brandon's avatar
Brandon committed
57
  cache:
Brandon's avatar
Brandon committed
58
    key: ${CI_JOB_NAME}
Brandon's avatar
Brandon committed
59
    paths:
Brandon's avatar
Brandon committed
60
      - .links_cache
Brandon's avatar
Brandon committed
61
      - good-urls-cache.txt
Brandon's avatar
Brandon committed
62 63
  except:
    - master@NERSC/nersc.gitlab.io
Brandon's avatar
Brandon committed
64

65
pages:
Brandon's avatar
Brandon committed
66
  stage: deploy
Brandon's avatar
Brandon committed
67 68
  before_script:
    - pip install htmlmin
Brandon's avatar
Brandon committed
69
  script:
Brandon's avatar
Brandon committed
70 71 72 73
    - gzip -k -6 -r public/assets/stylesheets
    - gzip -k -6 -r public/assets/javascripts
    - find public -type f -name "*.html" -exec htmlmin {} {} \;
    - find public -type f -name "*.html" -exec gzip --keep --verbose {} \;
74 75
    - mkdir -p public/.well-known/pki-validation/
    - echo 1ulpvnf7n6o5idmfdlk4aa2e87 > public/.well-known/pki-validation/godaddy.html
Brandon's avatar
Brandon committed
76 77 78 79
  artifacts:
    paths:
    - public
  only:
Brandon's avatar
Brandon committed
80
    - master@NERSC/nersc.gitlab.io
81 82 83 84 85 86 87 88 89 90 91 92 93

update-search-api:
  stage: post-deploy
  image: ubuntu:18.04
  before_script:
    - apt-get update; apt-get -y install curl
  script:
    - "curl --request POST \
    --url https://nersc-docs-search-app-214117.appspot.com/reindex \
    --header 'content-type: application/json' \
    --data '{\"source\":\"docs\"}'"
  only:
    - master@NERSC/nersc.gitlab.io