-
-
Notifications
You must be signed in to change notification settings - Fork 74
149 lines (133 loc) · 4.5 KB
/
validate.yml
File metadata and controls
149 lines (133 loc) · 4.5 KB
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
# PR's only
name: Validate
on:
pull_request:
branches: [main]
push:
branches: [main]
env:
SLS_IGNORE_WARNING: '*'
FORCE_COLOR: 1
SLS_SCHEMA_CACHE_BASE_DIR: '/home/runner'
jobs:
linuxNode22:
name: '[Linux] Node 22: Lint, Formatting, Changelog, Unit & packaging tests'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 30
- name: Retrieve last main commit (for `git diff` purposes)
run: |
git checkout -b pr
git fetch --prune --depth=30 origin +refs/heads/main:refs/remotes/origin/main
git checkout main
git checkout pr
- name: Retrieve dependencies from cache
id: cacheNpm
uses: actions/cache@v4
with:
path: |
~/.npm
node_modules
key: npm-v22-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: |
npm-v22-${{ runner.os }}-${{ github.ref }}-
npm-v22-${{ runner.os }}-refs/heads/main-
- name: Install Node.js and npm
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Install dependencies
if: steps.cacheNpm.outputs.cache-hit != 'true'
run: |
npm update --no-save
npm update --save-dev --no-save
- name: Validate formatting
run: npm run prettier-check:updated
- name: Validate lint rules
run: npm run lint:updated
- name: Validate changelog (if new version)
run: |
NEW_VERSION=`git diff -U0 main package.json | grep '"version": "' | tail -n 1 | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` || :
if [ -n "$NEW_VERSION" ];
then
npx dump-release-notes-from-cc-changelog $NEW_VERSION
fi
- name: Unit tests (AWS SDK v2)
# Some tests depend on TTY support, which is missing in GA runner
# Workaround taken from https://github.com/actions/runner/issues/241#issuecomment-577360161
run: script -e -c "npm test -- -b"
env:
SLS_AWS_SDK_V3: '0'
- name: Unit tests (AWS SDK v3)
run: script -e -c "npm test -- -b"
env:
SLS_AWS_SDK_V3: '1'
- name: Packaging tests (AWS SDK v2)
run: npm run integration-test-run-package
env:
SLS_AWS_SDK_V3: '0'
- name: Packaging tests (AWS SDK v3)
run: npm run integration-test-run-package
env:
SLS_AWS_SDK_V3: '1'
windowsNode22:
name: '[Windows] Node 22: Unit tests'
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Retrieve dependencies from cache
id: cacheNpm
uses: actions/cache@v4
with:
path: |
~/.npm
node_modules
key: npm-v22-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: |
npm-v22-${{ runner.os }}-${{ github.ref }}-
npm-v22-${{ runner.os }}-refs/heads/main-
- name: Install Node.js and npm
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Install dependencies
if: steps.cacheNpm.outputs.cache-hit != 'true'
run: |
npm update --no-save
npm update --save-dev --no-save
- name: Unit tests
run: npm test -- -b
linuxNode20:
name: '[Linux] Node 20: Isolated unit tests'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Retrieve dependencies from cache
id: cacheNpm
uses: actions/cache@v4
with:
path: |
~/.npm
node_modules
key: npm-v20-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: |
npm-v20-${{ runner.os }}-${{ github.ref }}-
npm-v20-${{ runner.os }}-refs/heads/main-
- name: Install Node.js and npm
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install dependencies
if: steps.cacheNpm.outputs.cache-hit != 'true'
run: |
npm update --no-save
npm update --save-dev --no-save
- name: Unit tests
# Some tests depend on TTY support, which is missing in GA runner
# Workaround taken from https://github.com/actions/runner/issues/241#issuecomment-577360161
run: script -e -c "npm run test:isolated -- -b"