-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
130 lines (120 loc) · 4.82 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
# see https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Ruby.gitlab-ci.yml
image: node:16
variables:
CI_SERVER_HOST: www.ci.nymte.ch
CI_SERVER_COMPONENT_NAME: nym-pcc
CI_SERVER_USERNAME: gitlab
CI_SERVER_DIR: /var/www/branches
NYM_PROJECT_NAME: "Private COVID Passport"
NYM_CI_WWW_BASE: ci.nymte.ch
KEYBASE_NYMBOT_USERNAME: nymbot
KEYBASE_NYM_CHANNEL: ci-nym-pcc
#build-rust:
# stage: build
# image: marksinclair/rust-wasm-pack
# tags:
# - docker # tag this job with 'docker' so that it runs on gitlab runners with docker
# script:
# # install wasm-pack
# - cargo install wasm-pack
# # clone nym and use branch for covid credentials
# - pushd .
# - cd external
# - git clone https://github.com/nymtech/nym.git
# - cd nym
# - git checkout feature/covidcredentials
# - popd
# - cd packages/coconut-wasm
# # generate Typescript types with ts-rs
# - cargo test
# # build WASM package
# - wasm-pack build
# artifacts:
# # these paths will be available in other stages
# paths:
# - packages/coconut-wasm/pkg
# expire_in: 1 hour
build-coconut-wasm-app:
stage: build
tags:
- docker # tag this job with 'docker' so that it runs on gitlab runners with docker
script:
- cd packages/coconut-wasm/www
- npm i
- npm run build
after_script:
- echo "CI_JOB_STATUS=$CI_JOB_STATUS" >> build.env
artifacts:
# these paths will be available in other stages
paths:
- packages/coconut-wasm/www/dist/
expire_in: 1 hour
build-mobile-app:
stage: build
tags:
- docker # tag this job with 'docker' so that it runs on gitlab runners with docker
script:
- cd packages/ledger-mobile-app
- npm i
- npm run build
after_script:
- echo "CI_JOB_STATUS=$CI_JOB_STATUS" >> build.env
artifacts:
# these paths will be available in other stages
paths:
- packages/ledger-mobile-app/dist/
expire_in: 1 hour
reports:
# export environment to other stages
dotenv: build.env
deploy-prod-coconut-wasm-app:
stage: deploy
image: instrumentisto/rsync-ssh
tags:
- docker # tag this job with 'docker' so that it runs on gitlab runners with docker
before_script:
- eval $(ssh-agent -s)
- echo "$CI_WWW_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
# make branch name a slug using https://gist.github.com/oneohthree/f528c7ae1e701ad990e6
- export CI_COMMIT_BRANCH_SLUG=$(echo "$CI_COMMIT_BRANCH" | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z)
- echo "This job deploys something from the $CI_COMMIT_BRANCH branch to $CI_SERVER_HOST/$CI_SERVER_COMPONENT_NAME/$CI_COMMIT_BRANCH_SLUG with user $CI_SERVER_USERNAME..."
- export DEST_DIR="$CI_SERVER_DIR/$CI_SERVER_COMPONENT_NAME-coconut-wasm-$CI_COMMIT_BRANCH_SLUG"
- rsync -avrc "$PWD/packages/coconut-wasm/www/dist/" $CI_SERVER_USERNAME@$CI_SERVER_HOST:$DEST_DIR
deploy-prod-mobile-app:
stage: deploy
image: instrumentisto/rsync-ssh
tags:
- docker # tag this job with 'docker' so that it runs on gitlab runners with docker
before_script:
- eval $(ssh-agent -s)
- echo "$CI_WWW_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
# make branch name a slug using https://gist.github.com/oneohthree/f528c7ae1e701ad990e6
- export CI_COMMIT_BRANCH_SLUG=$(echo "$CI_COMMIT_BRANCH" | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z)
- echo "This job deploys something from the $CI_COMMIT_BRANCH branch to $CI_SERVER_HOST/$CI_SERVER_COMPONENT_NAME/$CI_COMMIT_BRANCH_SLUG with user $CI_SERVER_USERNAME..."
- export DEST_DIR="$CI_SERVER_DIR/$CI_SERVER_COMPONENT_NAME-$CI_COMMIT_BRANCH_SLUG"
- rsync -avrc "$PWD/packages/ledger-mobile-app/dist/" $CI_SERVER_USERNAME@$CI_SERVER_HOST:$DEST_DIR
keybase-notifications:
when: always # run even if other jobs fail
stage: .post
image: keybaseio/client:stable-node
tags:
- docker # tag this job with 'docker' so that it runs on gitlab runners with docker
script:
- env
# ===== make branch name a slug using https://gist.github.com/oneohthree/f528c7ae1e701ad990e6
- export CI_COMMIT_BRANCH_SLUG=$(echo "$CI_COMMIT_BRANCH" | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z)
- export CI_PREFIX="$CI_SERVER_COMPONENT_NAME-$CI_COMMIT_BRANCH_SLUG"
- export CI_PREFIX_COCONUT_WASM_APP="$CI_SERVER_COMPONENT_NAME-coconut-wasm-$CI_COMMIT_BRANCH_SLUG"
# ===== install packages
- cd .ci/keybase
- npm install
# ===== send keybase notification using keybase node package and keybase client in docker image
- node send_message.js