-
Notifications
You must be signed in to change notification settings - Fork 291
139 lines (116 loc) Β· 3.9 KB
/
integrate.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
# master only
name: Integrate
on:
push:
branches: [master]
env:
FORCE_COLOR: 1
jobs:
windowsNode14:
name: '[Windows] Node.js v14: Unit tests'
runs-on: windows-latest
strategy:
matrix:
sls-version: [2, 3]
pipenv-version: ['2022.8.5', '2022.8.13']
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Retrieve dependencies from cache
id: cacheNpm
uses: actions/cache@v2
with:
path: |
~/.npm
node_modules
key: npm-v14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: npm-v14-${{ runner.os }}-${{ github.ref }}-
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Check python version
run: |
python --version
- name: Install setuptools
run: python -m pip install --force setuptools wheel
- name: Install pipenv / poetry
run: python -m pip install pipenv==${{ matrix.pipenv-version }} poetry
- name: Install serverless
run: npm install -g serverless@${{ matrix.sls-version }}
- 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
linuxNode14:
name: '[Linux] Node.js 14: Unit tests'
runs-on: ubuntu-latest
strategy:
matrix:
sls-version: [2, 3]
pipenv-version: ['2022.8.5', '2022.8.13']
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Retrieve dependencies from cache
id: cacheNpm
uses: actions/cache@v2
with:
path: |
~/.npm
node_modules
key: npm-v14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
restore-keys: npm-v14-${{ runner.os }}-${{ github.ref }}-
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Check python version
run: |
python --version
- name: Install setuptools
run: python -m pip install --force setuptools wheel
- name: Install pipenv / poetry
run: python -m pip install pipenv==${{ matrix.pipenv-version }} poetry
- name: Install serverless
run: npm install -g serverless@${{ matrix.sls-version }}
- 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
tagIfNewVersion:
name: Tag if new version
runs-on: ubuntu-latest
needs: [windowsNode14, linuxNode14]
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# Ensure to have complete history of commits pushed with given push operation
# It's loose and imperfect assumption that no more than 30 commits will be pushed at once
fetch-depth: 30
# Tag needs to be pushed with real user token, otherwise pushed tag won't trigger the actions workflow
# Hence we're passing 'serverless-ci' user authentication token
token: ${{ secrets.USER_GITHUB_TOKEN }}
- name: Tag if new version
run: |
NEW_VERSION=`git diff -U0 ${{ github.event.before }} package.json | grep '"version": "' | tail -n 1 | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` || :
if [ -n "$NEW_VERSION" ];
then
git tag v$NEW_VERSION
git push --tags
fi