.gitlab-ci.yml 1.68 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
46
47
48
49
50
51
52
    - cd www
    - npm install
    - npm run build
  artifacts:
    paths:
      - www/dist
  only:
    - master
53
    - tags
Anton Weber's avatar
Anton Weber committed
54

55
56
57
58
59
60
61
62
63
clippy:
  stage: qa
  cache:
    # inherit all global cache settings
    <<: *global_cache
    key: merge-requests
  script:
    - RUSTFLAGS=-Dwarnings wasm-pack build --dev
    - |
64
      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
65
66
67
68
69
70
71
  artifacts:
    reports:
      codequality: code-quality.json
  only:
    - master
    - merge_requests

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