19 Commits

Author SHA1 Message Date
Sébastien Stormacq 72865e405a Update commented deps in examples to use runtime v2 (#616)
Fix example dependencies

Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
2025-12-05 16:48:19 -08:00
Sébastien Stormacq 023b8fe526 Simplify local dependency injection for examples (#612)
See issue #536 

All the examples are now depending on the runtime library located at
`../..`. The `Package.swift` files contain a commented line with the
`.package` to use when user wants to fetch the runtime from GitHub.

---------

Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
2025-11-30 18:48:06 +01:00
Sébastien Stormacq e58d89148c Replace standard documents and processes with AWS ones (#574)
- Adjust notice, security reporting, code of conduct, contribution
process to the standard AWS documents
- Adjust GitHub issue templates to AWS standard ones.
- Adjust the license header in all source files

---------

Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
2025-10-21 23:27:30 +02:00
Sébastien Stormacq dee635267b change references from /swift-server to /awslabs (#591)
Change Examples, README, and doc to refer to https://github.org/awslabs
instead of https://github.org/swift-server

---------

Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
2025-10-17 16:46:58 +02:00
Sébastien Stormacq 74e4efdbac Apply recommendation for security and reliability (#573)
Apply recommendations in code and documentation

- [CI] restrict permissions to read-all instead of the default write-all
- All examples README.md : add a note about Lambda functions
configuration with improved security and scalability changes for
production environment
- Swift docc documentation: add a note about Lambda functions
configuration with improved security and scalability changes for
production environment

---------

Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
2025-09-27 12:39:16 +02:00
Sébastien Stormacq 02d483074d [Example] Use smaller containers in all examples (#571)
All the examples using SAM have a default Lambda runtime environment
memory size of 512Mb.

Lambda functions run in a microVM defined by its memory size. The memory
size influences the CPU power.
(see
https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html)

Increasing memory size increases runtime performance but also increase
costs.

As most of our examples are very simple and small functions, 512Mb
memory is not required. This PR reduces Lambda runtime execution
environment to 128Mb to reduce AWS costs.

Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
2025-09-26 10:10:12 +02:00
Sébastien Stormacq a1ab8df708 Update toolchain and doc for 6.2 (#564)
In preparation for the 2.0.0 GA release,

- Update `.swift-version`, `Package.swift` and all examples'
`package.swift` to Swift 6.2
- Update all references to `2.0.0-beta.3` to `2.0.0`. This includes the
doc and readme, but also the dependencies in the examples
`Package.swift`. This will temporary break the build of the examples,
until we tag v2.0.0. Note the CI will not be affected as its consumes
the local version of the library
- [CI] Use Swift-6.2-noble for all testing tasks
- Reinstate the script to generate the contributors list and update the
list
2025-09-23 21:12:33 +02:00
Sébastien Stormacq 0a6af5b4e1 prepare 2.0.0-beta.1 (#538)
Change dependencies in `Examples/*` and documentation to `from:
"2.0.0-beta.1"`
2025-07-30 19:08:39 +04:00
Sébastien Stormacq bba711bd18 remove mentions of LambdaRuntImeCore (#495)
Cleanup code from mentions of `LambdaRuntimeCore`
2025-03-06 18:50:32 +01:00
Sébastien Stormacq 4d7d23b9c1 [examples] Update to Swift Lambda Events 1.0.0 (#475)
Now that the swift Lambda event library has been tagged 1.0.0, update
all the examples to use `from: "1.0.0"` instead of `main` branch
2025-01-29 22:12:47 +00:00
Sébastien Stormacq 38cc01a000 [example] Update testing doc for clarity and remove some typos (#445) 2024-12-25 20:41:00 +01:00
Sébastien Stormacq cef85b9fe8 [examples] add an example project to show test strategies (#438)
This new example project show four testing strategies for Swift Lambda
function

- Unit testing the business logic (not specific to Swift Lambda) 
- Integration testing the handler method 
- Local invocation with the Swift Lambda Runtime 
- Local invocation with SAM 

**[IMPORTANT]**
To allow testing the handler, I had to change visibility of a method in
the Runtime project. This method is clearly marked for testing only, so
it should not be a problem. Happy to read feedback and discuss however.
2024-12-25 07:43:20 +01:00
Sébastien Stormacq db17a62e38 Restructure Examples folder (#387)
* Restructure Examples folder

* add README

* remove v1 examples

* swift format
2024-10-08 11:07:47 +02:00
Franz Busch ab8166a39d [CI] Add GHA CI and release flow (#340)
Co-authored-by: Fabian Fett <fabianfett@apple.com>
Co-authored-by: Sébastien Stormacq <sebastien.stormacq@gmail.com>
Co-authored-by: Mahdi Bahrami <github@mahdibm.com>
2024-08-26 16:36:07 +02:00
tomer doron 3b72f6a6cf improve examples (#292)
motivation: examples can be confusing since they use relative path to the library for CI purposes

changes:
* update examples to use the library URL, expect when env variable is set for CI purposes
* rename docker compose job to test-examples since it is more accurate
2023-03-12 11:23:41 -07:00
tomer doron c915322eca API Refactoring (#273)
motivation: define stable API in preperation 1.0 release

changes:
* require swift 5.7, remove redundant backwards compatibility code
* make LambdaHandler, EventLoopLambdaHandler, and ByteBufferLambdaHandler disjointed protocols to reduce API surface area
* create coding wrappers for LambdaHandler and EventLoopLambdaHandler to provide bridge to ByteBufferLambdaHandler
* reuse output ByteBuffer to reduce allocations
* add new SimpleLambdaHandler with no-op initializer for simple lambda use cases
* update callsites and tests
* update examples

Co-authored-by: Yim Lee <yim_lee@apple.com>
Co-authored-by: Fabian Fett <fabianfett@apple.com>
2022-11-09 10:08:36 -08:00
tomer doron e5b44962bd Prefix data structures with Lambda instead of namespacing them (#256)
motivation: consisten naming convention

changes:
* Lambda.InitializationContext -> LambdaInitializationContext
* Lambda.Runner -> LambdaRunner
* Lambda.Configuration -> LambdaConfiguration
* Lambda.RuntimeError -> LambdaRuntimeError
* adjust call sites, tests, and examples
2022-04-15 13:33:54 +02:00
Fabian Fett 011e8ddc4b Rename Lambda.Context to LambdaContext (#233) 2021-09-30 01:56:58 +02:00
tomer doron b757de0241 Update and add examples to new APIs (#228)
* take advantage of @main where possible
* move the top level Sample code to the examples subdirectory
* extract a few examples form the "LambdaFunctions" directory (which is really a deployment demo) and move them to the top level Examples directory
*  rename "LambdaFunctions" examples as "Deployments" to make their intent clearer
* add a sample that demonstrates how to test a lambda now that SwiftPM can test executables directly
* update the test-sample docker setup to build & test th new samples
* fix a few typos and In/Out typealias left overs
* remove LinuxMain since its no longer required
2021-09-25 10:30:04 +02:00