-
Notifications
You must be signed in to change notification settings - Fork 6
205 lines (164 loc) · 5.43 KB
/
test_publish.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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
name: Build, test, publish
env:
CI: true
B2B_FLAVOUR: PREOPS
B2B_ENDPOINT: https://b2b-proxy.4me.im/
B2B_XSD_REMOTE_URL: https://wsdl.b2B-proxy.4me.im/27.0.0.tar.gz
B2B_API_KEY_ID: ${{ secrets.B2B_API_KEY_ID }}
B2B_API_SECRET_KEY: ${{ secrets.B2B_API_SECRET_KEY }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# REAL_B2B_CONNECTIONS: true
on:
push:
branches:
- 'master'
pull_request:
branches:
- '*'
jobs:
dedupe-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Install pnpm'
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Check duplicate dependencies
run: pnpm dedupe --check
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Install pnpm'
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm lint
# Test the lib, runs on every commit
test:
runs-on: ubuntu-latest
env:
# This will enable real b2b connections on node 20 and if secrets.B2B_API_KEY_ID is set
REAL_B2B_CONNECTIONS: ${{ matrix.node-version == '20' && secrets.B2B_API_KEY_ID && '1' || '' }}
strategy:
matrix:
node-version:
- 18
- 20
- 22
steps:
- uses: actions/checkout@v4
- name: 'Install pnpm'
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: 'Create b2b-xsd folder'
run: mkdir b2b-xsd && touch b2b-xsd/.ghcache
- name: '[GH Cache] B2B XSD'
uses: actions/cache@v4
with:
path: 'b2b-xsd'
key: ${{ runner.os }}-b2b-xsd-${{ hashFiles('**/b2b-xsd/**')}}
restore-keys: |
${{ runner.os }}-b2b-xsd
- name: 'Install deps'
run: pnpm install --frozen-lockfile
- name: 'TypeScript check'
run: pnpm typecheck
- name: 'Build'
run: pnpm build
- name: 'Download B2B WSDL'
run: pnpm downloadWSDL
- name: 'Run test suite'
run: pnpm test:ci
- name: 'Upload coverage'
uses: codecov/codecov-action@v4
if: env.REAL_B2B_CONNECTIONS == '1'
with:
fail_ci_if_error: true
directory: ./coverage
# Publish package to npm
# deploy-packages:
# if: github.repository == 'DGAC/nmb2b-client-js' && startsWith(github.ref, 'refs/tags/v')
# runs-on: ubuntu-latest
# needs:
# - lint
# - test
# - dedupe-check
# steps:
# - uses: actions/checkout@v4
# - name: 'Install pnpm'
# uses: pnpm/action-setup@v4
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node-version }}
# registry-url: 'https://registry.npmjs.org'
# - name: Get pnpm store directory
# id: pnpm-cache
# shell: bash
# run: |
# echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
# - name: Setup pnpm cache
# uses: actions/cache@v4
# with:
# path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
# key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
# restore-keys: |
# ${{ runner.os }}-pnpm-store-
# - name: Install deps
# run: pnpm install --frozen-lockfile
# - name: Build
# run: pnpm build
# - name: deploy packages
# # --no-git-checks because we're publishing from a tag pipeline and not a branch pipeline
# # See here: https://github.com/pnpm/pnpm/issues/5894
# run: pnpm publish --no-git-checks --provenance
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}