Fakultas Ilmu Komputer UI

.gitlab-ci.yml 1.68 KB
Newer Older
wulanmantiri's avatar
wulanmantiri committed
1
2
3
4
5
6
7
8
cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - node_modules/
    - android/
    - ios/

stages:
9
  - lint
10
  - test
11
  - pbi-sonar-scanner
Wulan Mantiri's avatar
Wulan Mantiri committed
12
  - sonar-scanner
wulanmantiri's avatar
wulanmantiri committed
13
14
  - build

15
16
17
lint:
  image: node:slim
  stage: lint
18
19
20
  before_script:
    - yarn install
  script:
21
    - yarn lint
22
23
24
25
26
27
28

test:
  image: node:slim
  stage: test
  before_script:
    - yarn install
  script:
29
    - yarn test --silent
30
31
32
  artifacts:
    paths:
      - coverage
33

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
pbi-sonar-scanner:
  image:
    name: sonarsource/sonar-scanner-cli:latest
    entrypoint: ['']
  stage: pbi-sonar-scanner
  script:
    - sonar-scanner
      -Dsonar.host.url=$SONARQUBE_URL
      -Dsonar.login=$SONARQUBE_TOKEN
      -Dsonar.branch.name=$CI_COMMIT_REF_NAME
      -Dsonar.branch.target=staging
      -Dsonar.projectKey=$SONARQUBE_PROJECT_KEY
  except:
    - staging
    - master

Wulan Mantiri's avatar
Wulan Mantiri committed
50
51
52
sonar-scanner:
  image:
    name: sonarsource/sonar-scanner-cli:latest
53
    entrypoint: ['']
Wulan Mantiri's avatar
Wulan Mantiri committed
54
55
56
57
58
59
60
  stage: sonar-scanner
  script:
    - sonar-scanner
      -Dsonar.host.url=$SONARQUBE_URL
      -Dsonar.login=$SONARQUBE_TOKEN
      -Dsonar.branch.name=$CI_COMMIT_REF_NAME
      -Dsonar.projectKey=$SONARQUBE_PROJECT_KEY
61
62
63
  only:
    - staging
    - master
Wulan Mantiri's avatar
Wulan Mantiri committed
64

Wulan Mantiri's avatar
Wulan Mantiri committed
65
android:
66
  image: reactnativecommunity/react-native-android
wulanmantiri's avatar
wulanmantiri committed
67
68
69
70
71
72
  stage: build
  before_script:
    - yarn install
    - export ANDROID_SDK_ROOT=/usr/lib/android-sdk
  script:
    - cd android
73
    - chmod +x gradlew && ./gradlew assembleRelease
74
    - cd .. && cp android/app/build/outputs/apk/release/app-release.apk $CI_PROJECT_NAME-$CI_COMMIT_REF_NAME.apk
wulanmantiri's avatar
wulanmantiri committed
75
  artifacts:
76
    name: '$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME'
wulanmantiri's avatar
wulanmantiri committed
77
    paths:
78
79
80
      - $CI_PROJECT_NAME-$CI_COMMIT_REF_NAME.apk
  except:
    changes:
81
      - 'README.md'
wulanmantiri's avatar
wulanmantiri committed
82
83
84
  only:
    - staging
    - master