Merge pull request #320 from Sparticuz/fix/node22 #320
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: AWS Lambda CI | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
build: | |
name: Build Lambda Layer | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Install Packages | |
run: npm ci | |
- name: Compile Typescript | |
run: npm run build | |
- name: Create Lambda Layer | |
run: make chromium.zip | |
- name: Upload Layer Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: chromium | |
path: chromium.zip | |
execute: | |
name: Lambda (Node ${{ matrix.version }}.x) | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
event: | |
- example.com | |
version: | |
- 16 | |
- 18 | |
- 20 | |
- 22 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Setup AWS SAM CLI | |
uses: aws-actions/setup-sam@v2 | |
- name: Download Layer Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: chromium | |
- name: Provision Layer | |
run: unzip chromium.zip -d _/amazon/code | |
- name: Install test dependencies | |
run: npm install --prefix _/amazon/handlers puppeteer-core --bin-links=false --fund=false --omit=optional --omit=dev --package-lock=false --save=false | |
- name: Invoke Lambda on SAM | |
run: sam local invoke --template _/amazon/template.yml --event _/amazon/events/${{ matrix.event }}.json node${{ matrix.version }} 2>&1 | (grep 'Error' && exit 1 || exit 0) |