-
Notifications
You must be signed in to change notification settings - Fork 341
/
Copy pathconfig.yml
166 lines (155 loc) · 4.2 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
163
164
165
166
# Use the latest 2.1 version of CircleCI pipeline processing engine, see https://circleci.com/docs/2.0/configuration-reference/
version: 2.1
defaults: &defaults
working_directory: ~/repo
# https://circleci.com/docs/2.0/circleci-images/#language-image-variants
docker:
- image: cimg/node:20.18.1-browsers
environment:
TERM: xterm # Enable colors in term
commands:
install_bun:
steps:
- restore_cache:
keys:
- bun-cache-v2-{{ arch }}-latest
- run:
name: Install Bun
command: |
if [ ! -d "$HOME/.bun" ]; then
curl -fsSL https://bun.sh/install | bash
fi
echo 'export BUN_INSTALL="$HOME/.bun"' >> $BASH_ENV
echo 'export PATH="$BUN_INSTALL/bin:$PATH"' >> $BASH_ENV
source $BASH_ENV
- save_cache:
key: bun-cache-v2-{{ arch }}-latest
paths:
- ~/.bun
jobs:
CHECKOUT:
<<: *defaults
steps:
- checkout
- run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/repo/.npmrc
- install_bun
- run: bun install
- persist_to_workspace:
root: ~/repo
paths:
- "."
BUILD:
<<: *defaults
steps:
- attach_workspace:
at: ~/repo
- install_bun
- run:
name: 'Perform the versioning before build'
command: bun ./version.mjs
- run: bun run build
- persist_to_workspace:
root: ~/repo
paths:
- packages/core/dist
- packages/tools/dist
- packages/adapters/dist
- packages/dicomImageLoader/dist
- packages/nifti-volume-loader/dist
- version.txt
- commit.txt
- version.json
# https://circleci.com/docs/2.0/collect-test-data/#karma
TEST:
<<: *defaults
steps:
- attach_workspace:
at: ~/repo
- install_bun
- run: mkdir ~/junit
- run:
command: bun run test:unit:ci
environment:
JUNIT_REPORT_PATH: ./junit/
JUNIT_REPORT_NAME: test-results.xml
when: always
- store_test_results:
path: ./junit
- store_artifacts:
path: ./junit
- persist_to_workspace:
root: ~/repo
paths:
- coverage
- junit
NPM_PUBLISH:
<<: *defaults
resource_class: small
steps:
- attach_workspace:
at: ~/repo
- install_bun
- run:
name: Avoid hosts unknown for github
command:
mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking
no\n" > ~/.ssh/config
- add_ssh_keys:
fingerprints:
- "7e:0f:5b:bb:e3:7a:2e:2f:b4:85:bd:66:09:69:cb:f2"
- run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "ohif-bot"
- run:
name: publish package versions
command: |
bun ./publish-version.mjs
- run:
name: Again set the NPM registry (was deleted in the version script)
command:
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
- run:
name: publish package dist
command: |
bun ./publish-package.mjs
workflows:
version: 2
# PULL REQUEST
PULL_REQUEST:
jobs:
- CHECKOUT:
filters:
branches:
ignore:
- main
- feature/*
- hotfix/*
- BUILD:
requires:
- CHECKOUT
- TEST:
requires:
- CHECKOUT # TODO: Also require build?
# MERGE TO MAIN
TEST_AND_RELEASE:
jobs:
- CHECKOUT:
filters:
branches:
only:
- main
- beta
- BUILD:
requires:
- CHECKOUT
- TEST:
requires:
- CHECKOUT
- HOLD_FOR_APPROVAL:
type: approval
requires:
- BUILD
- NPM_PUBLISH:
requires:
- HOLD_FOR_APPROVAL
# VS Code Extension Version: 1.5.1