Fakultas Ilmu Komputer UI

.gitlab-ci.yml 1.17 KB
Newer Older
wulanmantiri's avatar
wulanmantiri committed
1
2
3
4
5
6
7
8
9
10
image: reactnativecommunity/react-native-android

cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - node_modules/
    - android/
    - ios/

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

15
16
17
18
19
test:
  stage: test
  before_script:
    - yarn install
  script:
20
    - yarn test --coverage --watchAll=false --verbose --collectCoverageFrom="src/**/*.tsx"
21
22
23
  artifacts:
    paths:
      - coverage
24

Wulan Mantiri's avatar
Wulan Mantiri committed
25
26
27
28
29
30
31
32
33
34
35
36
sonar-scanner:
  image:
    name: sonarsource/sonar-scanner-cli:latest
    entrypoint: [""]
  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

wulanmantiri's avatar
wulanmantiri committed
37
38
39
40
41
42
43
44
build:
  stage: build
  before_script:
    - yarn install
    - export ANDROID_SDK_ROOT=/usr/lib/android-sdk
  script:
    - cd android
    - chmod +x gradlew && ./gradlew assembleRelease
45
    - cd .. && cp android/app/build/outputs/apk/release/app-release.apk $CI_PROJECT_NAME-$CI_COMMIT_REF_NAME.apk
wulanmantiri's avatar
wulanmantiri committed
46
47
48
  artifacts:
    name: "$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME"
    paths:
49
50
51
52
      - $CI_PROJECT_NAME-$CI_COMMIT_REF_NAME.apk
  except:
    changes:
      - "README.md"
wulanmantiri's avatar
wulanmantiri committed
53
54
55
  only:
    - staging
    - master