Fakultas Ilmu Komputer UI

.gitlab-ci.yml 1.47 KB
Newer Older
WILLIAM GATES's avatar
WILLIAM GATES committed
1
stages:
WILLIAM GATES's avatar
WILLIAM GATES committed
2
  - lint
WILLIAM GATES's avatar
WILLIAM GATES committed
3
  - test
WILLIAM GATES's avatar
WILLIAM GATES committed
4
  - sonar_scanner_test
WILLIAM GATES's avatar
WILLIAM GATES committed
5
6
  - deploy

WILLIAM GATES's avatar
WILLIAM GATES committed
7
8
9
10
11
12
13
lint:
  image: node:latest
  stage: lint
  script:
    - npm install
    - npm run lint

WILLIAM GATES's avatar
WILLIAM GATES committed
14
15
16
test:
  image: node:latest
  stage: test
WILLIAM GATES's avatar
WILLIAM GATES committed
17
18
19
20
21
  artifacts:
    expire_in: 1 hour
    paths:
      - coverage/lcov.info
      - test-report.xml
WILLIAM GATES's avatar
WILLIAM GATES committed
22
23
24
25
  script:
    - npm install
    - npm run test:coverage

WILLIAM GATES's avatar
WILLIAM GATES committed
26
27
28
29
30
31
32
33
34
35
sonar_scanner_test:
  image:
    name: sonarsource/sonar-scanner-cli:latest
    entrypoint: [""]
  stage: sonar_scanner_test
  dependencies:
    - test
  script:
    - sonar-scanner -Dsonar.projectKey=$SONARQUBE_PROJECT_KEY -Dsonar.host.url=$SONARQUBE_HOST_URL -Dsonar.login=$SONARQUBE_TOKEN -Dsonar.branch.name=$CI_COMMIT_REF_NAME

WILLIAM GATES's avatar
WILLIAM GATES committed
36
37
38
39
40
41
42
43
staging:
  image: node:latest
  stage: deploy
  variables:
    NETLIFY_AUTH_TOKEN: $STAGING_NETLIFY_AUTH_TOKEN
    NETLIFY_SITE_ID: $STAGING_NETLIFY_SITE_ID
  script:
    - npm install
WILLIAM GATES's avatar
WILLIAM GATES committed
44
    - CI=false npm run build
WILLIAM GATES's avatar
WILLIAM GATES committed
45
    - npm install netlify-cli -g
WILLIAM GATES's avatar
WILLIAM GATES committed
46
    - netlify deploy --dir dist --prod
WILLIAM GATES's avatar
WILLIAM GATES committed
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  only:
    - staging

production:
  image: node:latest
  stage: deploy
  variables:
    AWS_ACCESS_KEY_ID: $PRODUCTION_AWS_ACCESS_KEY_ID
    AWS_SECRET_ACCESS_KEY: $PRODUCTION_AWS_SECRET_ACCESS_KEY
    AWS_STORAGE_BUCKET_NAME: $PRODUCTION_AWS_STORAGE_BUCKET_NAME
  script:
    - npm install
    - CI=false npm run build
    - apt update -y && apt install python3-dev python3-pip zip -y
    - pip3 install awscli
    - cd dist
    - zip -r home-industry.zip *
    - aws s3 cp home-industry.zip s3://$AWS_STORAGE_BUCKET_NAME
  only:
    - master