This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
/
config.yml
162 lines (161 loc) · 5.18 KB
/
config.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
160
161
162
version: 2
jobs:
build:
working_directory: ~/aerogear
docker:
# Node 8 LTS
- image: circleci/node:lts-browsers
steps:
- checkout
- run:
name: update-npm
command: 'sudo npm install -g npm@latest'
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: install-dependencies
command: npm install
- run:
name: install-package-dependencies
command: npm run bootstrap
- run:
name: run-build
command: npm run build
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
# Hoisting will cache some of the packages, but rest needs to be installed separtely
name: install-package-dependencies-after-cache
command: npm run bootstrap
- run:
name: run lint
command: npm run lint
- run:
name: test
command: npm test
- run:
name: coverage
command: npm run coverage
- run:
name: sync integration test
command: cd packages/sync && npm run integration-test
- store_artifacts:
path: test-results.xml
prefix: tests
- store_artifacts:
path: coverage
prefix: coverage
- store_test_results:
path: test-results.xml
npm_publish:
working_directory: ~/aerogear
docker:
# Node 8 LTS
- image: circleci/node:lts
steps:
- checkout
# Allows us to authenticate with the npm registry
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
- run: CI=true npm run release:prep
- run: TAG=$CIRCLE_TAG npm run release:validate
- run: TAG=$CIRCLE_TAG npm run publish
build_android:
working_directory: ~/aerogear
docker:
- image: circleci/android:api-28-node
- image: verdaccio/verdaccio
name: verdaccio_instance
steps:
- checkout
# publish npm packages to local verdaccio instance for testing
- run: npm set registry http://verdaccio_instance:4873/
- run: npx npm-cli-login -u test -p test -e test@example.com -r http://verdaccio_instance:4873
- run: git config --global user.email "test@example.com"
- run: git config --global user.name "test"
- run: npx lerna version patch --no-push --yes
- run: CI=true npm run release:prep
- run:
command: |
TAG=$(node -e "console.log(require('./lerna.json').version);") \
npm run release:validate
- run:
command: |
TAG=$(node -e "console.log(require('./lerna.json').version);") \
npm run publish
# build cordova testing app
- run: git clone https://github.com/jhellar/aerogear-integration-tests.git ~/tests
- run: sudo apt install gradle
- run: sudo npm --global install cordova@8
- run:
command: ./scripts/build-testing-app.sh
working_directory: ~/tests
- persist_to_workspace:
root: ~/tests/testing-app/platforms/android/app/build/outputs/apk/debug/
paths:
- app-debug.apk
test_android:
docker:
- image: circleci/node:carbon
- image: jboss/keycloak
name: keycloak_instance
environment:
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: admin
DB_VENDOR: h2
steps:
- run: git clone https://github.com/jhellar/aerogear-integration-tests.git .
- run:
name: Wait for keycloak instance to start up
command: dockerize -wait tcp://keycloak_instance:8080 -timeout 120s
- run:
name: Install node modules
command: npm install
- attach_workspace:
at: /tmp/workspace
- run:
name: Download BrowserStack Local binary
command: |
wget "https://www.browserstack.com/browserstack-local/BrowserStackLocal-linux-x64.zip"
unzip BrowserStackLocal-linux-x64.zip
- run:
name: Run the tests
command: |
./BrowserStackLocal $BROWSERSTACK_KEY &
export BROWSERSTACK_APP="$(curl -u "$BROWSERSTACK_USER:$BROWSERSTACK_KEY" \
-X POST https://api-cloud.browserstack.com/app-automate/upload \
-F "file=@/tmp/workspace/app-debug.apk" | cut -d '"' -f 4)"
npm start -- test/**/*.js
environment:
KEYCLOAK_HOST: 'keycloak_instance'
KEYCLOAK_PORT: '8080'
- run: echo stop && false
workflows:
version: 2
build_and_release:
jobs:
- build:
filters:
tags:
only: /.*/
- build_android:
requires:
- build
filters:
tags:
only: /.*/
- test_android:
requires:
- build_android
filters:
tags:
only: /.*/
- npm_publish:
requires:
- test_android
filters:
tags:
only: /.*/ # allow anything because tag syntax is validated as part of validate-release.sh
branches:
ignore: /.*/