Skip to content

Commit 494dd18

Browse files
authored
Bring aws_lambda_events as subpackage (#647)
Signed-off-by: David Calavera <[email protected]>
1 parent e18d366 commit 494dd18

File tree

178 files changed

+12467
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+12467
-104
lines changed

.github/actions/rust-build/action.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "Rust builds"
2+
description: "Builds, tests, and formats Rust code"
3+
inputs:
4+
package:
5+
required: true
6+
description: "the Rust package to test"
7+
toolchain:
8+
required: true
9+
description: "the Rust toolchain to use"
10+
11+
runs:
12+
using: "composite"
13+
steps:
14+
- uses: dtolnay/rust-toolchain@master
15+
with:
16+
toolchain: ${{ inputs.toolchain }}
17+
components: clippy, rustfmt
18+
- uses: Swatinem/rust-cache@v2
19+
20+
- name: Build
21+
shell: bash
22+
run: cargo build --all-features --verbose --package ${{ inputs.package }}
23+
24+
- name: Run tests
25+
shell: bash
26+
run: cargo test --all-features --verbose --package ${{ inputs.package }}

.github/workflows/build-events.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Check Lambda Events
2+
3+
on:
4+
push:
5+
paths:
6+
- 'lambda-events/**'
7+
pull_request:
8+
paths:
9+
- 'lambda-events/**'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
toolchain:
17+
- "1.62.0" # Current MSRV
18+
- stable
19+
env:
20+
RUST_BACKTRACE: 1
21+
steps:
22+
- uses: actions/checkout@v3
23+
24+
- name: Build events
25+
uses: ./.github/actions/rust-build
26+
with:
27+
package: aws_lambda_events
28+
toolchain: ${{ matrix.toolchain}}

.github/workflows/build-extension.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Check Lambda Runtime
2+
3+
on:
4+
push:
5+
paths:
6+
- 'lambda-runtime-api-client/**'
7+
- 'lambda-extension/**'
8+
9+
pull_request:
10+
paths:
11+
- 'lambda-runtime-api-client/**'
12+
- 'lambda-extension/**'
13+
14+
15+
jobs:
16+
build-runtime:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
toolchain:
21+
- "1.62.0" # Current MSRV
22+
- stable
23+
env:
24+
RUST_BACKTRACE: 1
25+
steps:
26+
- uses: actions/checkout@v3
27+
28+
- name: Build Runtime API Client
29+
uses: ./.github/actions/rust-build
30+
with:
31+
package: lambda_runtime_api_client
32+
toolchain: ${{ matrix.toolchain}}
33+
34+
35+
- name: Build Extensions runtime
36+
uses: ./.github/actions/rust-build
37+
with:
38+
package: lambda-extension
39+
toolchain: ${{ matrix.toolchain}}

.github/workflows/build-runtime.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Check Lambda Runtime
2+
3+
on:
4+
push:
5+
paths:
6+
- 'lambda-runtime-api-client/**'
7+
- 'lambda-runtime/**'
8+
- 'lambda-http/**'
9+
10+
pull_request:
11+
paths:
12+
- 'lambda-runtime-api-client/**'
13+
- 'lambda-runtime/**'
14+
- 'lambda-http/**'
15+
16+
jobs:
17+
build-runtime:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
toolchain:
22+
- "1.62.0" # Current MSRV
23+
- stable
24+
env:
25+
RUST_BACKTRACE: 1
26+
steps:
27+
- uses: actions/checkout@v3
28+
29+
- name: Build Runtime API Client
30+
uses: ./.github/actions/rust-build
31+
with:
32+
package: lambda_runtime_api_client
33+
toolchain: ${{ matrix.toolchain}}
34+
35+
- name: Build Functions runtime
36+
uses: ./.github/actions/rust-build
37+
with:
38+
package: lambda_runtime
39+
toolchain: ${{ matrix.toolchain}}
40+
41+
- name: Build HTTP layer
42+
uses: ./.github/actions/rust-build
43+
with:
44+
package: lambda_http
45+
toolchain: ${{ matrix.toolchain}}

.github/workflows/build.yml

Lines changed: 0 additions & 93 deletions
This file was deleted.

.github/workflows/check-examples.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Check examples
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
check:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- uses: dtolnay/rust-toolchain@stable
11+
- uses: Swatinem/rust-cache@v2
12+
13+
- name: Check examples
14+
working-directory: examples
15+
shell: bash
16+
run: ./check-examples.sh

.github/workflows/format.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Formatting and Linting
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
check:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- uses: dtolnay/rust-toolchain@stable
11+
- uses: Swatinem/rust-cache@v2
12+
13+
- name: Run fmt check
14+
id: cargoFmt
15+
shell: bash
16+
run: cargo fmt --all -- --check
17+
- name: Notify fmt check
18+
if: failure() && steps.cargoFmt.outcome == 'failure'
19+
uses: actions/github-script@v6
20+
with:
21+
script: |
22+
const message = `👋 It looks like your code is not formatted like we expect.
23+
24+
Please run \`cargo fmt\` and push the code again.`;
25+
26+
await github.rest.issues.createComment({
27+
issue_number: context.issue.number,
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
body: message,
31+
});
32+
core.setFailed('It looks like there are formatting errors');
33+
34+
- name: Run clippy check
35+
id: cargoClippy
36+
shell: bash
37+
run: cargo clippy --workspace --all-features -- -D warnings
38+
- name: Notify fmt check
39+
if: failure() && steps.cargoClippy.outcome == 'failure'
40+
uses: actions/github-script@v6
41+
with:
42+
script: |
43+
const message = `👋 It looks like your code has some linting issues.
44+
45+
Please run \`cargo clippy --fix\` and push the code again.`;
46+
47+
await github.rest.issues.createComment({
48+
issue_number: context.issue.number,
49+
owner: context.repo.owner,
50+
repo: context.repo.repo,
51+
body: message,
52+
});
53+
core.setFailed('It looks like there are linting errors');
54+
55+

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ members = [
44
"lambda-integration-tests",
55
"lambda-runtime-api-client",
66
"lambda-runtime",
7-
"lambda-extension"
7+
"lambda-extension",
8+
"lambda-events"
89
]
910

1011
exclude = ["examples"]

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This package makes it easy to run AWS Lambda Functions written in Rust. This wor
77
- [![Docs](https://docs.rs/lambda_runtime/badge.svg)](https://docs.rs/lambda_runtime) **`lambda-runtime`** is a library that provides a Lambda runtime for applications written in Rust.
88
- [![Docs](https://docs.rs/lambda_http/badge.svg)](https://docs.rs/lambda_http) **`lambda-http`** is a library that makes it easy to write API Gateway proxy event focused Lambda functions in Rust.
99
- [![Docs](https://docs.rs/lambda-extension/badge.svg)](https://docs.rs/lambda-extension) **`lambda-extension`** is a library that makes it easy to write Lambda Runtime Extensions in Rust.
10+
- [![Docs](https://docs.rs/aws_lambda_events/badge.svg)](https://docs.rs/aws_lambda_events) **`lambda-events`** is a library with strongly-typed Lambda event structs in Rust.
1011
- [![Docs](https://docs.rs/lambda_runtime_api_client/badge.svg)](https://docs.rs/lambda_runtime_api_client) **`lambda-runtime-api-client`** is a shared library between the lambda runtime and lambda extension libraries that includes a common API client to talk with the AWS Lambda Runtime API.
1112

1213
The Rust runtime client is an experimental package. It is subject to change and intended only for evaluation purposes.

examples/advanced-sqs-partial-batch-failures/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ serde = "^1"
88
serde_derive = "^1"
99
serde_with = { version = "^2", features = ["json"], optional = true }
1010
serde_json = "^1"
11-
aws_lambda_events = "0.7.3"
12-
lambda_runtime = "0.7"
11+
aws_lambda_events = { path = "../../lambda-events" }
12+
lambda_runtime = { path = "../../lambda-runtime" }
1313
tokio = { version = "1", features = ["macros"] }
1414
futures = "0.3"
1515
tracing = { version = "0.1", features = ["log"] }

examples/basic-s3-thumbnail/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ edition = "2021"
1515
# and it will keep the alphabetic ordering for you.
1616

1717
[dependencies]
18-
aws_lambda_events = "0.7.2"
18+
aws_lambda_events = { path = "../../lambda-events" }
1919
lambda_runtime = { path = "../../lambda-runtime" }
2020
serde = "1"
2121
tokio = { version = "1", features = ["macros"] }

examples/basic-sqs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ edition = "2021"
1515
# and it will keep the alphabetic ordering for you.
1616

1717
[dependencies]
18-
aws_lambda_events = "0.7.2"
18+
aws_lambda_events = { path = "../../lambda-events" }
1919
lambda_runtime = { path = "../../lambda-runtime" }
2020
serde = "1.0.136"
2121
tokio = { version = "1", features = ["macros"] }

0 commit comments

Comments
 (0)