chore: Update runtimes in test fixtures #1892
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
# main only | |
name: Integrate | |
on: | |
push: | |
branches: [v3] | |
env: | |
SLS_IGNORE_WARNING: '*' | |
FORCE_COLOR: 1 | |
SLS_SCHEMA_CACHE_BASE_DIR: '/home/runner' | |
jobs: | |
linuxNode16: | |
name: '[Linux] Node.js 16: Publish canary, Unit & packaging tests ' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Node.js and npm | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
registry-url: https://registry.npmjs.org | |
- name: Publish canary | |
# Note: Setting NODE_AUTH_TOKEN as job|workspace wide env var won't work | |
# as it appears actions/setup-node sets own value | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # 01dd......71cc | |
run: | | |
./.github/prepare-canary.js | |
npm publish --tag canary | |
git checkout . | |
- name: Retrieve dependencies from cache | |
id: cacheNpm | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.npm | |
node_modules | |
key: npm-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }} | |
restore-keys: npm-v16-${{ runner.os }}-${{ github.ref }}- | |
- 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 coverage -- -b" | |
- name: Push coverage | |
run: npx codecov | |
- name: Packaging tests | |
run: npm run integration-test-run-package | |
windowsNode16: | |
name: '[Windows] Node.js v16: Unit tests' | |
runs-on: windows-latest | |
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-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }} | |
restore-keys: npm-v16-${{ runner.os }}-${{ github.ref }}- | |
- name: Install Node.js and npm | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.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 | |
linuxNode14: | |
name: '[Linux] Node.js 14: Isolated unit tests' | |
runs-on: ubuntu-latest | |
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-v14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }} | |
restore-keys: npm-v14-${{ runner.os }}-${{ github.ref }}- | |
- name: Install Node.js and npm | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14.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" | |
linuxNode12: | |
name: '[Linux] Node.js v12: Node version validation test' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Node.js and npm | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 12.x | |
- name: Node version validation test | |
run: ./bin/serverless.js 2>&1 | grep -q "does not support" | |
linuxNode4: | |
name: '[Linux] Node.js v4: Node version validation test' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Node.js and npm | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 4.x | |
- name: Node version validation test | |
run: ./bin/serverless.js 2>&1 | grep -q "does not support" | |
integrate: | |
name: Integrate | |
runs-on: ubuntu-latest | |
needs: [linuxNode16, windowsNode16, linuxNode14, linuxNode12, linuxNode4] | |
timeout-minutes: 30 # Default is 360 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
SLS_AWS_REQUEST_MAX_RETRIES: 50 #Increase number of retries, due to observed "Rate exceeded" fails | |
SERVERLESS_BINARY_PATH: ./dist/serverless-linux | |
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: Retrieve dependencies from cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.npm | |
node_modules | |
key: npm-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }} | |
# Potentially needed for test/integration/curated-plugins-python.test.js | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install Node.js and npm | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
# Note: No need to install dependencies as we have retrieved cached `node_modules` for very | |
# same `package.json` as stored with previous job | |
- name: Build standalone artifacts | |
run: npm run pkg:build | |
- name: Basic integration tests against standalone binary | |
run: npm run integration-test-run-basic | |
- name: Full integration tests against standalone binary | |
run: npm run integration-test-run-all | |
- 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 |