Skip to content

Commit

Permalink
Add examples checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Shillaker committed Nov 7, 2023
1 parent 5295fb3 commit 484d643
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache: "npm-build"

- name: "Install dependencies"
run: npm ci
Expand Down
43 changes: 41 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: "Set up node 18"
- name: "Set up node ${{ matrix.node-version }}"
id: setup-node
uses: actions/setup-node@v4
with:
node-version: "${{ matrix.node-version }}"
cache: "npm"
cache: "npm-tests"

- name: "Install dependencies"
run: npm ci
Expand All @@ -32,3 +32,42 @@ jobs:

- name: "Run tests"
run: npm test

examples:
defaults:
working-directory: ./examples
strategy:
matrix:
node-version: ["16.x", "18.x"]
example: [
"not_stringified_body",
"print_event_context",
"stringified_body",
"upload_file_multipart",
"with_callback",
"with_event_components",
"with_http_get",
"with_http_post",
"with_object",
"with_promise",
]

runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
working-directory: .

- name: "Set up node ${{ matrix.node-version }}"
id: setup-node
uses: actions/setup-node@v4
with:
node-version: "${{ matrix.node-version }}"
cache: "npm-examples"

- name: "Link framework"
run: npm link ..

- name: "Run example"
run: |
node ${{ matrix.example }}/handler.js &
curl http://localhost:8080

0 comments on commit 484d643

Please sign in to comment.