Update README.md #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Integration tests | |
on: | |
push: | |
branches: [master] | |
jobs: | |
node-integration-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [12, 14, 16, 18] | |
os: [linux, windows] | |
fail-fast: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Retrieve dependencies from cache | |
id: cacheNpm | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.npm | |
node_modules | |
key: npm-v${{ matrix.node-version }}-${{ matrix.os }}-${{ github.ref }}-${{ hashFiles('package.json') }} | |
restore-keys: | | |
npm-v${{ matrix.node-version }}-${{ matrix.os }}-${{ github.ref }}- | |
npm-v${{ matrix.node-version }}-${{ matrix.os }}-refs/heads/master- | |
- name: Install Node.js and npm | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
if: steps.cacheNpm.outputs.cache-hit != 'true' | |
run: | | |
npm ci | |
- name: Compile | |
run: npm run compile | |
- name: Pack | |
run: npm pack | |
- name: Set node options | |
id: nodeOptions | |
run: | | |
if (( ${{ matrix.node-version }} > 16 )); then | |
echo "NODE_OPTIONS=--max_old_space_size=8192 --openssl-legacy-provider" >> $GITHUB_OUTPUT | |
else | |
echo "NODE_OPTIONS=--max_old_space_size=8192" >> $GITHUB_OUTPUT | |
fi | |
- name: Validate lint rules | |
run: npm run lint | |
- name: Run integration tests | |
run: npm run test:int -- -d 'node${{ matrix.node-version }}-${{ matrix.os }}(-webpack)?' | |
env: | |
NODE_OPTIONS: ${{ steps.nodeOptions.outputs.NODE_OPTIONS }} | |
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID}} | |
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID}} | |
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET}} | |
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID}} | |
python-integration-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
runtime: [python36, python37, python38] | |
node-version: [12, 14, 16, 18] | |
os: [linux, windows] | |
fail-fast: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Retrieve dependencies from cache | |
id: cacheNpm | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.npm | |
node_modules | |
key: npm-v${{ matrix.node-version }}-${{ matrix.os }}-${{ github.ref }}-${{ hashFiles('package.json') }} | |
restore-keys: | | |
npm-v${{ matrix.node-version }}-${{ matrix.os }}-${{ github.ref }}- | |
npm-v${{ matrix.node-version }}-${{ matrix.os }}-refs/heads/master- | |
- name: Install Node.js and npm | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
if: steps.cacheNpm.outputs.cache-hit != 'true' | |
run: | | |
npm ci | |
- name: Compile | |
run: npm run compile | |
- name: Pack | |
run: npm pack | |
- name: Set node options | |
id: nodeOptions | |
run: | | |
if (( ${{ matrix.node-version }} > 16 )); then | |
echo "NODE_OPTIONS=--max_old_space_size=8192 --openssl-legacy-provider" >> $GITHUB_OUTPUT | |
else | |
echo "NODE_OPTIONS=--max_old_space_size=8192" >> $GITHUB_OUTPUT | |
fi | |
- name: Run integration tests | |
run: npm run test:int -- -d ${{ matrix.runtime }} | |
env: | |
NODE_OPTIONS: ${{ steps.nodeOptions.outputs.NODE_OPTIONS }} | |
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID}} | |
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID}} | |
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET}} | |
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID}} | |
# TODO: re-enable .NET tests when they don't end up hanging - unreliable at the moment | |
# dotnet-integration-tests: | |
# runs-on: ubuntu-latest | |
# | |
# strategy: | |
# matrix: | |
# runtime: [dotnet31] | |
# node-version: [12, 14, 16, 18] | |
# os: [linux, windows] | |
# fail-fast: false | |
# | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v3 | |
# | |
# - name: Retrieve dependencies from cache | |
# id: cacheNpm | |
# uses: actions/cache@v3 | |
# with: | |
# path: | | |
# ~/.npm | |
# node_modules | |
# key: npm-v${{ matrix.node-version }}-${{ matrix.os }}-${{ github.ref }}-${{ hashFiles('package.json') }} | |
# restore-keys: | | |
# npm-v${{ matrix.node-version }}-${{ matrix.os }}-${{ github.ref }}- | |
# npm-v${{ matrix.node-version }}-${{ matrix.os }}-refs/heads/master- | |
# | |
# - name: Install Node.js and npm | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: ${{ matrix.node-version }} | |
# | |
# - name: Install dependencies | |
# if: steps.cacheNpm.outputs.cache-hit != 'true' | |
# run: | | |
# npm ci | |
# | |
# - name: Compile | |
# run: npm run compile | |
# | |
# - name: Set node options | |
# id: nodeOptions | |
# run: | | |
# if (( ${{ matrix.node-version }} > 16 )); then | |
# echo "NODE_OPTIONS=--max_old_space_size=8192 --openssl-legacy-provider" >> $GITHUB_OUTPUT | |
# else | |
# echo "NODE_OPTIONS=--max_old_space_size=8192" >> $GITHUB_OUTPUT | |
# fi | |
# | |
# - name: Setup dotnet 3.1 | |
# if: matrix.runtime == 'dotnet31' | |
# uses: actions/setup-dotnet@v1 | |
# with: | |
# dotnet-version: '3.1.103' | |
# | |
# - name: Run integration tests | |
# run: npm run test:int -- -d '${{ matrix.runtime }}-${{ matrix.os }}' | |
# env: | |
# NODE_OPTIONS: ${{ steps.nodeOptions.outputs.NODE_OPTIONS }} | |
# AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID}} | |
# AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID}} | |
# AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET}} | |
# AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID}} | |
tag-if-new-version: | |
runs-on: ubuntu-latest | |
needs: [node-integration-tests, python-integration-tests] | |
if: github.repository_owner == 'serverless' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
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 |