forked from jdalrymple/gitbeaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
137 lines (115 loc) · 3.27 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
default:
image: node:lts-alpine
# Cache modules in between jobs
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- packages/gitbeaker-core/node_modules/
- packages/gitbeaker-cli/node_modules/
- packages/gitbeaker-browser/node_modules/
- packages/gitbeaker-node/node_modules/
- packages/gitbeaker-requester-utils/node_modules/
- node_modules/
stages:
- install
- build
- lint
- test
- release
#Link and Install all required dependancies
install:
image: node:lts
stage: install
script:
- yarn
# Build core (cjs, es, and browser) and cli packages
# Uses work around to allow for linking of the cli packages
build:
stage: build
script:
- yarn build
artifacts:
paths:
- packages/gitbeaker-core/dist/
- packages/gitbeaker-cli/dist/
- packages/gitbeaker-browser/dist/
- packages/gitbeaker-node/dist/
- packages/gitbeaker-requester-utils/dist/
# Lint all code, tests and supporting documentation (README, CHANGELOG etc)
lint:src:
stage: lint
script: yarn lint
lint:docs:
stage: lint
script: yarn lint:doc
# Unit Tests
test:unit:core:
stage: test
script: yarn jest core/test/unit && yarn codecov -F core
test:unit:node:
stage: test
script: yarn jest node/test/unit && yarn codecov -F node
test:unit:browser:
image: buildkite/puppeteer
stage: test
script: yarn jest browser/test/unit && yarn codecov -F browser
test:unit:utils:
stage: test
script: yarn jest utils/test/unit && yarn codecov -F utils
# Integration Tests
.test:integration: &integration
image:
name: docker/compose:latest
entrypoint: ['/bin/sh', '-c']
variables:
DOCKER_HOST: tcp://docker:2375
GITLAB_URL: http://docker:8080
services:
- docker:dind
stage: test
before_script:
# Install docker compose
- apk add --no-cache nodejs yarn git
# Spin up container
- cd scripts
- docker-compose -f docker-compose.yml up -d
# Verify Gitlab instance is up and running
- node probe.js
# Get the personal token
- export PERSONAL_ACCESS_TOKEN=$(docker exec -i gitlab sh -c 'gitlab-rails r /mnt/init.rb')
- cd ..
- echo $PERSONAL_ACCESS_TOKEN
- echo $GITLAB_URL
- echo $CODECOV_TOKEN
test:integration:browser:
image: buildkite/puppeteer
stage: test
script: yarn jest browser/test/integration
test:integration:cli:
<<: *integration
script: yarn jest cli/test/integration
# test:integration:node:
# <<: *integration
# script: yarn jest node/test/integration && yarn codecov -F node
# test:cli:integration:dist:
# <<: *integration
# script: yarn jest core/test/integration --runInBand && yarn codecov
# test:core:integration:dist-cjs:
# <<: *integration
# script: yarn jest core/test/integration --runInBand --moduleNameMapper="{dist:dist/index.es.js}"
# test:core:integration:dist-es
# <<: *integration
# script: yarn jest core/test/integration --runInBand --moduleNameMapper="{dist:dist/index.es.js}"
# Release
release:
only:
refs:
- master
stage: release
before_script:
- apk add --no-cache git
- git remote set-url origin https://jdalrymple:${GITHUB_TOKEN}@github.com/jdalrymple/gitbeaker.git
- git checkout master
- npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
- npm config set always-auth=true
script: yarn release