-
Notifications
You must be signed in to change notification settings - Fork 110
/
.gitlab-ci.yml
executable file
·119 lines (111 loc) · 4.26 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
image: docker:latest
variables:
SHARED_PATH: /builds/shared/$CI_PROJECT_PATH
GOOGLE_TAG: eu.gcr.io/papers-kubernetes/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:$CI_COMMIT_SHA
GOOGLE_TAG_ANDROID_CURRENT: eu.gcr.io/papers-kubernetes/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:android-$CI_COMMIT_SHA
GOOGLE_TAG_ELECTRON_LINUX_CURRENT: eu.gcr.io/papers-kubernetes/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:electron-linux-$CI_COMMIT_SHA
GOOGLE_TAG_ELECTRON_WINDOWS_CURRENT: eu.gcr.io/papers-kubernetes/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:electron-windows-$CI_COMMIT_SHA
stages:
- build
- test
# - qa
- native_build
- publish
build_ionic:
stage: build
script:
- docker build -t $GOOGLE_TAG .
tags:
- docker
unit:
stage: test
script:
- docker run --name unit-$CI_COMMIT_SHA $GOOGLE_TAG yarn test-ci
- docker run --name lint-$CI_COMMIT_SHA $GOOGLE_TAG yarn lint-ci
- docker cp unit-$CI_COMMIT_SHA:/app/src/coverage/report-lcov/lcov.info lcov.info
- docker cp lint-$CI_COMMIT_SHA:/app/lintReport.json lintReport.json
after_script:
- docker rm unit-$CI_COMMIT_SHA
- docker rm lint-$CI_COMMIT_SHA
tags:
- docker
artifacts:
paths:
- lcov.info
- lintReport.json
build_android:
stage: native_build
when: manual
tags:
- docker
variables:
LOCAL_ANDROID: 'android-$CI_PIPELINE_ID'
script:
- sed -i -e "s/versionName \"0.0.0\"/versionName \"$VERSION\"/g" android/app/build.gradle
- docker build -f build/android/Dockerfile -t $GOOGLE_TAG_ANDROID_CURRENT --build-arg BUILD_NR="$CI_PIPELINE_ID" --build-arg VERSION="$VERSION" .
- docker run --name $LOCAL_ANDROID $GOOGLE_TAG_ANDROID_CURRENT echo "container ran."
- docker cp $LOCAL_ANDROID:/app/android-release-unsigned.apk airgap-vault-release-unsigned-$CI_PIPELINE_ID.apk
- docker cp $LOCAL_ANDROID:/app/android-debug-aligned.apk airgap-vault-debug-$CI_PIPELINE_ID.apk
after_script:
- docker rm -f $LOCAL_ANDROID || true
artifacts:
paths:
- airgap-vault-release-unsigned-$CI_PIPELINE_ID.apk
- airgap-vault-debug-$CI_PIPELINE_ID.apk
# qa:
# stage: qa
# script:
# - docker create --name qa-$CI_PIPELINE_ID $GOOGLE_TAG yarn sonar-scanner -- -X
# -Dsonar.typescript.lcov.reportPaths=lcov.info
# -Dsonar.typescript.tslint.reportPaths=lintReport.json
# -Dsonar.test.inclusions=**/*.spec.ts
# -Dsonar.tests=src/
# -Dsonar.exclusions=**/node_modules/**,**/*.spec.ts,src/assets/libs/**
# -Dsonar.sources=src/
# -Dsonar.host.url=$SONAR_URL
# -Dsonar.login=$SONAR_LOGIN
# -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA
# -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
# -Dsonar.gitlab.project_id=$CI_PROJECT_ID
# -Dsonar.branch.name=$CI_BUILD_REF_NAME
# - docker cp lcov.info qa-$CI_PIPELINE_ID:/app/lcov.info
# - docker cp lintReport.json qa-$CI_PIPELINE_ID:/app/lintReport.json
# - docker start -a qa-$CI_PIPELINE_ID
# after_script:
# - docker rm -f qa-$CI_PIPELINE_ID || true
# tags:
# - docker
build_ios:
stage: native_build
when: manual
before_script:
- echo "$IOS_BUILD_JSON" > build.json
script:
- export DEVELOPER_DIR=$XCODE_PATH
- nvm use 18
- npm i -g yarn
- yarn install --frozen-lockfile
- yarn prepare-prod-build
- yarn apply-diagnostic-modules # manually remove unused cordova-diagnostic-plugin modules
- yarn ionic info
- yarn ionic build --prod
- yarn cap sync ios
- xcodebuild -workspace ios/App/App.xcworkspace -scheme "App" -destination generic/platform=iOS -configuration Release archive -archivePath ios/airgap-vault-$VERSION-$CI_PIPELINE_ID.xcarchive MARKETING_VERSION=$VERSION CURRENT_PROJECT_VERSION=$CI_PIPELINE_ID -allowProvisioningUpdates
artifacts:
paths:
- ios/airgap-vault-$VERSION-$CI_PIPELINE_ID.xcarchive
tags:
- ios
publish_ios:
stage: publish
when: manual
needs:
- build_ios
before_script:
- echo "$IOS_EXPORT_OPTIONS" > exportOptions.plist
script:
- export DEVELOPER_DIR=$XCODE_PATH
- xcodebuild -exportArchive -archivePath ios/airgap-vault-$VERSION-$CI_PIPELINE_ID.xcarchive -exportOptionsPlist exportOptions.plist -exportPath ios/ -allowProvisioningUpdates
- xcrun altool --upload-app -f ios/App.ipa -t ios -u $IOS_USERNAME -p $IOS_PASSWORD
tags:
- ios