.gitlab-ci.yml 1.73 KB
Newer Older
Anton Weber's avatar
Anton Weber committed
1 2 3 4 5
image: "engel-simulator-builder:latest"

stages:
  - check
  - build
6
  - qa
Anton Weber's avatar
Anton Weber committed
7
  - deploy
Anton Weber's avatar
Anton Weber committed
8

Rahix's avatar
Rahix committed
9 10 11 12 13
cache: &global_cache
  paths:
    - target/
    - www/node_modules/

Anton Weber's avatar
Anton Weber committed
14 15 16 17 18 19 20 21 22 23 24
check:
  stage: check
  script:
    - rustc --version
    - cargo --version
    - cargo fmt -- --check
  only:
    - merge_requests

build-dev:
  stage: build
Rahix's avatar
Rahix committed
25 26 27 28
  cache:
    # inherit all global cache settings
    <<: *global_cache
    key: merge-requests
Anton Weber's avatar
Anton Weber committed
29
  script:
Rahix's avatar
Rahix committed
30
    - cd www
31
    - rm -f node_modules/engel-simulator-2020
Rahix's avatar
Rahix committed
32
    - npm install
33
    - RUSTFLAGS=-Dwarnings npm run build -- --mode development
Anton Weber's avatar
Anton Weber committed
34 35 36 37 38
  only:
    - merge_requests

build-release:
  stage: build
Rahix's avatar
Rahix committed
39 40 41 42
  cache:
    # inherit all global cache settings
    <<: *global_cache
    key: release-build
Anton Weber's avatar
Anton Weber committed
43
  script:
44
    - touch .git/HEAD
Anton Weber's avatar
Anton Weber committed
45
    - cd www
Rahix's avatar
Rahix committed
46
    - rm -f node_modules/engel-simulator-2020
Anton Weber's avatar
Anton Weber committed
47 48 49 50 51 52 53
    - npm install
    - npm run build
  artifacts:
    paths:
      - www/dist
  only:
    - master
54
    - tags
Anton Weber's avatar
Anton Weber committed
55

56 57 58 59 60 61 62 63 64
clippy:
  stage: qa
  cache:
    # inherit all global cache settings
    <<: *global_cache
    key: merge-requests
  script:
    - RUSTFLAGS=-Dwarnings wasm-pack build --dev
    - |
65
      cargo clippy --message-format json | jq -s 'map(. | select(.reason == "compiler-message" and .message.code != null) | {description: .message.message, location: {path: .message.spans[0].file_name, lines: {begin: .message.spans[0].line_start}}, fingerprint: [.message.code, .message.message, (.message.spans | map([.file_name, .line_start, .line_end, .column_start, .column_end]))] | @base64, severity: "minor"})' >code-quality.json
66 67 68 69 70 71 72
  artifacts:
    reports:
      codequality: code-quality.json
  only:
    - master
    - merge_requests

Anton Weber's avatar
Anton Weber committed
73 74 75 76 77
deploy:
  stage: deploy
  tags:
    - local
  script:
Rahix's avatar
Rahix committed
78
    - ./ci/deploy.sh www/dist /var/www
Anton Weber's avatar
Anton Weber committed
79 80
  only:
    - master
81
    - tags