You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/03/20 23:30:45 UTC
[GitHub] csantanapr closed pull request #34: Remove swift:4.0, only swift:4.1
csantanapr closed pull request #34: Remove swift:4.0, only swift:4.1
URL: https://github.com/apache/incubator-openwhisk-runtime-swift/pull/34
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/README.md b/README.md
index 1062e48..5fefccc 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,6 @@
## Changelogs
- [Swift 3.1.1 CHANGELOG.md](core/swift3.1.1Action/CHANGELOG.md)
-- [Swift 4.0 CHANGELOG.md](core/swift40Action/CHANGELOG.md)
- [Swift 4.1 CHANGELOG.md](core/swift41Action/CHANGELOG.md)
## Quick Swift Action
@@ -117,7 +116,7 @@ To avoid the cold-start delay, you can compile your Swift file into a binary and
- Run an interactive Swift action container.
```
- docker run --rm -it -v "$(pwd):/owexec" openwhisk/action-swift-v4.0 bash
+ docker run --rm -it -v "$(pwd):/owexec" openwhisk/action-swift-v4.1 bash
```
This puts you in a bash shell within the Docker container.
@@ -162,7 +161,7 @@ let package = Package(
```
As you can see this example adds `SwiftyRequest` dependencies.
- Notice that now with swift:4.0 is no longer required to include `CCurl`, `Kitura-net` and `SwiftyJSON` in your own `Package.swift`.
+ Notice that now with swift:4.1 is no longer required to include `CCurl`, `Kitura-net` and `SwiftyJSON` in your own `Package.swift`.
You are free now to use no dependencies, or add the combination that you want with the versions you want.
- Copy Package.swift to spm-build directory
@@ -194,7 +193,7 @@ let package = Package(
- Upload it to OpenWhisk with the action name helloSwifty:
```
- wsk action update helloSwiftly hello.zip openwhisk/action-swift-v4.0
+ wsk action update helloSwiftly hello.zip openwhisk/action-swift-v4.1
```
- To check how much faster it is, run
@@ -219,15 +218,15 @@ Having a project directory `Hello` under a directory `actions` like the followin
actions/Hello/Package.swift
actions/Hello/Sources/main.swift
```
-Change to the parent directory then run the compile script specify the project directory, the kind `swift:3.1.1` or `swift:4.0` and any swiftc build flags like the following:
+Change to the parent directory then run the compile script specify the project directory, the kind `swift:3.1.1` or `swift:4.1` and any swiftc build flags like the following:
```
cd actions/
-incubator-runtime-swift/tools/build/compile.sh Hello swift:4.0 -v
+incubator-runtime-swift/tools/build/compile.sh Hello swift:4.1 -v
```
This will produce a zip `build/swift4/Hello.zip`
### SwiftyJSON using single source action file
-If you have a swift:3.1.1 action not compile, just as source using the `SwiftyJSON` package, you need to precompile your action and specify the version of SwiftyJSON you wan to use for swift:4.0 kind action.
+If you have a swift:3.1.1 action not compile, just as source using the `SwiftyJSON` package, you need to precompile your action and specify the version of SwiftyJSON you wan to use for swift:4.1 kind action.
Take into account that starting with Swift 4 there is better support to manage JSON data natively.
Note: This is only applicable to the base image provided for the Swift 4 runtime, other downstream such as IBM Cloud Functions extending this image might provide additional SDK and packages including `SwiftyJSON` and IBM Watson SDK, check the vendor documentation for more specific information about packages and versions.
@@ -236,7 +235,7 @@ Note: This is only applicable to the base image provided for the Swift 4 runtime
```
./gradlew core:swift40Action:distDocker
```
-This will produce the image `whisk/action-swift-v4.0`
+This will produce the image `whisk/action-swift-v4.1`
Build and Push image
```
@@ -246,7 +245,7 @@ docker login
### Swift 4.1 Experimental
We have a runtime for swift 4.1, is experimental as we are trying beta builds released by Swift org.
-Follow same insructions for Swift 4.0 above and replace the kind wih `swift:4.1` and image with `openwhisk/action-swift-v4.0`
+Follow same insructions for Swift 4.1 above and replace the kind wih `swift:4.1` and image with `openwhisk/action-swift-v4.1`
## Codable Suppor with Swift 4.x
@@ -336,7 +335,7 @@ wsk action update myAction myAction.swift --kind swift:3.1.1
## Local development
```
-./gradlew core:swiftAction:distDocker
+./gradlew core:swift41Action:distDocker
```
This will produce the image `whisk/action-swift-v3.1.1`
diff --git a/ansible/environments/local/group_vars/all b/ansible/environments/local/group_vars/all
index f11e4e0..2085010 100755
--- a/ansible/environments/local/group_vars/all
+++ b/ansible/environments/local/group_vars/all
@@ -47,13 +47,8 @@ runtimes_manifest:
image:
name: "action-swift-v3.1.1"
deprecated: false
- - kind: "swift:4.0"
- default: true
- image:
- name: "action-swift-v4.0"
- deprecated: false
- kind: "swift:4.1"
- default: false
+ default: true
image:
name: "action-swift-v4.1"
deprecated: false
diff --git a/core/swift40Action/CHANGELOG.md b/core/swift40Action/CHANGELOG.md
deleted file mode 100644
index b934d8b..0000000
--- a/core/swift40Action/CHANGELOG.md
+++ /dev/null
@@ -1,20 +0,0 @@
-# Apache OpenWhisk Swift 4.0 Runtime Container
-
-## 1.0.1
-Changes:
- - Rename image name to `openwhisk/action-swift-v4.0`
- - Rename kind to `swift:4.0`
-
-Swift runtime version: [4.0.3](https://github.com/IBM-Swift/swift-ubuntu-docker/blob/4a821e2db45f7839789f0f516863be8295142ab1/swift-development/Dockerfile)
-
-
-
-## 1.0.0
-Initial Swift 4.0 image
- - Image name: `openwhisk/action-swift-v4`
- - Kind is: `swift:4`
-
-Swift runtime version: [4.0.3](https://github.com/IBM-Swift/swift-ubuntu-docker/blob/4a821e2db45f7839789f0f516863be8295142ab1/swift-development/Dockerfile)
-
-Packages included:
- - No packages included, use Package.swift and pre-compile action.
diff --git a/core/swift40Action/Dockerfile b/core/swift40Action/Dockerfile
deleted file mode 100755
index f14159d..0000000
--- a/core/swift40Action/Dockerfile
+++ /dev/null
@@ -1,30 +0,0 @@
-# Dockerfile for swift actions, overrides and extends ActionRunner from actionProxy
-# This Dockerfile is partially based on: https://github.com/IBM-Swift/swift-ubuntu-docker/blob/master/swift-development/Dockerfile
-FROM ibmcom/swift-ubuntu:4.0.3
-
-# Set WORKDIR
-WORKDIR /
-
-# Upgrade and install basic Python dependencies
-RUN apt-get -y update \
- && apt-get -y install --fix-missing python2.7 python-gevent python-flask zip
-
-# Add the action proxy
-ADD https://raw.githubusercontent.com/apache/incubator-openwhisk-runtime-docker/dockerskeleton%401.1.0/core/actionProxy/actionproxy.py /actionProxy/actionproxy.py
-
-# Add files needed to build and run action
-RUN mkdir -p /swift4Action/spm-build/Sources/Action
-ADD epilogue.swift /swift4Action
-ADD buildandrecord.py /swift4Action
-ADD swift4runner.py /swift4Action
-ADD spm-build/Package.swift /swift4Action/spm-build
-ADD spm-build/_Whisk.swift /swift4Action/spm-build/Sources/Action
-
-# Build
-RUN touch /swift4Action/spm-build/Sources/Action/main.swift
-RUN python /swift4Action/buildandrecord.py && rm /swift4Action/spm-build/.build/release/Action
-#RUN cd /swift4Action/spm-build; swift build -v -c release; rm /swift4Action/spm-build/.build/release/Action
-ENV FLASK_PROXY_PORT 8080
-EXPOSE 8080
-
-CMD ["/bin/bash", "-c", "cd /swift4Action && PYTHONIOENCODING='utf-8' python -u swift4runner.py"]
\ No newline at end of file
diff --git a/core/swift40Action/build.gradle b/core/swift40Action/build.gradle
deleted file mode 100755
index fcde7c2..0000000
--- a/core/swift40Action/build.gradle
+++ /dev/null
@@ -1,2 +0,0 @@
-ext.dockerImageName = 'action-swift-v4.0'
-apply from: '../../gradle/docker.gradle'
diff --git a/core/swift40Action/buildandrecord.py b/core/swift40Action/buildandrecord.py
deleted file mode 100755
index 346ecef..0000000
--- a/core/swift40Action/buildandrecord.py
+++ /dev/null
@@ -1,77 +0,0 @@
-"""Python to generate build script.
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-"""
-from __future__ import print_function
-import os
-import sys
-from subprocess import check_output
-
-# Settings
-COMPILE_PREFIX = "/usr/bin/swiftc -module-name Action "
-LINKER_PREFIX = "/usr/bin/swiftc -target 'x86_64-unknown-linux' -sdk / -L '/swift4Action/spm-build/.build/x86_64-unknown-linux/release' -o '/swift4Action/spm-build/.build/x86_64-unknown-linux/release/Action' -module-name Action -emit-executable -Xlinker '-rpath=$ORIGIN'"
-GENERATED_BUILD_SCRIPT = "/swift4Action/spm-build/swiftbuildandlink.sh"
-SPM_DIRECTORY = "/swift4Action/spm-build"
-BUILD_COMMAND = ["swift", "build", "-v", "-c", "release"]
-
-# Build Swift package and capture step trace
-print("Building action")
-out = check_output(BUILD_COMMAND, cwd=SPM_DIRECTORY)
-print("action built. Decoding compile and link commands")
-
-# Look for compile and link commands in step trace
-compileCommand = None
-linkCommand = None
-
-buildInstructions = out.decode("utf-8").splitlines()
-
-for instruction in buildInstructions:
- if instruction.startswith(COMPILE_PREFIX):
- compileCommand = instruction
-
- # add flag to quiet warnings
- compileCommand += " -suppress-warnings"
-
- elif instruction.startswith(LINKER_PREFIX):
- linkCommand = instruction
-
-# if found, create build script, otherwise exit with error
-if compileCommand is not None and linkCommand is not None:
- print("Generated OpenWhisk Compile command: %s" % compileCommand)
- print("=========")
- print("Generated OpenWhisk Link command: %s" % linkCommand)
-
- with open(GENERATED_BUILD_SCRIPT, "a") as buildScript:
- buildScript.write("#!/bin/bash\n")
- buildScript.write("echo \"Compiling\"\n")
- buildScript.write("%s\n" % compileCommand)
- buildScript.write("swiftStatus=$?\n")
- buildScript.write("echo swiftc status is $swiftStatus\n")
- buildScript.write("if [[ \"$swiftStatus\" -eq \"0\" ]]; then\n")
- buildScript.write("echo \"Linking\"\n")
- buildScript.write("%s\n" % linkCommand)
- buildScript.write("else\n")
- buildScript.write(">2& echo \"Action did not compile\"\n")
- buildScript.write("exit 1\n")
- buildScript.write("fi")
-
- os.chmod(GENERATED_BUILD_SCRIPT, 0o777)
- sys.exit(0)
-else:
- print("Cannot generate build script: compile or link command not found")
- sys.exit(1)
diff --git a/core/swift41Action/build.gradle b/core/swift41Action/build.gradle
index 895dc46..7e91809 100755
--- a/core/swift41Action/build.gradle
+++ b/core/swift41Action/build.gradle
@@ -1,36 +1,2 @@
ext.dockerImageName = 'action-swift-v4.1'
apply from: '../../gradle/docker.gradle'
-
-distDocker.dependsOn 'copyEpilogue'
-distDocker.dependsOn 'copySwiftRunner'
-distDocker.dependsOn 'copyWhisk'
-distDocker.dependsOn 'copyPackageSwift'
-distDocker.finalizedBy('cleanup')
-
-
-task copyEpilogue(type: Copy) {
- from '../swift40Action/epilogue.swift'
- into '.'
-}
-
-task copySwiftRunner(type: Copy) {
- from '../swift40Action/swift4runner.py'
- into '.'
-}
-
-task copyWhisk(type: Copy) {
- from '../swift40Action/spm-build/_Whisk.swift'
- into './spm-build'
-}
-
-task copyPackageSwift(type: Copy) {
- from '../swift40Action/spm-build/Package.swift'
- into './spm-build'
-}
-
-task cleanup(type: Delete) {
- delete 'epilogue.swift'
- delete 'swift4runner.py'
- delete 'spm-build/_Whisk.swift'
- delete 'spm-build/Package.swift'
-}
diff --git a/core/swift40Action/epilogue.swift b/core/swift41Action/epilogue.swift
similarity index 100%
rename from core/swift40Action/epilogue.swift
rename to core/swift41Action/epilogue.swift
diff --git a/core/swift40Action/spm-build/Package.swift b/core/swift41Action/spm-build/Package.swift
similarity index 100%
rename from core/swift40Action/spm-build/Package.swift
rename to core/swift41Action/spm-build/Package.swift
diff --git a/core/swift40Action/spm-build/_Whisk.swift b/core/swift41Action/spm-build/_Whisk.swift
similarity index 100%
rename from core/swift40Action/spm-build/_Whisk.swift
rename to core/swift41Action/spm-build/_Whisk.swift
diff --git a/core/swift40Action/swift4runner.py b/core/swift41Action/swift4runner.py
similarity index 100%
rename from core/swift40Action/swift4runner.py
rename to core/swift41Action/swift4runner.py
diff --git a/settings.gradle b/settings.gradle
index dc7ecfe..bce3ebb 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -2,7 +2,6 @@ include 'tests'
include 'core:swift3.1.1Action'
-include 'core:swift40Action'
include 'core:swift41Action'
rootProject.name = 'runtime-swift'
diff --git a/tests/dat/build.sh b/tests/dat/build.sh
index 97879b8..108dbbf 100755
--- a/tests/dat/build.sh
+++ b/tests/dat/build.sh
@@ -2,9 +2,6 @@
set -e
../../tools/build/compile.sh HelloSwift3 swift:3.1.1 "-v"
-../../tools/build/compile.sh HelloSwift4 swift:4.0 "-v"
-../../tools/build/compile.sh SwiftyRequest swift:4.0 "-v"
-../../tools/build/compile.sh HelloSwift4Codable swift:4.0 "-v"
../../tools/build/compile.sh HelloSwift4 swift:4.1 "-v"
../../tools/build/compile.sh SwiftyRequest swift:4.1 "-v"
diff --git a/tests/dat/build/swift4.0/HelloSwift4.zip b/tests/dat/build/swift4.0/HelloSwift4.zip
deleted file mode 100644
index b230a07..0000000
Binary files a/tests/dat/build/swift4.0/HelloSwift4.zip and /dev/null differ
diff --git a/tests/dat/build/swift4.0/HelloSwift4Codable.zip b/tests/dat/build/swift4.0/HelloSwift4Codable.zip
deleted file mode 100644
index 79cc30b..0000000
Binary files a/tests/dat/build/swift4.0/HelloSwift4Codable.zip and /dev/null differ
diff --git a/tests/dat/build/swift4.0/SwiftyRequest.zip b/tests/dat/build/swift4.0/SwiftyRequest.zip
deleted file mode 100644
index 78ed395..0000000
Binary files a/tests/dat/build/swift4.0/SwiftyRequest.zip and /dev/null differ
diff --git a/tests/src/test/scala/actionContainers/Swift40ActionContainerTests.scala b/tests/src/test/scala/actionContainers/Swift40ActionContainerTests.scala
deleted file mode 100644
index 51ddca7..0000000
--- a/tests/src/test/scala/actionContainers/Swift40ActionContainerTests.scala
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package runtime.actionContainers
-
-import java.io.File
-
-import org.junit.runner.RunWith
-import org.scalatest.junit.JUnitRunner
-import spray.json.{JsObject, JsString}
-import actionContainers.ResourceHelpers
-
-@RunWith(classOf[JUnitRunner])
-class Swift40ActionContainerTests extends SwiftActionContainerTests {
-
- override lazy val swiftContainerImageName = "action-swift-v4.0"
- override lazy val swiftBinaryName = "tests/dat/build/swift4.0/HelloSwift4.zip"
- lazy val partyCompile = "tests/dat/build/swift4.0/SwiftyRequest.zip"
-
- val httpCode = """
- | import Dispatch
- | func main(args:[String: Any]) -> [String:Any] {
- | var resp :[String:Any] = ["error":"getUrl failed"]
- | guard let urlStr = args["getUrl"] as? String else {
- | return ["error":"getUrl not found in action input"]
- | }
- | guard let url = URL(string: urlStr) else {
- | return ["error":"invalid url string \(urlStr)"]
- | }
- | let request = URLRequest(url: url)
- | let session = URLSession(configuration: .default)
- | let semaphore = DispatchSemaphore(value: 0)
- | let task = session.dataTask(with: request, completionHandler: {data, response, error -> Void in
- | print("done with http request")
- | if let error = error {
- | print("There was an error \(error)")
- | } else if let data = data,
- | let response = response as? HTTPURLResponse,
- | response.statusCode == 200 {
- | do {
- | let respJson = try JSONSerialization.jsonObject(with: data)
- | if respJson is [String:Any] {
- | resp = respJson as! [String:Any]
- | } else {
- | resp = ["error":"Response from server is not a dictionary"]
- | }
- | } catch {
- | resp = ["error":"Error creating json from response: \(error)"]
- | }
- | }
- | semaphore.signal()
- | })
- | task.resume()
- | _ = semaphore.wait(timeout: .distantFuture)
- | return resp
- | }
- """.stripMargin
-
- it should "support ability to use 3rd party packages like SwiftyRequest" in {
- val zip = new File(partyCompile).toPath
- val code = ResourceHelpers.readAsBase64(zip)
-
- val (out, err) = withActionContainer() { c =>
- val (initCode, initRes) = c.init(initPayload(code))
- initCode should be(200)
-
- val args = JsObject("message" -> (JsString("serverless")))
- val (runCode, runRes) = c.run(runPayload(args))
-
- runCode should be(200)
- val json = runRes.get.fields.get("json")
- json shouldBe Some(args)
- }
-
- checkStreams(out, err, {
- case (o, e) =>
- if (enforceEmptyOutputStream) o shouldBe empty
- e shouldBe empty
- })
- }
-
- it should "receive a large (1MB) argument" in {
- withActionContainer() { c =>
- val code = """
- | func main(args: [String: Any]) -> [String: Any] {
- | return args
- | }
- |""".stripMargin
-
- val (initCode, initRes) = c.init(initPayload(code))
- initCode should be(200)
-
- val arg = JsObject("arg" -> JsString(("a" * 1048561)))
- val (_, runRes) = c.run(runPayload(arg))
- runRes.get shouldBe arg
- }
- }
-
-}
diff --git a/tests/src/test/scala/actionContainers/Swift40CodableActionContainerTests.scala b/tests/src/test/scala/actionContainers/Swift40CodableActionContainerTests.scala
deleted file mode 100644
index 8a71155..0000000
--- a/tests/src/test/scala/actionContainers/Swift40CodableActionContainerTests.scala
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package runtime.actionContainers
-
-class Swift40CodableActionContainerTests extends SwiftCodableActionContainerTests {
- override lazy val swiftContainerImageName = "action-swift-v4.0"
- override lazy val swiftBinaryName = "tests/dat/build/swift4.0/HelloSwift4Codable.zip"
-}
diff --git a/tests/src/test/scala/actionContainers/Swift41ActionContainerTests.scala b/tests/src/test/scala/actionContainers/Swift41ActionContainerTests.scala
index 04d44b6..8ca8c0e 100644
--- a/tests/src/test/scala/actionContainers/Swift41ActionContainerTests.scala
+++ b/tests/src/test/scala/actionContainers/Swift41ActionContainerTests.scala
@@ -17,12 +17,96 @@
package runtime.actionContainers
+import java.io.File
+
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
+import spray.json.{JsObject, JsString}
+import actionContainers.ResourceHelpers
@RunWith(classOf[JUnitRunner])
-class Swift41ActionContainerTests extends Swift40ActionContainerTests {
+class Swift41ActionContainerTests extends SwiftActionContainerTests {
+
override lazy val swiftContainerImageName = "action-swift-v4.1"
override lazy val swiftBinaryName = "tests/dat/build/swift4.1/HelloSwift4.zip"
- override lazy val partyCompile = "tests/dat/build/swift4.1/SwiftyRequest.zip"
+ lazy val partyCompile = "tests/dat/build/swift4.1/SwiftyRequest.zip"
+
+ val httpCode = """
+ | import Dispatch
+ | func main(args:[String: Any]) -> [String:Any] {
+ | var resp :[String:Any] = ["error":"getUrl failed"]
+ | guard let urlStr = args["getUrl"] as? String else {
+ | return ["error":"getUrl not found in action input"]
+ | }
+ | guard let url = URL(string: urlStr) else {
+ | return ["error":"invalid url string \(urlStr)"]
+ | }
+ | let request = URLRequest(url: url)
+ | let session = URLSession(configuration: .default)
+ | let semaphore = DispatchSemaphore(value: 0)
+ | let task = session.dataTask(with: request, completionHandler: {data, response, error -> Void in
+ | print("done with http request")
+ | if let error = error {
+ | print("There was an error \(error)")
+ | } else if let data = data,
+ | let response = response as? HTTPURLResponse,
+ | response.statusCode == 200 {
+ | do {
+ | let respJson = try JSONSerialization.jsonObject(with: data)
+ | if respJson is [String:Any] {
+ | resp = respJson as! [String:Any]
+ | } else {
+ | resp = ["error":"Response from server is not a dictionary"]
+ | }
+ | } catch {
+ | resp = ["error":"Error creating json from response: \(error)"]
+ | }
+ | }
+ | semaphore.signal()
+ | })
+ | task.resume()
+ | _ = semaphore.wait(timeout: .distantFuture)
+ | return resp
+ | }
+ """.stripMargin
+
+ it should "support ability to use 3rd party packages like SwiftyRequest" in {
+ val zip = new File(partyCompile).toPath
+ val code = ResourceHelpers.readAsBase64(zip)
+
+ val (out, err) = withActionContainer() { c =>
+ val (initCode, initRes) = c.init(initPayload(code))
+ initCode should be(200)
+
+ val args = JsObject("message" -> (JsString("serverless")))
+ val (runCode, runRes) = c.run(runPayload(args))
+
+ runCode should be(200)
+ val json = runRes.get.fields.get("json")
+ json shouldBe Some(args)
+ }
+
+ checkStreams(out, err, {
+ case (o, e) =>
+ if (enforceEmptyOutputStream) o shouldBe empty
+ e shouldBe empty
+ })
+ }
+
+ it should "receive a large (1MB) argument" in {
+ withActionContainer() { c =>
+ val code = """
+ | func main(args: [String: Any]) -> [String: Any] {
+ | return args
+ | }
+ |""".stripMargin
+
+ val (initCode, initRes) = c.init(initPayload(code))
+ initCode should be(200)
+
+ val arg = JsObject("arg" -> JsString(("a" * 1048561)))
+ val (_, runRes) = c.run(runPayload(arg))
+ runRes.get shouldBe arg
+ }
+ }
}
diff --git a/tests/src/test/scala/sdk/Swift40SDKTests.scala b/tests/src/test/scala/sdk/Swift40SDKTests.scala
deleted file mode 100644
index 319a622..0000000
--- a/tests/src/test/scala/sdk/Swift40SDKTests.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package runtime.sdk
-
-import org.junit.runner.RunWith
-import org.scalatest.junit.JUnitRunner
-
-@RunWith(classOf[JUnitRunner])
-class Swift40SDKTests extends SwiftSDKTests {
- override lazy val actionKind = "swift:4.0"
-}
diff --git a/tests/src/test/scala/sdk/Swift41SDKTests.scala b/tests/src/test/scala/sdk/Swift41SDKTests.scala
index 267f15a..edf66c6 100644
--- a/tests/src/test/scala/sdk/Swift41SDKTests.scala
+++ b/tests/src/test/scala/sdk/Swift41SDKTests.scala
@@ -21,6 +21,6 @@ import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
-class Swift41SDKTests extends Swift40SDKTests {
+class Swift41SDKTests extends SwiftSDKTests {
override lazy val actionKind = "swift:4.1"
}
diff --git a/tools/build/compile.sh b/tools/build/compile.sh
index 08c5523..425ffb1 100755
--- a/tools/build/compile.sh
+++ b/tools/build/compile.sh
@@ -23,7 +23,7 @@ if [ -z "$1" ] ; then
exit 1
fi
if [ -z "$2" ] ; then
- echo 'Error: Missing runtime docker image name, for example openwhisk/action-swift-v4.0'
+ echo 'Error: Missing kind, for example swift:4.1'
exit 2
fi
@@ -32,11 +32,6 @@ DEST_SOURCE="$BASE_PATH/spm-build"
RUNTIME="openwhisk/action-swift-v3.1.1"
if [ ${2} == "swift:3.1.1" ]; then
OUTPUT_DIR="build/swift311"
-elif [ ${2} == "swift:4.0" ]; then
- RUNTIME="action-swift-v4.0"
- BASE_PATH="/swift4Action"
- DEST_SOURCE="/$BASE_PATH/spm-build/Sources/Action"
- OUTPUT_DIR="build/swift4.0"
elif [ ${2} == "swift:4.1" ]; then
RUNTIME="action-swift-v4.1"
BASE_PATH="/swift4Action"
diff --git a/tools/travis/build.sh b/tools/travis/build.sh
index 2293a54..8f4db2a 100755
--- a/tools/travis/build.sh
+++ b/tools/travis/build.sh
@@ -49,6 +49,5 @@ TERM=dumb ./gradlew \
cd $ROOTDIR
TERM=dumb ./gradlew \
:core:swift3.1.1Action:distDocker \
-:core:swift40Action:distDocker \
:core:swift41Action:distDocker \
-PdockerImagePrefix=${IMAGE_PREFIX}
diff --git a/tools/travis/publish.sh b/tools/travis/publish.sh
index 480e782..42c2c34 100755
--- a/tools/travis/publish.sh
+++ b/tools/travis/publish.sh
@@ -32,8 +32,6 @@ IMAGE_TAG=$3
if [ ${RUNTIME_VERSION} == "3.1.1" ]; then
RUNTIME="swift3.1.1Action"
-elif [ ${RUNTIME_VERSION} == "4.0" ]; then
- RUNTIME="swift40Action"
elif [ ${RUNTIME_VERSION} == "4.1" ]; then
RUNTIME="swift41Action"
fi
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services