Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit 5108019

Browse files
authored
ci: Improve integration tests workflow (#656)
1 parent 192fe2f commit 5108019

File tree

88 files changed

+75883
-7310
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+75883
-7310
lines changed

.github/workflows/integration-tests-dotnet.yml

-57
This file was deleted.

.github/workflows/integration-tests-node.yml

-45
This file was deleted.

.github/workflows/integration-tests-python.yml

-37
This file was deleted.

.github/workflows/integration.yml

+216
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
name: Integration tests
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
node-integration-tests:
9+
runs-on: ubuntu-latest
10+
11+
strategy:
12+
matrix:
13+
node-version: [12, 14, 16, 18]
14+
os: [linux, windows]
15+
fail-fast: false
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v3
20+
21+
- name: Retrieve dependencies from cache
22+
id: cacheNpm
23+
uses: actions/cache@v3
24+
with:
25+
path: |
26+
~/.npm
27+
node_modules
28+
key: npm-v${{ matrix.node-version }}-${{ matrix.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
29+
restore-keys: |
30+
npm-v${{ matrix.node-version }}-${{ matrix.os }}-${{ github.ref }}-
31+
npm-v${{ matrix.node-version }}-${{ matrix.os }}-refs/heads/master-
32+
33+
- name: Install Node.js and npm
34+
uses: actions/setup-node@v3
35+
with:
36+
node-version: ${{ matrix.node-version }}
37+
38+
- name: Install dependencies
39+
if: steps.cacheNpm.outputs.cache-hit != 'true'
40+
run: |
41+
npm ci
42+
43+
- name: Compile
44+
run: npm run compile
45+
46+
- name: Pack
47+
run: npm pack
48+
49+
- name: Set node options
50+
id: nodeOptions
51+
run: |
52+
if (( ${{ matrix.node-version }} > 16 )); then
53+
echo "NODE_OPTIONS=--max_old_space_size=8192 --openssl-legacy-provider" >> $GITHUB_OUTPUT
54+
else
55+
echo "NODE_OPTIONS=--max_old_space_size=8192" >> $GITHUB_OUTPUT
56+
fi
57+
58+
- name: Validate lint rules
59+
run: npm run lint
60+
61+
- name: Run integration tests
62+
run: npm run test:int -- -d 'node${{ matrix.node-version }}-${{ matrix.os }}(-webpack)?'
63+
env:
64+
NODE_OPTIONS: ${{ steps.nodeOptions.outputs.NODE_OPTIONS }}
65+
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID}}
66+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID}}
67+
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET}}
68+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID}}
69+
70+
python-integration-tests:
71+
runs-on: ubuntu-latest
72+
73+
strategy:
74+
matrix:
75+
runtime: [python36, python37, python38]
76+
node-version: [12, 14, 16, 18]
77+
os: [linux, windows]
78+
fail-fast: false
79+
80+
steps:
81+
- name: Checkout repository
82+
uses: actions/checkout@v3
83+
84+
- name: Retrieve dependencies from cache
85+
id: cacheNpm
86+
uses: actions/cache@v3
87+
with:
88+
path: |
89+
~/.npm
90+
node_modules
91+
key: npm-v${{ matrix.node-version }}-${{ matrix.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
92+
restore-keys: |
93+
npm-v${{ matrix.node-version }}-${{ matrix.os }}-${{ github.ref }}-
94+
npm-v${{ matrix.node-version }}-${{ matrix.os }}-refs/heads/master-
95+
96+
- name: Install Node.js and npm
97+
uses: actions/setup-node@v3
98+
with:
99+
node-version: ${{ matrix.node-version }}
100+
101+
- name: Install dependencies
102+
if: steps.cacheNpm.outputs.cache-hit != 'true'
103+
run: |
104+
npm ci
105+
106+
- name: Compile
107+
run: npm run compile
108+
109+
- name: Pack
110+
run: npm pack
111+
112+
- name: Set node options
113+
id: nodeOptions
114+
run: |
115+
if (( ${{ matrix.node-version }} > 16 )); then
116+
echo "NODE_OPTIONS=--max_old_space_size=8192 --openssl-legacy-provider" >> $GITHUB_OUTPUT
117+
else
118+
echo "NODE_OPTIONS=--max_old_space_size=8192" >> $GITHUB_OUTPUT
119+
fi
120+
121+
- name: Run integration tests
122+
run: npm run test:int -- -d ${{ matrix.runtime }}
123+
env:
124+
NODE_OPTIONS: ${{ steps.nodeOptions.outputs.NODE_OPTIONS }}
125+
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID}}
126+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID}}
127+
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET}}
128+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID}}
129+
130+
# TODO: re-enable .NET tests when they don't end up hanging - unreliable at the moment
131+
# dotnet-integration-tests:
132+
# runs-on: ubuntu-latest
133+
#
134+
# strategy:
135+
# matrix:
136+
# runtime: [dotnet31]
137+
# node-version: [12, 14, 16, 18]
138+
# os: [linux, windows]
139+
# fail-fast: false
140+
#
141+
# steps:
142+
# - name: Checkout repository
143+
# uses: actions/checkout@v3
144+
#
145+
# - name: Retrieve dependencies from cache
146+
# id: cacheNpm
147+
# uses: actions/cache@v3
148+
# with:
149+
# path: |
150+
# ~/.npm
151+
# node_modules
152+
# key: npm-v${{ matrix.node-version }}-${{ matrix.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
153+
# restore-keys: |
154+
# npm-v${{ matrix.node-version }}-${{ matrix.os }}-${{ github.ref }}-
155+
# npm-v${{ matrix.node-version }}-${{ matrix.os }}-refs/heads/master-
156+
#
157+
# - name: Install Node.js and npm
158+
# uses: actions/setup-node@v3
159+
# with:
160+
# node-version: ${{ matrix.node-version }}
161+
#
162+
# - name: Install dependencies
163+
# if: steps.cacheNpm.outputs.cache-hit != 'true'
164+
# run: |
165+
# npm ci
166+
#
167+
# - name: Compile
168+
# run: npm run compile
169+
#
170+
# - name: Set node options
171+
# id: nodeOptions
172+
# run: |
173+
# if (( ${{ matrix.node-version }} > 16 )); then
174+
# echo "NODE_OPTIONS=--max_old_space_size=8192 --openssl-legacy-provider" >> $GITHUB_OUTPUT
175+
# else
176+
# echo "NODE_OPTIONS=--max_old_space_size=8192" >> $GITHUB_OUTPUT
177+
# fi
178+
#
179+
# - name: Setup dotnet 3.1
180+
# if: matrix.runtime == 'dotnet31'
181+
# uses: actions/setup-dotnet@v1
182+
# with:
183+
# dotnet-version: '3.1.103'
184+
#
185+
# - name: Run integration tests
186+
# run: npm run test:int -- -d '${{ matrix.runtime }}-${{ matrix.os }}'
187+
# env:
188+
# NODE_OPTIONS: ${{ steps.nodeOptions.outputs.NODE_OPTIONS }}
189+
# AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID}}
190+
# AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID}}
191+
# AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET}}
192+
# AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID}}
193+
194+
tag-if-new-version:
195+
runs-on: ubuntu-latest
196+
needs: [node-integration-tests, python-integration-tests]
197+
198+
steps:
199+
- name: Checkout repository
200+
uses: actions/checkout@v3
201+
with:
202+
# Ensure to have complete history of commits pushed with given push operation
203+
# It's loose and imperfect assumption that no more than 30 commits will be pushed at once
204+
fetch-depth: 30
205+
# Tag needs to be pushed with real user token, otherwise pushed tag won't trigger the actions workflow
206+
# Hence we're passing 'serverless-ci' user authentication token
207+
token: ${{ secrets.USER_GITHUB_TOKEN }}
208+
209+
- name: Tag if new version
210+
run: |
211+
NEW_VERSION=`git diff -U0 ${{ github.event.before }} package.json | grep '"version": "' | tail -n 1 | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` || :
212+
if [ -n "$NEW_VERSION" ];
213+
then
214+
git tag v$NEW_VERSION
215+
git push --tags
216+
fi

0 commit comments

Comments
 (0)