Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tidy): clean up README and badges #72

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
name: "build"

on:
push:
branches: ["main"]
Expand All @@ -9,7 +11,7 @@ permissions:
contents: read

jobs:
test:
build:
strategy:
matrix:
node-version: ["16.x", "18.x"]
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
name: "examples"

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
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

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

- name: "Install framework dependencies"
run: npm ci

- name: "Build framework"
run: npm run build

- name: "Install examples dependencies"
run: npm ci
working-directory: examples

- name: "Link framework"
run: npm link

- name: "Link framework in examples"
run: npm link @scaleway/serverless-functions
working-directory: examples

- name: "Run example"
run: node ${{ matrix.example }}/handler.js &
working-directory: examples

- name: "Wait for it to start"
run: sleep 1

- name: "Launch a request"
run: curl http://localhost:8080
working-directory: examples
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
name: "publish"

on:
release:
types: [published]
Expand Down
57 changes: 2 additions & 55 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
name: "tests"

on:
push:
branches: ["main"]
Expand Down Expand Up @@ -26,58 +28,3 @@ jobs:

- name: "Run tests"
run: npm test

examples:
defaults:
run:
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

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

- name: "Link top-level"
run: npm link

- name: "Install dependencies"
run: npm ci
working-directory: "examples"

- name: "Link local framework"
run: npm link @scaleway/serverless-functions
working-directory: "examples"

- name: "Run example"
run: node ${{ matrix.example }}/handler.js &
working-directory: "examples"

- name: "Wait for it to start"
run: sleep 1

- name: "Launch a request"
run: curl http://localhost:8080
working-directory: "examples"
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Serverless Functions Node

[![build-and-test](https://github.com/scaleway/serverless-functions-node/actions/workflows/npmtest.yml/badge.svg)](https://github.com/scaleway/serverless-functions-node/actions/workflows/npmtest.yml)
![node](https://img.shields.io/badge/node-16_|_18-blue.svg)
![Tests](https://github.com/scaleway/serverless-functions-node/actions/workflows/tests.yml/badge.svg)
![Examples](https://github.com/scaleway/serverless-functions-node/actions/workflows/examples.yml/badge.svg)
[![NPM Version](https://img.shields.io/npm/v/@scaleway/serverless-functions.svg)](https://www.npmjs.com/package/@scaleway/serverless-functions)
![Node](https://img.shields.io/badge/node-16_|_18-blue.svg)

Scaleway Serverless Functions Node is a framework which simplifies working with [Scaleway Serverless Functions](https://www.scaleway.com/en/serverless-functions/).

Expand Down
6 changes: 2 additions & 4 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Examples

Each example contains a `handler.js` file.

To run them, you first need to install the dependencies in this directory:
To run the examples, you first need to install the examples dependencies:

```console
npm i
```

Then you can run examples with:
You can then run each example with:

```console
node <example_name>/handler.js
Expand Down
30 changes: 15 additions & 15 deletions examples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"license": "ISC",
"dependencies": {
"@aws-sdk/client-s3": "^3.305.0",
"@scaleway/serverless-functions": "^1.0.2",
"@scaleway/serverless-functions": "^1.1.0",
"https": "^1.0.0",
"parse-multipart-data": "^1.5.0"
}
Expand Down
Loading