-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (111 loc) · 3.34 KB
/
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
name: ci
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Setup Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: package.json
cache: npm
- name: Run npm ci
run: npm ci
- name: Build
run: npm run build
- name: Check diff
run: |
if ! git diff --no-patch --exit-code; then
echo Diff found 1>&2
exit 1
fi
lint:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Setup Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: package.json
cache: npm
- name: Run npm ci
run: npm ci
- name: Run ESLint
run: npm run lint
format:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Setup Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: package.json
cache: npm
- name: Run npm ci
run: npm ci
- name: Run Prettier format check
run: npm run format:check
test-node:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Setup Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: package.json
cache: npm
- name: Run npm ci
run: npm ci
- name: Test
run: npm test
test-action:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Run export-secrets
uses: ./
with:
secrets: '{"KEY_A":"VALUE_A","KEY_B":"VALUE_B","KEY_C":"VALUE_C"}'
- name: Check environment variables
run: |
EXPECTED_VALUE_KEY_A='VALUE_A'
EXPECTED_VALUE_KEY_B='VALUE_B'
EXPECTED_VALUE_KEY_C='VALUE_C'
FAILED='false'
if [ "$KEY_A" = "$EXPECTED_VALUE_KEY_A" ]; then
echo 'PASSED: VALUE_A'
else
echo 'FAILED: VALUE_A' 1>&2
echo " expected: $EXPECTED_VALUE_KEY_A" 1>&2
echo " actual: $KEY_A" 1>&2
FAILED='true'
fi
if [ "$KEY_B" = "$EXPECTED_VALUE_KEY_B" ]; then
echo 'PASSED: VALUE_B'
else
echo 'FAILED: VALUE_B' 1>&2
echo " expected: $EXPECTED_VALUE_KEY_B" 1>&2
echo " actual: $KEY_B" 1>&2
FAILED='true'
fi
if [ "$KEY_C" = "$EXPECTED_VALUE_KEY_C" ]; then
echo 'PASSED: VALUE_C'
else
echo 'FAILED: VALUE_C' 1>&2
echo " expected: $EXPECTED_VALUE_KEY_C" 1>&2
echo " actual: $KEY_C" 1>&2
FAILED='true'
fi
if [ "$FAILED" = 'true' ]; then
exit 1
fi