From aab58ad7e80f48f74ffcf27ae62a4fec85b2b096 Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Sun, 18 Dec 2016 12:04:51 +0000 Subject: [PATCH 01/19] Add aws-fsharp template --- docs/providers/aws/cli-reference/create.md | 1 + docs/providers/aws/guide/services.md | 1 + lib/plugins/create/create.js | 1 + .../create/templates/aws-fsharp/.gitignore | 246 ++++++++++++++++++ .../create/templates/aws-fsharp/Handler.fs | 17 ++ .../create/templates/aws-fsharp/build.sh | 14 + .../create/templates/aws-fsharp/global.json | 6 + .../create/templates/aws-fsharp/project.json | 43 +++ .../templates/aws-fsharp/serverless.yml | 84 ++++++ 9 files changed, 413 insertions(+) create mode 100644 lib/plugins/create/templates/aws-fsharp/.gitignore create mode 100644 lib/plugins/create/templates/aws-fsharp/Handler.fs create mode 100644 lib/plugins/create/templates/aws-fsharp/build.sh create mode 100644 lib/plugins/create/templates/aws-fsharp/global.json create mode 100644 lib/plugins/create/templates/aws-fsharp/project.json create mode 100644 lib/plugins/create/templates/aws-fsharp/serverless.yml diff --git a/docs/providers/aws/cli-reference/create.md b/docs/providers/aws/cli-reference/create.md index 4cbca6f09..6d2a2296c 100644 --- a/docs/providers/aws/cli-reference/create.md +++ b/docs/providers/aws/cli-reference/create.md @@ -48,6 +48,7 @@ Most commonly used templates: - aws-java-gradle - aws-scala-sbt - aws-csharp +- aws-fsharp - plugin ## Examples diff --git a/docs/providers/aws/guide/services.md b/docs/providers/aws/guide/services.md index ee776f9e2..dd96c4c24 100644 --- a/docs/providers/aws/guide/services.md +++ b/docs/providers/aws/guide/services.md @@ -58,6 +58,7 @@ Here are the available runtimes for AWS Lambda: * aws-java-maven * aws-scala-sbt * aws-csharp +* aws-fsharp Check out the [create command docs](../cli-reference/create) for all the details and options. diff --git a/lib/plugins/create/create.js b/lib/plugins/create/create.js index 7851a43a8..eb62cc843 100644 --- a/lib/plugins/create/create.js +++ b/lib/plugins/create/create.js @@ -16,6 +16,7 @@ const validTemplates = [ 'aws-java-gradle', 'aws-scala-sbt', 'aws-csharp', + 'aws-fsharp', 'azure-nodejs', 'openwhisk-nodejs', 'openwhisk-python', diff --git a/lib/plugins/create/templates/aws-fsharp/.gitignore b/lib/plugins/create/templates/aws-fsharp/.gitignore new file mode 100644 index 000000000..4dc157e7f --- /dev/null +++ b/lib/plugins/create/templates/aws-fsharp/.gitignore @@ -0,0 +1,246 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Microsoft Azure ApplicationInsights config file +ApplicationInsights.config + +# Windows Store app package directory +AppPackages/ +BundleArtifacts/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe + +# FAKE - F# Make +.fake/ +*.orig + +# macOS +.DS_Store + +# JetBrains Rider C# IDE +.idea* + +# Serverless directories +.serverless diff --git a/lib/plugins/create/templates/aws-fsharp/Handler.fs b/lib/plugins/create/templates/aws-fsharp/Handler.fs new file mode 100644 index 000000000..b9e1806fe --- /dev/null +++ b/lib/plugins/create/templates/aws-fsharp/Handler.fs @@ -0,0 +1,17 @@ +namespace AwsDotnetFsharp +open Amazon.Lambda.Core + +[)>] +do () + +type Request = { Key1 : string; Key2 : string; Key3 : string } +type Response = { Message : string; Request : Request } + +module Handler = + open System + open System.IO + open System.Text + + let hello(request:Request) = + { Message="Go Serverless v1.0! Your function executed successfully!" + Request=request } \ No newline at end of file diff --git a/lib/plugins/create/templates/aws-fsharp/build.sh b/lib/plugins/create/templates/aws-fsharp/build.sh new file mode 100644 index 000000000..c97689e0b --- /dev/null +++ b/lib/plugins/create/templates/aws-fsharp/build.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +#build handlers +dotnet restore +dotnet publish -c release + +#install zip +apt-get -qq update +apt-get -qq -y install zip + +#create deployment package +pushd bin/Release/netcoreapp1.0/publish +zip -r ./deploy-package.zip ./* +popd diff --git a/lib/plugins/create/templates/aws-fsharp/global.json b/lib/plugins/create/templates/aws-fsharp/global.json new file mode 100644 index 000000000..9476c97bb --- /dev/null +++ b/lib/plugins/create/templates/aws-fsharp/global.json @@ -0,0 +1,6 @@ +{ + "sdk": + { + "version": "1.0.0-preview2-003121" + } +} \ No newline at end of file diff --git a/lib/plugins/create/templates/aws-fsharp/project.json b/lib/plugins/create/templates/aws-fsharp/project.json new file mode 100644 index 000000000..aa4637a19 --- /dev/null +++ b/lib/plugins/create/templates/aws-fsharp/project.json @@ -0,0 +1,43 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "compilerName": "fsc", + "emitEntryPoint": false, + "compile": "*.fs", + "debugType": "portable", + "outputName": "FsharpHandlers" + }, + + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.1" + }, + + "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-*", + + "Amazon.Lambda.Core": "1.0.0*", + "Amazon.Lambda.Serialization.Json": "1.0.0", + + "Amazon.Lambda.Tools" : { + "type" :"build", + "version":"0.9.0-preview1" + } + }, + + "tools": { + "dotnet-compile-fsc": { + "version": "1.0.0-*", + "imports": [ + "dnxcore50" + ] + }, + "Amazon.Lambda.Tools": "1.0.0-preview1" + }, + + "frameworks": { + "netcoreapp1.0": { + "imports": "dnxcore50" + } + } +} diff --git a/lib/plugins/create/templates/aws-fsharp/serverless.yml b/lib/plugins/create/templates/aws-fsharp/serverless.yml new file mode 100644 index 000000000..46732efe6 --- /dev/null +++ b/lib/plugins/create/templates/aws-fsharp/serverless.yml @@ -0,0 +1,84 @@ +# Welcome to Serverless! +# +# This file is the main config file for your service. +# It's very minimal at this point and uses default values. +# You can always add more config options for more control. +# We've included some commented out config examples here. +# Just uncomment any of them to get that config option. +# +# For full config options, check the docs: +# docs.serverless.com +# +# Happy Coding! + +service: aws-fsharp # NOTE: update this with your service name + +# You can pin your service to only deploy with a specific Serverless version +# Check out our docs for more details +# frameworkVersion: "=X.X.X" + +provider: + name: aws + runtime: dotnetcore1.0 + +# you can overwrite defaults here +# stage: dev +# region: us-east-1 + +# you can add statements to the Lambda function's IAM Role here +# iamRoleStatements: +# - Effect: "Allow" +# Action: +# - "s3:ListBucket" +# Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ] ] } +# - Effect: "Allow" +# Action: +# - "s3:PutObject" +# Resource: +# Fn::Join: +# - "" +# - - "arn:aws:s3:::" +# - "Ref" : "ServerlessDeploymentBucket" + +# you can define service wide environment variables here +# environment: +# variable1: value1 + +# you can add packaging information here +package: + artifact: bin/Release/netcoreapp1.0/publish/deploy-package.zip +# exclude: +# - exclude-me.js +# - exclude-me-dir/** + +functions: + hello: + handler: FsharpHandlers::AwsDotnetFsharp.Handler::Hello + +# The following are a few example events you can configure +# NOTE: Please make sure to change your handler code to work with those events +# Check the event documentation for details +# events: +# - http: +# path: users/create +# method: get +# - s3: ${env:BUCKET} +# - schedule: rate(10 minutes) +# - sns: greeter-topic +# - stream: arn:aws:dynamodb:region:XXXXXX:table/foo/stream/1970-01-01T00:00:00.000 + +# Define function environment variables here +# environment: +# variable2: value2 + +# you can add CloudFormation resource templates here +#resources: +# Resources: +# NewResource: +# Type: AWS::S3::Bucket +# Properties: +# BucketName: my-new-bucket +# Outputs: +# NewOutput: +# Description: "Description for the output" +# Value: "Some output value" From 0f334d4baf297a31648d05d2bf58745966735ff5 Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Mon, 2 Jan 2017 22:34:33 +0000 Subject: [PATCH 02/19] Add example --- .../examples/hello-world/fsharp/Handler.fs | 17 ++++ .../examples/hello-world/fsharp/project.json | 43 ++++++++++ .../hello-world/fsharp/serverless.yml | 84 +++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 docs/providers/aws/examples/hello-world/fsharp/Handler.fs create mode 100644 docs/providers/aws/examples/hello-world/fsharp/project.json create mode 100644 docs/providers/aws/examples/hello-world/fsharp/serverless.yml diff --git a/docs/providers/aws/examples/hello-world/fsharp/Handler.fs b/docs/providers/aws/examples/hello-world/fsharp/Handler.fs new file mode 100644 index 000000000..b9e1806fe --- /dev/null +++ b/docs/providers/aws/examples/hello-world/fsharp/Handler.fs @@ -0,0 +1,17 @@ +namespace AwsDotnetFsharp +open Amazon.Lambda.Core + +[)>] +do () + +type Request = { Key1 : string; Key2 : string; Key3 : string } +type Response = { Message : string; Request : Request } + +module Handler = + open System + open System.IO + open System.Text + + let hello(request:Request) = + { Message="Go Serverless v1.0! Your function executed successfully!" + Request=request } \ No newline at end of file diff --git a/docs/providers/aws/examples/hello-world/fsharp/project.json b/docs/providers/aws/examples/hello-world/fsharp/project.json new file mode 100644 index 000000000..aa4637a19 --- /dev/null +++ b/docs/providers/aws/examples/hello-world/fsharp/project.json @@ -0,0 +1,43 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "compilerName": "fsc", + "emitEntryPoint": false, + "compile": "*.fs", + "debugType": "portable", + "outputName": "FsharpHandlers" + }, + + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.1" + }, + + "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-*", + + "Amazon.Lambda.Core": "1.0.0*", + "Amazon.Lambda.Serialization.Json": "1.0.0", + + "Amazon.Lambda.Tools" : { + "type" :"build", + "version":"0.9.0-preview1" + } + }, + + "tools": { + "dotnet-compile-fsc": { + "version": "1.0.0-*", + "imports": [ + "dnxcore50" + ] + }, + "Amazon.Lambda.Tools": "1.0.0-preview1" + }, + + "frameworks": { + "netcoreapp1.0": { + "imports": "dnxcore50" + } + } +} diff --git a/docs/providers/aws/examples/hello-world/fsharp/serverless.yml b/docs/providers/aws/examples/hello-world/fsharp/serverless.yml new file mode 100644 index 000000000..46732efe6 --- /dev/null +++ b/docs/providers/aws/examples/hello-world/fsharp/serverless.yml @@ -0,0 +1,84 @@ +# Welcome to Serverless! +# +# This file is the main config file for your service. +# It's very minimal at this point and uses default values. +# You can always add more config options for more control. +# We've included some commented out config examples here. +# Just uncomment any of them to get that config option. +# +# For full config options, check the docs: +# docs.serverless.com +# +# Happy Coding! + +service: aws-fsharp # NOTE: update this with your service name + +# You can pin your service to only deploy with a specific Serverless version +# Check out our docs for more details +# frameworkVersion: "=X.X.X" + +provider: + name: aws + runtime: dotnetcore1.0 + +# you can overwrite defaults here +# stage: dev +# region: us-east-1 + +# you can add statements to the Lambda function's IAM Role here +# iamRoleStatements: +# - Effect: "Allow" +# Action: +# - "s3:ListBucket" +# Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ] ] } +# - Effect: "Allow" +# Action: +# - "s3:PutObject" +# Resource: +# Fn::Join: +# - "" +# - - "arn:aws:s3:::" +# - "Ref" : "ServerlessDeploymentBucket" + +# you can define service wide environment variables here +# environment: +# variable1: value1 + +# you can add packaging information here +package: + artifact: bin/Release/netcoreapp1.0/publish/deploy-package.zip +# exclude: +# - exclude-me.js +# - exclude-me-dir/** + +functions: + hello: + handler: FsharpHandlers::AwsDotnetFsharp.Handler::Hello + +# The following are a few example events you can configure +# NOTE: Please make sure to change your handler code to work with those events +# Check the event documentation for details +# events: +# - http: +# path: users/create +# method: get +# - s3: ${env:BUCKET} +# - schedule: rate(10 minutes) +# - sns: greeter-topic +# - stream: arn:aws:dynamodb:region:XXXXXX:table/foo/stream/1970-01-01T00:00:00.000 + +# Define function environment variables here +# environment: +# variable2: value2 + +# you can add CloudFormation resource templates here +#resources: +# Resources: +# NewResource: +# Type: AWS::S3::Bucket +# Properties: +# BucketName: my-new-bucket +# Outputs: +# NewOutput: +# Description: "Description for the output" +# Value: "Some output value" From 4b438c4ba1c0014ad63ae77185fa76b0668b76ae Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Tue, 3 Jan 2017 00:05:53 +0000 Subject: [PATCH 03/19] Simplify test package step --- lib/plugins/create/templates/aws-fsharp/build.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/plugins/create/templates/aws-fsharp/build.sh b/lib/plugins/create/templates/aws-fsharp/build.sh index c97689e0b..67c7ba660 100644 --- a/lib/plugins/create/templates/aws-fsharp/build.sh +++ b/lib/plugins/create/templates/aws-fsharp/build.sh @@ -4,11 +4,4 @@ dotnet restore dotnet publish -c release -#install zip -apt-get -qq update -apt-get -qq -y install zip - -#create deployment package -pushd bin/Release/netcoreapp1.0/publish -zip -r ./deploy-package.zip ./* -popd +dotnet lambda package --configuration Release --framework netcoreapp1.0 --output-package bin/Release/netcoreapp1.0/deploy-package.zip From 3f0ec7f1aba89395ca8fc719814e6b2412192a97 Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Tue, 3 Jan 2017 00:10:03 +0000 Subject: [PATCH 04/19] Add build.ps1 --- .../create/templates/aws-fsharp/build.ps1 | 19 +++++++++++++++++++ .../create/templates/aws-fsharp/build.sh | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 lib/plugins/create/templates/aws-fsharp/build.ps1 diff --git a/lib/plugins/create/templates/aws-fsharp/build.ps1 b/lib/plugins/create/templates/aws-fsharp/build.ps1 new file mode 100644 index 000000000..564f8678f --- /dev/null +++ b/lib/plugins/create/templates/aws-fsharp/build.ps1 @@ -0,0 +1,19 @@ +# from http://stackoverflow.com/questions/1153126/how-to-create-a-zip-archive-with-powershell#answer-13302548 +function ZipFiles( $zipfilename, $sourcedir ) +{ + Add-Type -Assembly System.IO.Compression.FileSystem + $compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal + [System.IO.Compression.ZipFile]::CreateFromDirectory($sourcedir, + $zipfilename, $compressionLevel, $false) +} + +dotnet restore +dotnet publish -c release +if ($LASTEXITCODE -ne 0) { return } + +$publishDirectory = "bin/release/netcoreapp1.0/publish" +$packageName = "deploy-package.zip" + +rm "$publishDirectory/$packageName" -ErrorAction SilentlyContinue +ZipFiles "$(pwd)/$packageName" "$(pwd)/$publishDirectory" +mv "$packageName" $publishDirectory diff --git a/lib/plugins/create/templates/aws-fsharp/build.sh b/lib/plugins/create/templates/aws-fsharp/build.sh index 67c7ba660..1929db816 100644 --- a/lib/plugins/create/templates/aws-fsharp/build.sh +++ b/lib/plugins/create/templates/aws-fsharp/build.sh @@ -4,4 +4,4 @@ dotnet restore dotnet publish -c release -dotnet lambda package --configuration Release --framework netcoreapp1.0 --output-package bin/Release/netcoreapp1.0/deploy-package.zip +dotnet lambda package --configuration Release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip From b8c371c8e5d63d169e5b85a2e0d4103f2dea2c98 Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Tue, 3 Jan 2017 00:17:56 +0000 Subject: [PATCH 05/19] Remove build.ps1 in favor of build.cmd --- .../create/templates/aws-fsharp/build.cmd | 3 +++ .../create/templates/aws-fsharp/build.ps1 | 19 ------------------- 2 files changed, 3 insertions(+), 19 deletions(-) create mode 100644 lib/plugins/create/templates/aws-fsharp/build.cmd delete mode 100644 lib/plugins/create/templates/aws-fsharp/build.ps1 diff --git a/lib/plugins/create/templates/aws-fsharp/build.cmd b/lib/plugins/create/templates/aws-fsharp/build.cmd new file mode 100644 index 000000000..6c4792a88 --- /dev/null +++ b/lib/plugins/create/templates/aws-fsharp/build.cmd @@ -0,0 +1,3 @@ +dotnet restore +dotnet build --configuration Release +dotnet lambda package --configuration Release --framework netcoreapp1.0 --output-package bin/Release/netcoreapp1.0/deploy-package.zip diff --git a/lib/plugins/create/templates/aws-fsharp/build.ps1 b/lib/plugins/create/templates/aws-fsharp/build.ps1 deleted file mode 100644 index 564f8678f..000000000 --- a/lib/plugins/create/templates/aws-fsharp/build.ps1 +++ /dev/null @@ -1,19 +0,0 @@ -# from http://stackoverflow.com/questions/1153126/how-to-create-a-zip-archive-with-powershell#answer-13302548 -function ZipFiles( $zipfilename, $sourcedir ) -{ - Add-Type -Assembly System.IO.Compression.FileSystem - $compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal - [System.IO.Compression.ZipFile]::CreateFromDirectory($sourcedir, - $zipfilename, $compressionLevel, $false) -} - -dotnet restore -dotnet publish -c release -if ($LASTEXITCODE -ne 0) { return } - -$publishDirectory = "bin/release/netcoreapp1.0/publish" -$packageName = "deploy-package.zip" - -rm "$publishDirectory/$packageName" -ErrorAction SilentlyContinue -ZipFiles "$(pwd)/$packageName" "$(pwd)/$publishDirectory" -mv "$packageName" $publishDirectory From 79a002434ea36f58090da2b652ea20f94e918dea Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Tue, 3 Jan 2017 00:23:57 +0000 Subject: [PATCH 06/19] Added test for aws-fsharp --- lib/plugins/create/create.test.js | 24 +++++++++++++++++++ .../create/templates/aws-fsharp/global.json | 6 ----- 2 files changed, 24 insertions(+), 6 deletions(-) delete mode 100644 lib/plugins/create/templates/aws-fsharp/global.json diff --git a/lib/plugins/create/create.test.js b/lib/plugins/create/create.test.js index eabe5a2d6..c0043af7b 100644 --- a/lib/plugins/create/create.test.js +++ b/lib/plugins/create/create.test.js @@ -121,6 +121,30 @@ describe('Create', () => { }); }); + it('should generate scaffolding for "aws-fsharp" template', () => { + const cwd = process.cwd(); + fse.mkdirsSync(tmpDir); + process.chdir(tmpDir); + create.options.template = 'aws-fsharp'; + + return create.create().then(() => { + expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, 'serverless.yml'))) + .to.be.equal(true); + expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, 'Handler.fs'))) + .to.be.equal(true); + expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, '.gitignore'))) + .to.be.equal(true); + expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, 'build.sh'))) + .to.be.equal(true); + expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, 'build.cmd'))) + .to.be.equal(true); + expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, 'project.json'))) + .to.be.equal(true); + + process.chdir(cwd); + }); + }); + it('should generate scaffolding for "aws-python" template', () => { process.chdir(tmpDir); create.options.template = 'aws-python'; diff --git a/lib/plugins/create/templates/aws-fsharp/global.json b/lib/plugins/create/templates/aws-fsharp/global.json deleted file mode 100644 index 9476c97bb..000000000 --- a/lib/plugins/create/templates/aws-fsharp/global.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "sdk": - { - "version": "1.0.0-preview2-003121" - } -} \ No newline at end of file From 542c95908040fe755239f1a15023c2bc60014c44 Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Tue, 3 Jan 2017 00:26:48 +0000 Subject: [PATCH 07/19] add aws-fsharp integration tests --- docker-compose.yml | 4 ++++ lib/plugins/create/templates/aws-fsharp/build.sh | 1 - tests/templates/test_all_templates | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4649a8550..e39a13771 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -47,6 +47,10 @@ services: image: microsoft/dotnet:1.0.4-sdk volumes: - ./tmp/serverless-integration-test-aws-csharp:/app + aws-fsharp: + image: microsoft/dotnet:1.0.1-sdk-projectjson + volumes: + - ./tmp/serverless-integration-test-aws-fsharp:/app google-nodejs: image: node:6.9.1 volumes: diff --git a/lib/plugins/create/templates/aws-fsharp/build.sh b/lib/plugins/create/templates/aws-fsharp/build.sh index 1929db816..9b3a00c9d 100644 --- a/lib/plugins/create/templates/aws-fsharp/build.sh +++ b/lib/plugins/create/templates/aws-fsharp/build.sh @@ -3,5 +3,4 @@ #build handlers dotnet restore dotnet publish -c release - dotnet lambda package --configuration Release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip diff --git a/tests/templates/test_all_templates b/tests/templates/test_all_templates index 76a345eee..b60e8900a 100755 --- a/tests/templates/test_all_templates +++ b/tests/templates/test_all_templates @@ -9,6 +9,7 @@ function integration-test { } integration-test aws-csharp 'apt-get -qq update && apt-get -qq -y install zip && dotnet restore && dotnet lambda package --configuration release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip' +integration-test aws-fsharp 'dotnet restore && dotnet publish -c release && dotnet lambda package --configuration Release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip' integration-test aws-groovy-gradle ./gradlew build integration-test aws-java-gradle ./gradlew build integration-test aws-java-maven mvn package From dd3ba770f672b8752ece1d58edb6310c9aca0f2b Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Wed, 4 Jan 2017 00:32:10 +0000 Subject: [PATCH 08/19] Added readme and updated yml conf --- .../aws/examples/hello-world/fsharp/README.md | 37 +++++++++++++++++++ .../hello-world/fsharp/serverless.yml | 7 +++- .../templates/aws-fsharp/serverless.yml | 7 +++- 3 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 docs/providers/aws/examples/hello-world/fsharp/README.md diff --git a/docs/providers/aws/examples/hello-world/fsharp/README.md b/docs/providers/aws/examples/hello-world/fsharp/README.md new file mode 100644 index 000000000..7c7de6acb --- /dev/null +++ b/docs/providers/aws/examples/hello-world/fsharp/README.md @@ -0,0 +1,37 @@ + + +# Hello World F# Example + +## Prerequisites + +* Make sure `serverless` is installed. [See installation guide](../../../guide/installation.md). +* [.Net Core 1.0.1 SDK](https://www.microsoft.com/net/download/core) + * 1.1 isn't currently supported by AWS Lambda +* [NodeJS v4 or higher](https://nodejs.org/en/) +* An AWS Account + +## Build and Package + +From the root of this directory, run `build.cmd`, or `build.sh` if on Linux / Mac. + +This will produce your deployment package at `bin/release/netcoreapp1.0/deploy-package.zip`. + +## Deployment and Invocation + +Once packaged, you can follow [these instructions](https://github.com/serverless/serverless#quick-start) to deploy and remotely invoke the function on AWS Lambda. + +In short the commands you will need to run are (from the root of this directory): + +``` +serverless config credentials --provider aws --key {YourAwsAccessKey} --secret {YourAwsSecret} +serverless deploy -v +serverless invoke -f hello -l +serverless remove +``` + +By default this template deploys to us-east-1, you can change that in "serverless.yml" under the `region: us-east-1` key. \ No newline at end of file diff --git a/docs/providers/aws/examples/hello-world/fsharp/serverless.yml b/docs/providers/aws/examples/hello-world/fsharp/serverless.yml index 46732efe6..774d4d5de 100644 --- a/docs/providers/aws/examples/hello-world/fsharp/serverless.yml +++ b/docs/providers/aws/examples/hello-world/fsharp/serverless.yml @@ -46,14 +46,14 @@ provider: # you can add packaging information here package: - artifact: bin/Release/netcoreapp1.0/publish/deploy-package.zip + artifact: bin/Release/netcoreapp1.0/deploy-package.zip # exclude: # - exclude-me.js # - exclude-me-dir/** functions: hello: - handler: FsharpHandlers::AwsDotnetFsharp.Handler::Hello + handler: FsharpHandlers::AwsDotnetFsharp.Handler::hello # The following are a few example events you can configure # NOTE: Please make sure to change your handler code to work with those events @@ -66,6 +66,9 @@ functions: # - schedule: rate(10 minutes) # - sns: greeter-topic # - stream: arn:aws:dynamodb:region:XXXXXX:table/foo/stream/1970-01-01T00:00:00.000 +# - alexaSkill +# - iot: +# sql: "SELECT * FROM 'some_topic'" # Define function environment variables here # environment: diff --git a/lib/plugins/create/templates/aws-fsharp/serverless.yml b/lib/plugins/create/templates/aws-fsharp/serverless.yml index 46732efe6..774d4d5de 100644 --- a/lib/plugins/create/templates/aws-fsharp/serverless.yml +++ b/lib/plugins/create/templates/aws-fsharp/serverless.yml @@ -46,14 +46,14 @@ provider: # you can add packaging information here package: - artifact: bin/Release/netcoreapp1.0/publish/deploy-package.zip + artifact: bin/Release/netcoreapp1.0/deploy-package.zip # exclude: # - exclude-me.js # - exclude-me-dir/** functions: hello: - handler: FsharpHandlers::AwsDotnetFsharp.Handler::Hello + handler: FsharpHandlers::AwsDotnetFsharp.Handler::hello # The following are a few example events you can configure # NOTE: Please make sure to change your handler code to work with those events @@ -66,6 +66,9 @@ functions: # - schedule: rate(10 minutes) # - sns: greeter-topic # - stream: arn:aws:dynamodb:region:XXXXXX:table/foo/stream/1970-01-01T00:00:00.000 +# - alexaSkill +# - iot: +# sql: "SELECT * FROM 'some_topic'" # Define function environment variables here # environment: From db69a87b976a91ee1abac2203d8fd543a830f6f3 Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Wed, 11 Jan 2017 14:30:41 +0000 Subject: [PATCH 09/19] Update scripts, and updated lambda tools package --- docs/providers/aws/examples/hello-world/fsharp/project.json | 2 +- lib/plugins/create/templates/aws-fsharp/build.cmd | 4 ++-- lib/plugins/create/templates/aws-fsharp/build.sh | 2 +- lib/plugins/create/templates/aws-fsharp/project.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/providers/aws/examples/hello-world/fsharp/project.json b/docs/providers/aws/examples/hello-world/fsharp/project.json index aa4637a19..3e6bff2b9 100644 --- a/docs/providers/aws/examples/hello-world/fsharp/project.json +++ b/docs/providers/aws/examples/hello-world/fsharp/project.json @@ -32,7 +32,7 @@ "dnxcore50" ] }, - "Amazon.Lambda.Tools": "1.0.0-preview1" + "Amazon.Lambda.Tools": "1.0.4-preview1" }, "frameworks": { diff --git a/lib/plugins/create/templates/aws-fsharp/build.cmd b/lib/plugins/create/templates/aws-fsharp/build.cmd index 6c4792a88..2c0a15613 100644 --- a/lib/plugins/create/templates/aws-fsharp/build.cmd +++ b/lib/plugins/create/templates/aws-fsharp/build.cmd @@ -1,3 +1,3 @@ dotnet restore -dotnet build --configuration Release -dotnet lambda package --configuration Release --framework netcoreapp1.0 --output-package bin/Release/netcoreapp1.0/deploy-package.zip +dotnet publish -c release +dotnet lambda package --configuration release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip diff --git a/lib/plugins/create/templates/aws-fsharp/build.sh b/lib/plugins/create/templates/aws-fsharp/build.sh index 9b3a00c9d..941f3ace8 100644 --- a/lib/plugins/create/templates/aws-fsharp/build.sh +++ b/lib/plugins/create/templates/aws-fsharp/build.sh @@ -3,4 +3,4 @@ #build handlers dotnet restore dotnet publish -c release -dotnet lambda package --configuration Release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip +dotnet lambda package --configuration release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip diff --git a/lib/plugins/create/templates/aws-fsharp/project.json b/lib/plugins/create/templates/aws-fsharp/project.json index aa4637a19..3e6bff2b9 100644 --- a/lib/plugins/create/templates/aws-fsharp/project.json +++ b/lib/plugins/create/templates/aws-fsharp/project.json @@ -32,7 +32,7 @@ "dnxcore50" ] }, - "Amazon.Lambda.Tools": "1.0.0-preview1" + "Amazon.Lambda.Tools": "1.0.4-preview1" }, "frameworks": { From b319a64216b9cf685b3617771166bfe8353beefb Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Sat, 14 Jan 2017 01:39:36 +0000 Subject: [PATCH 10/19] Updated lambda tools --- docs/providers/aws/examples/hello-world/fsharp/project.json | 2 +- lib/plugins/create/templates/aws-fsharp/project.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/providers/aws/examples/hello-world/fsharp/project.json b/docs/providers/aws/examples/hello-world/fsharp/project.json index 3e6bff2b9..232aef87d 100644 --- a/docs/providers/aws/examples/hello-world/fsharp/project.json +++ b/docs/providers/aws/examples/hello-world/fsharp/project.json @@ -21,7 +21,7 @@ "Amazon.Lambda.Tools" : { "type" :"build", - "version":"0.9.0-preview1" + "version":"1.0.4-preview1" } }, diff --git a/lib/plugins/create/templates/aws-fsharp/project.json b/lib/plugins/create/templates/aws-fsharp/project.json index 3e6bff2b9..232aef87d 100644 --- a/lib/plugins/create/templates/aws-fsharp/project.json +++ b/lib/plugins/create/templates/aws-fsharp/project.json @@ -21,7 +21,7 @@ "Amazon.Lambda.Tools" : { "type" :"build", - "version":"0.9.0-preview1" + "version":"1.0.4-preview1" } }, From 53e61df65c8a7c1194d55a09d5e627acf76424a7 Mon Sep 17 00:00:00 2001 From: Philipp Muens Date: Mon, 23 Jan 2017 12:28:52 +0100 Subject: [PATCH 11/19] Update Lambda Tools version for F# template --- docs/providers/aws/examples/hello-world/fsharp/project.json | 4 ++-- lib/plugins/create/templates/aws-fsharp/project.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/providers/aws/examples/hello-world/fsharp/project.json b/docs/providers/aws/examples/hello-world/fsharp/project.json index 232aef87d..9ba920e18 100644 --- a/docs/providers/aws/examples/hello-world/fsharp/project.json +++ b/docs/providers/aws/examples/hello-world/fsharp/project.json @@ -21,7 +21,7 @@ "Amazon.Lambda.Tools" : { "type" :"build", - "version":"1.0.4-preview1" + "version":"1.1.0-preview1" } }, @@ -32,7 +32,7 @@ "dnxcore50" ] }, - "Amazon.Lambda.Tools": "1.0.4-preview1" + "Amazon.Lambda.Tools": "1.1.0-preview1" }, "frameworks": { diff --git a/lib/plugins/create/templates/aws-fsharp/project.json b/lib/plugins/create/templates/aws-fsharp/project.json index 232aef87d..9ba920e18 100644 --- a/lib/plugins/create/templates/aws-fsharp/project.json +++ b/lib/plugins/create/templates/aws-fsharp/project.json @@ -21,7 +21,7 @@ "Amazon.Lambda.Tools" : { "type" :"build", - "version":"1.0.4-preview1" + "version":"1.1.0-preview1" } }, @@ -32,7 +32,7 @@ "dnxcore50" ] }, - "Amazon.Lambda.Tools": "1.0.4-preview1" + "Amazon.Lambda.Tools": "1.1.0-preview1" }, "frameworks": { From c95061d5db63aa506d6ef173a4d3382c39b20aa8 Mon Sep 17 00:00:00 2001 From: Philipp Muens Date: Mon, 23 Jan 2017 12:29:42 +0100 Subject: [PATCH 12/19] Fix indentation and path in serverless.yml template files --- docs/providers/aws/examples/hello-world/fsharp/serverless.yml | 2 +- lib/plugins/create/templates/aws-fsharp/serverless.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/providers/aws/examples/hello-world/fsharp/serverless.yml b/docs/providers/aws/examples/hello-world/fsharp/serverless.yml index 774d4d5de..c90e1089a 100644 --- a/docs/providers/aws/examples/hello-world/fsharp/serverless.yml +++ b/docs/providers/aws/examples/hello-world/fsharp/serverless.yml @@ -46,7 +46,7 @@ provider: # you can add packaging information here package: - artifact: bin/Release/netcoreapp1.0/deploy-package.zip + artifact: bin/release/netcoreapp1.0/deploy-package.zip # exclude: # - exclude-me.js # - exclude-me-dir/** diff --git a/lib/plugins/create/templates/aws-fsharp/serverless.yml b/lib/plugins/create/templates/aws-fsharp/serverless.yml index 774d4d5de..c90e1089a 100644 --- a/lib/plugins/create/templates/aws-fsharp/serverless.yml +++ b/lib/plugins/create/templates/aws-fsharp/serverless.yml @@ -46,7 +46,7 @@ provider: # you can add packaging information here package: - artifact: bin/Release/netcoreapp1.0/deploy-package.zip + artifact: bin/release/netcoreapp1.0/deploy-package.zip # exclude: # - exclude-me.js # - exclude-me-dir/** From 6a6db5d85633630015911dc325a4255cd328044a Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Sun, 29 Jan 2017 23:54:07 +0000 Subject: [PATCH 13/19] Removed redundant publish command --- lib/plugins/create/templates/aws-fsharp/build.cmd | 5 ++--- lib/plugins/create/templates/aws-fsharp/build.sh | 3 +-- tests/templates/test_all_templates | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/plugins/create/templates/aws-fsharp/build.cmd b/lib/plugins/create/templates/aws-fsharp/build.cmd index 2c0a15613..468f8503a 100644 --- a/lib/plugins/create/templates/aws-fsharp/build.cmd +++ b/lib/plugins/create/templates/aws-fsharp/build.cmd @@ -1,3 +1,2 @@ -dotnet restore -dotnet publish -c release -dotnet lambda package --configuration release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip +dotnet restore +dotnet lambda package --configuration release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip diff --git a/lib/plugins/create/templates/aws-fsharp/build.sh b/lib/plugins/create/templates/aws-fsharp/build.sh index 941f3ace8..79bfb4d1b 100644 --- a/lib/plugins/create/templates/aws-fsharp/build.sh +++ b/lib/plugins/create/templates/aws-fsharp/build.sh @@ -2,5 +2,4 @@ #build handlers dotnet restore -dotnet publish -c release -dotnet lambda package --configuration release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip +dotnet lambda package --configuration release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip diff --git a/tests/templates/test_all_templates b/tests/templates/test_all_templates index b60e8900a..6a450f0e3 100755 --- a/tests/templates/test_all_templates +++ b/tests/templates/test_all_templates @@ -9,7 +9,7 @@ function integration-test { } integration-test aws-csharp 'apt-get -qq update && apt-get -qq -y install zip && dotnet restore && dotnet lambda package --configuration release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip' -integration-test aws-fsharp 'dotnet restore && dotnet publish -c release && dotnet lambda package --configuration Release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip' +integration-test aws-fsharp 'dotnet restore && dotnet lambda package --configuration release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip' integration-test aws-groovy-gradle ./gradlew build integration-test aws-java-gradle ./gradlew build integration-test aws-java-maven mvn package From c18a07191800d8406f28a450940d6819bd14ed51 Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Wed, 22 Mar 2017 22:07:51 +0000 Subject: [PATCH 14/19] Update to latest tooling --- .../hello-world/fsharp/aws-fsharp.fsproj | 28 ++++++++++++ .../examples/hello-world/fsharp/project.json | 43 ------------------- lib/plugins/create/create.test.js | 2 +- .../templates/aws-fsharp/aws-fsharp.fsproj | 28 ++++++++++++ .../create/templates/aws-fsharp/project.json | 43 ------------------- 5 files changed, 57 insertions(+), 87 deletions(-) create mode 100644 docs/providers/aws/examples/hello-world/fsharp/aws-fsharp.fsproj delete mode 100644 docs/providers/aws/examples/hello-world/fsharp/project.json create mode 100644 lib/plugins/create/templates/aws-fsharp/aws-fsharp.fsproj delete mode 100644 lib/plugins/create/templates/aws-fsharp/project.json diff --git a/docs/providers/aws/examples/hello-world/fsharp/aws-fsharp.fsproj b/docs/providers/aws/examples/hello-world/fsharp/aws-fsharp.fsproj new file mode 100644 index 000000000..9382205fe --- /dev/null +++ b/docs/providers/aws/examples/hello-world/fsharp/aws-fsharp.fsproj @@ -0,0 +1,28 @@ + + + + netcoreapp1.0 + portable + FsharpHandlers + Library + aws-fsharp + 1.0.4 + $(PackageTargetFallback);dnxcore50 + + + + + + + + + + + + + + + + + + diff --git a/docs/providers/aws/examples/hello-world/fsharp/project.json b/docs/providers/aws/examples/hello-world/fsharp/project.json deleted file mode 100644 index 9ba920e18..000000000 --- a/docs/providers/aws/examples/hello-world/fsharp/project.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "version": "1.0.0-*", - "buildOptions": { - "compilerName": "fsc", - "emitEntryPoint": false, - "compile": "*.fs", - "debugType": "portable", - "outputName": "FsharpHandlers" - }, - - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.1" - }, - - "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-*", - - "Amazon.Lambda.Core": "1.0.0*", - "Amazon.Lambda.Serialization.Json": "1.0.0", - - "Amazon.Lambda.Tools" : { - "type" :"build", - "version":"1.1.0-preview1" - } - }, - - "tools": { - "dotnet-compile-fsc": { - "version": "1.0.0-*", - "imports": [ - "dnxcore50" - ] - }, - "Amazon.Lambda.Tools": "1.1.0-preview1" - }, - - "frameworks": { - "netcoreapp1.0": { - "imports": "dnxcore50" - } - } -} diff --git a/lib/plugins/create/create.test.js b/lib/plugins/create/create.test.js index c0043af7b..e79a9e160 100644 --- a/lib/plugins/create/create.test.js +++ b/lib/plugins/create/create.test.js @@ -138,7 +138,7 @@ describe('Create', () => { .to.be.equal(true); expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, 'build.cmd'))) .to.be.equal(true); - expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, 'project.json'))) + expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, 'aws-fsharp.fsproj'))) .to.be.equal(true); process.chdir(cwd); diff --git a/lib/plugins/create/templates/aws-fsharp/aws-fsharp.fsproj b/lib/plugins/create/templates/aws-fsharp/aws-fsharp.fsproj new file mode 100644 index 000000000..9382205fe --- /dev/null +++ b/lib/plugins/create/templates/aws-fsharp/aws-fsharp.fsproj @@ -0,0 +1,28 @@ + + + + netcoreapp1.0 + portable + FsharpHandlers + Library + aws-fsharp + 1.0.4 + $(PackageTargetFallback);dnxcore50 + + + + + + + + + + + + + + + + + + diff --git a/lib/plugins/create/templates/aws-fsharp/project.json b/lib/plugins/create/templates/aws-fsharp/project.json deleted file mode 100644 index 9ba920e18..000000000 --- a/lib/plugins/create/templates/aws-fsharp/project.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "version": "1.0.0-*", - "buildOptions": { - "compilerName": "fsc", - "emitEntryPoint": false, - "compile": "*.fs", - "debugType": "portable", - "outputName": "FsharpHandlers" - }, - - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.1" - }, - - "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-*", - - "Amazon.Lambda.Core": "1.0.0*", - "Amazon.Lambda.Serialization.Json": "1.0.0", - - "Amazon.Lambda.Tools" : { - "type" :"build", - "version":"1.1.0-preview1" - } - }, - - "tools": { - "dotnet-compile-fsc": { - "version": "1.0.0-*", - "imports": [ - "dnxcore50" - ] - }, - "Amazon.Lambda.Tools": "1.1.0-preview1" - }, - - "frameworks": { - "netcoreapp1.0": { - "imports": "dnxcore50" - } - } -} From ab002291f7cc4a882778397c9c9c8f18a8a4f1e7 Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Wed, 22 Mar 2017 22:41:22 +0000 Subject: [PATCH 15/19] Renamed .gitignore -> gitignore --- lib/plugins/create/templates/aws-fsharp/{.gitignore => gitignore} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lib/plugins/create/templates/aws-fsharp/{.gitignore => gitignore} (100%) diff --git a/lib/plugins/create/templates/aws-fsharp/.gitignore b/lib/plugins/create/templates/aws-fsharp/gitignore similarity index 100% rename from lib/plugins/create/templates/aws-fsharp/.gitignore rename to lib/plugins/create/templates/aws-fsharp/gitignore From 84a0e4f0cd8210efce10874547e1c18048496b93 Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Thu, 23 Mar 2017 17:22:35 +0000 Subject: [PATCH 16/19] Updated dotnet sdk docker image --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e39a13771..227462503 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,7 +48,7 @@ services: volumes: - ./tmp/serverless-integration-test-aws-csharp:/app aws-fsharp: - image: microsoft/dotnet:1.0.1-sdk-projectjson + image: microsoft/dotnet:1.0.4-sdk volumes: - ./tmp/serverless-integration-test-aws-fsharp:/app google-nodejs: From bf80fc928857e0644a29f906d3d84278e5f874e4 Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Sat, 24 Jun 2017 16:52:09 +0100 Subject: [PATCH 17/19] Update libraries and match csharp changes --- .../examples/hello-world/fsharp/aws-fsharp.fsproj | 12 ++++-------- lib/plugins/create/create.test.js | 6 ++---- lib/plugins/create/templates/aws-fsharp/Handler.fs | 4 ++-- .../create/templates/aws-fsharp/aws-fsharp.fsproj | 12 ++++-------- lib/plugins/create/templates/aws-fsharp/build.sh | 7 ++++++- lib/plugins/create/templates/aws-fsharp/global.json | 5 +++++ tests/templates/test_all_templates | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 lib/plugins/create/templates/aws-fsharp/global.json diff --git a/docs/providers/aws/examples/hello-world/fsharp/aws-fsharp.fsproj b/docs/providers/aws/examples/hello-world/fsharp/aws-fsharp.fsproj index 9382205fe..f3a1aafd4 100644 --- a/docs/providers/aws/examples/hello-world/fsharp/aws-fsharp.fsproj +++ b/docs/providers/aws/examples/hello-world/fsharp/aws-fsharp.fsproj @@ -2,12 +2,8 @@ netcoreapp1.0 - portable FsharpHandlers - Library aws-fsharp - 1.0.4 - $(PackageTargetFallback);dnxcore50 @@ -15,14 +11,14 @@ - - - + + + - + diff --git a/lib/plugins/create/create.test.js b/lib/plugins/create/create.test.js index e79a9e160..f77496b3d 100644 --- a/lib/plugins/create/create.test.js +++ b/lib/plugins/create/create.test.js @@ -122,8 +122,6 @@ describe('Create', () => { }); it('should generate scaffolding for "aws-fsharp" template', () => { - const cwd = process.cwd(); - fse.mkdirsSync(tmpDir); process.chdir(tmpDir); create.options.template = 'aws-fsharp'; @@ -140,8 +138,8 @@ describe('Create', () => { .to.be.equal(true); expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, 'aws-fsharp.fsproj'))) .to.be.equal(true); - - process.chdir(cwd); + expect(create.serverless.utils.fileExistsSync(path.join(tmpDir, 'global.json'))) + .to.be.equal(true); }); }); diff --git a/lib/plugins/create/templates/aws-fsharp/Handler.fs b/lib/plugins/create/templates/aws-fsharp/Handler.fs index b9e1806fe..e1eb3a208 100644 --- a/lib/plugins/create/templates/aws-fsharp/Handler.fs +++ b/lib/plugins/create/templates/aws-fsharp/Handler.fs @@ -12,6 +12,6 @@ module Handler = open System.IO open System.Text - let hello(request:Request) = + let hello(request:Request) = { Message="Go Serverless v1.0! Your function executed successfully!" - Request=request } \ No newline at end of file + Request=request } diff --git a/lib/plugins/create/templates/aws-fsharp/aws-fsharp.fsproj b/lib/plugins/create/templates/aws-fsharp/aws-fsharp.fsproj index 9382205fe..f3a1aafd4 100644 --- a/lib/plugins/create/templates/aws-fsharp/aws-fsharp.fsproj +++ b/lib/plugins/create/templates/aws-fsharp/aws-fsharp.fsproj @@ -2,12 +2,8 @@ netcoreapp1.0 - portable FsharpHandlers - Library aws-fsharp - 1.0.4 - $(PackageTargetFallback);dnxcore50 @@ -15,14 +11,14 @@ - - - + + + - + diff --git a/lib/plugins/create/templates/aws-fsharp/build.sh b/lib/plugins/create/templates/aws-fsharp/build.sh index 79bfb4d1b..892b0f289 100644 --- a/lib/plugins/create/templates/aws-fsharp/build.sh +++ b/lib/plugins/create/templates/aws-fsharp/build.sh @@ -1,5 +1,10 @@ #!/bin/bash -#build handlers +#install zip +apt-get -qq update +apt-get -qq -y install zip + dotnet restore + +#create deployment package dotnet lambda package --configuration release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip diff --git a/lib/plugins/create/templates/aws-fsharp/global.json b/lib/plugins/create/templates/aws-fsharp/global.json new file mode 100644 index 000000000..8af244a46 --- /dev/null +++ b/lib/plugins/create/templates/aws-fsharp/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "1.0.4" + } +} diff --git a/tests/templates/test_all_templates b/tests/templates/test_all_templates index 6a450f0e3..b539c35d1 100755 --- a/tests/templates/test_all_templates +++ b/tests/templates/test_all_templates @@ -9,7 +9,7 @@ function integration-test { } integration-test aws-csharp 'apt-get -qq update && apt-get -qq -y install zip && dotnet restore && dotnet lambda package --configuration release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip' -integration-test aws-fsharp 'dotnet restore && dotnet lambda package --configuration release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip' +integration-test aws-fsharp 'apt-get -qq update && apt-get -qq -y install zip && dotnet restore && dotnet lambda package --configuration release --framework netcoreapp1.0 --output-package bin/release/netcoreapp1.0/deploy-package.zip' integration-test aws-groovy-gradle ./gradlew build integration-test aws-java-gradle ./gradlew build integration-test aws-java-maven mvn package From edaba87927830713c2c41b3f17166a02bf2277bd Mon Sep 17 00:00:00 2001 From: Philipp Muens Date: Mon, 26 Jun 2017 08:40:40 +0200 Subject: [PATCH 18/19] Update fsharp serverless.yml file --- .../create/templates/aws-fsharp/serverless.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/plugins/create/templates/aws-fsharp/serverless.yml b/lib/plugins/create/templates/aws-fsharp/serverless.yml index c90e1089a..314962e28 100644 --- a/lib/plugins/create/templates/aws-fsharp/serverless.yml +++ b/lib/plugins/create/templates/aws-fsharp/serverless.yml @@ -39,6 +39,7 @@ provider: # - "" # - - "arn:aws:s3:::" # - "Ref" : "ServerlessDeploymentBucket" +# - "/*" # you can define service wide environment variables here # environment: @@ -69,6 +70,19 @@ functions: # - alexaSkill # - iot: # sql: "SELECT * FROM 'some_topic'" +# - cloudwatchEvent: +# event: +# source: +# - "aws.ec2" +# detail-type: +# - "EC2 Instance State-change Notification" +# detail: +# state: +# - pending +# - cloudwatchLog: '/aws/lambda/hello' +# - cognitoUserPool: +# pool: MyUserPool +# trigger: PreSignUp # Define function environment variables here # environment: From 5ff7e72f5fb69fe94466f3c8e8b57430d469e3f6 Mon Sep 17 00:00:00 2001 From: Philipp Muens Date: Mon, 26 Jun 2017 08:40:52 +0200 Subject: [PATCH 19/19] Update csharp serverless.yml file --- lib/plugins/create/templates/aws-csharp/serverless.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/plugins/create/templates/aws-csharp/serverless.yml b/lib/plugins/create/templates/aws-csharp/serverless.yml index 5d227388b..1498ed2a5 100644 --- a/lib/plugins/create/templates/aws-csharp/serverless.yml +++ b/lib/plugins/create/templates/aws-csharp/serverless.yml @@ -67,6 +67,7 @@ functions: # - schedule: rate(10 minutes) # - sns: greeter-topic # - stream: arn:aws:dynamodb:region:XXXXXX:table/foo/stream/1970-01-01T00:00:00.000 +# - alexaSkill # - iot: # sql: "SELECT * FROM 'some_topic'" # - cloudwatchEvent: