-
Notifications
You must be signed in to change notification settings - Fork 89
71 lines (61 loc) · 2.04 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
name: Serverless LocalStack CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
serverless-localstack-test:
name: Serverless LocalStack CI
runs-on: ubuntu-latest
strategy:
matrix:
sls-major-version: ["2", "3"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules-v${{ matrix.sls-major-version }}
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.sls-major-version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.sls-major-version }}-
- name: Install deps
run: |
npm install
- name: Update SLS version to v3
if: ${{ matrix.sls-major-version == '3' }}
run: |
npm install serverless@3
- name: Check installed version
env:
EXPECTED_SLS_MAJOR_VERSION: ${{ matrix.sls-major-version }}
run : |
installed_sls_version=$(npm list | grep serverless@ | sed -E 's/.*serverless@(.*)/\1/')
echo "installed serverless version: ${installed_sls_version}"
if [ "${installed_sls_version:0:1}" != ${EXPECTED_SLS_MAJOR_VERSION} ]; then
echo "expected version ${EXPECTED_SLS_MAJOR_VERSION}, but installed ${installed_sls_version}"
exit 1
fi
- name: Start LocalStack
run: |
pip install localstack awscli-local[ver1]
docker pull localstack/localstack
localstack start -d
localstack wait -t 30
- name: Run Lint and Test
run: |
set -e
npm run lint
npm run test
- name: Integration Tests
run: |
npm link
sleep 5; SLS_DEBUG=1 npm run test:integration