forked from vikramIde/airgap-wallet
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
159 lines (149 loc) · 5.79 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
image: docker:latest
variables:
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
- native_build
- qa
build_ionic:
stage: build
script:
- docker build -t $GOOGLE_TAG .
tags:
- docker
unit:
allow_failure: true
stage: test
script:
- docker run --name unit-$CI_COMMIT_SHA $GOOGLE_TAG npm run test-ci
- docker run --name lint-$CI_COMMIT_SHA $GOOGLE_TAG npm run lint-ci
- docker cp unit-$CI_COMMIT_SHA:/app/coverage/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
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
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 $CI_PIPELINE_ID $GOOGLE_TAG_ANDROID_CURRENT echo "container ran."
- docker cp $CI_PIPELINE_ID:/app/android-release-unsigned.apk airgap-wallet-release-unsigned-$CI_PIPELINE_ID.apk
- docker cp $CI_PIPELINE_ID:/app/android-debug.apk airgap-wallet-debug-$CI_PIPELINE_ID.apk
after_script:
- docker rm -f $CI_PIPELINE_ID || true
artifacts:
paths:
- airgap-wallet-release-unsigned-$CI_PIPELINE_ID.apk
- airgap-wallet-debug-$CI_PIPELINE_ID.apk
build_ios:
stage: native_build
when: manual
before_script:
- echo "$IOS_BUILD_JSON" > build.json
- echo "$IOS_EXPORT_OPTIONS" > exportOptions.plist
script:
- export DEVELOPER_DIR=$XCODE_PATH
- nvm use v10.13.0
- npm install
- npm run disable-pure-getters
- npm run configure-mangle
- npm run apply-diagnostic-modules # manually remove unused cordova-diagnostic-plugin modules
- ionic build --prod
- npx cap sync ios
- xcodebuild -workspace ios/App/App.xcworkspace -scheme "App" -destination generic/platform=iOS -configuration Release archive -archivePath ios/AirGap\ Wallet.xcarchive MARKETING_VERSION=$VERSION CURRENT_PROJECT_VERSION=1.0.$CI_PIPELINE_ID -allowProvisioningUpdates
- xcodebuild -exportArchive -archivePath ios/AirGap\ Wallet.xcarchive -exportOptionsPlist exportOptions.plist -exportPath ios/ -allowProvisioningUpdates
- xcrun altool --upload-app -f ios/App.ipa -u $IOS_USERNAME -p $IOS_PASSWORD
artifacts:
paths:
- ios/App.ipa
tags:
- ios
build_mac:
stage: native_build
when: manual
script:
- 'sed -i -e "s/\"version\": \"0.0.1\"/\"version\": \"${VERSION}\"/g" electron/package.json'
- npm install
- npm --prefix electron/ install
- npm run build:electron
- npx cap sync electron
- npm --prefix electron/ run build:mac
artifacts:
name: 'electron_macos'
paths:
- electron/build/airgap-wallet-$VERSION.dmg
- electron/build/airgap-wallet-$VERSION.dmg.blockmap
- electron/build/airgap-wallet-$VERSION-mac.zip
tags:
- ios
build_linux:
stage: native_build
when: manual
tags:
- docker
script:
- docker build -f build/electron/linux/Dockerfile -t $GOOGLE_TAG_ELECTRON_LINUX_CURRENT --build-arg VERSION="$VERSION" .
- docker run --name $CI_PIPELINE_ID $GOOGLE_TAG_ELECTRON_LINUX_CURRENT echo "container ran."
- docker cp $CI_PIPELINE_ID:/app/electron/build/airgap-wallet-$VERSION.AppImage electron/airgap-wallet-$VERSION.AppImage
after_script:
- docker rm -f $CI_PIPELINE_ID || true
artifacts:
name: 'electron_linux'
paths:
- electron/airgap-wallet-$VERSION.AppImage
build_windows:
stage: native_build
when: manual
tags:
- docker
script:
- docker build -f build/electron/windows/Dockerfile -t $GOOGLE_TAG_ELECTRON_WINDOWS_CURRENT --build-arg VERSION="$VERSION" .
- docker run --name $CI_PIPELINE_ID $GOOGLE_TAG_ELECTRON_WINDOWS_CURRENT echo "container ran."
- docker cp $CI_PIPELINE_ID:/app/electron/build/airgap-wallet-$VERSION.exe electron/airgap-wallet-$VERSION.exe
- docker cp $CI_PIPELINE_ID:/app/electron/build/airgap-wallet-$VERSION.exe.blockmap electron/airgap-wallet-$VERSION.exe.blockmap
after_script:
- docker rm -f $CI_PIPELINE_ID || true
artifacts:
name: 'electron_windows'
paths:
- electron/airgap-wallet-$VERSION.exe
- electron/airgap-wallet-$VERSION.exe.blockmap
qa:
stage: qa
script:
- docker create --name qa-$CI_PIPELINE_ID $GOOGLE_TAG npm run 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