Skip to content

Commit

Permalink
Merge pull request #538 from xlight05/master
Browse files Browse the repository at this point in the history
Merge Service based implementation to master
  • Loading branch information
xlight05 authored Oct 14, 2022
2 parents b221d9b + 40f9acd commit 883e697
Show file tree
Hide file tree
Showing 223 changed files with 14,620 additions and 24,300 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/publish-pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Publish pre-release

on:
workflow_dispatch:

jobs:
publish-release:
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 11
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name ${{ secrets.BALLERINA_BOT_USERNAME }}
git config --global user.email ${{ secrets.BALLERINA_BOT_EMAIL }}
./gradlew build -x check -x test
- name: Set version env variable
run: echo "VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties)" >> $GITHUB_ENV
- name: Pre release dependency version update
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
echo "Version: ${VERSION}"
git checkout -b release-${VERSION}
sed -i 's/ballerinaLangVersion=\(.*\)-SNAPSHOT/ballerinaLangVersion=\1/g' gradle.properties
sed -i 's/ballerinaLangVersion=\(.*\)-[0-9]\{8\}-[0-9]\{6\}-.*$/ballerinaLangVersion=\1/g' gradle.properties
sed -i 's/stdlib\(.*\)=\(.*\)-SNAPSHOT/stdlib\1=\2/g' gradle.properties
sed -i 's/stdlib\(.*\)=\(.*\)-[0-9]\{8\}-[0-9]\{6\}-.*$/stdlib\1=\2/g' gradle.properties
sed -i 's/observe\(.*\)=\(.*\)-SNAPSHOT/observe\1=\2/g' gradle.properties
sed -i 's/observe\(.*\)=\(.*\)-[0-9]\{8\}-[0-9]\{6\}-.*$/observe\1=\2/g' gradle.properties
git add gradle.properties
git commit -m "Move dependencies to stable version" || echo "No changes to commit"
- name: Publish artifact
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }}
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
publishUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
publishPAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
./gradlew clean release -Prelease.useAutomaticVersion=true
./gradlew -Pversion=${VERSION} publish -x test -PpublishToCentral=true
- name: GitHub Release and Release Sync PR
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
gh release create v$VERSION --title "module-ballerinax-azure.functions-v$VERSION"
gh pr create --title "[Automated] Sync master after $VERSION release" --body "Sync master after $VERSION release"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ target
.ballerina
.idea
*.iml

compiler-plugin-tests/src/test/resources/handlers/.vscode/
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import ballerinax/azure_functions as af;
// HTTP request/response with no authentication
@af:Function
public isolated function hello(@af:HTTPTrigger { authLevel: "anonymous" } string payload)
returns @af:HTTPOutput string|error {
returns @af:HttpOutput string|error {
return "Hello, " + payload + "!";
}
Expand All @@ -39,7 +39,7 @@ public isolated function hello(@af:HTTPTrigger { authLevel: "anonymous" } string
public isolated function fromHttpToQueue(af:Context ctx,
@af:HTTPTrigger af:HTTPRequest req,
@af:QueueOutput { queueName: "queue1" } af:StringOutputBinding msg)
returns @af:HTTPOutput af:HTTPBinding {
returns @af:HttpOutput af:HTTPBinding {
msg.value = req.body;
return { statusCode: 200, payload: "Request: " + req.toString() };
}
Expand Down Expand Up @@ -68,7 +68,7 @@ public isolated function fromBlobToQueue(af:Context ctx,
@af:Function
public isolated function httpTriggerBlobInput(@af:HTTPTrigger af:HTTPRequest req,
@af:BlobInput { path: "bpath1/{Query.name}" } byte[]? blobIn)
returns @af:HTTPOutput string {
returns @af:HttpOutput string {
int length = 0;
if blobIn is byte[] {
length = blobIn.length();
Expand All @@ -81,7 +81,7 @@ public isolated function httpTriggerBlobInput(@af:HTTPTrigger af:HTTPRequest req
@af:Function
public isolated function httpTriggerBlobOutput(@af:HTTPTrigger af:HTTPRequest req,
@af:BlobOutput { path: "bpath1/{Query.name}" } af:StringOutputBinding bb)
returns @af:HTTPOutput string|error {
returns @af:HttpOutput string|error {
bb.value = req.body;
return "Blob: " + req.query["name"].toString() + " Content: " +
bb?.value.toString();
Expand All @@ -91,7 +91,7 @@ public isolated function httpTriggerBlobOutput(@af:HTTPTrigger af:HTTPRequest re
@af:Function
public isolated function httpTriggerBlobOutput2(@af:HTTPTrigger af:HTTPRequest req,
@af:BlobOutput { path: "bpath1/{Query.name}" } af:BytesOutputBinding bb)
returns @af:HTTPOutput string|error {
returns @af:HttpOutput string|error {
bb.value = [65, 66, 67, 97, 98];
return "Blob: " + req.query["name"].toString() + " Content: " +
bb?.value.toString();
Expand All @@ -102,7 +102,7 @@ public isolated function httpTriggerBlobOutput2(@af:HTTPTrigger af:HTTPRequest r
public isolated function sendSMS(@af:HTTPTrigger af:HTTPRequest req,
@af:TwilioSmsOutput { fromNumber: "+12069845840" }
af:TwilioSmsOutputBinding tb)
returns @af:HTTPOutput string {
returns @af:HttpOutput string {
tb.to = req.query["to"].toString();
tb.body = req.body.toString();
return "Message - to: " + tb?.to.toString() + " body: " + tb?.body.toString();
Expand Down Expand Up @@ -138,7 +138,7 @@ public isolated function httpTriggerCosmosDBInput1(
@af:CosmosDBInput { connectionStringSetting: "CosmosDBConnection",
databaseName: "db1", collectionName: "c1",
id: "{Query.id}", partitionKey: "{Query.country}" } json dbReq)
returns @af:HTTPOutput string|error {
returns @af:HttpOutput string|error {
return dbReq.toString();
}
Expand All @@ -148,7 +148,7 @@ public isolated function httpTriggerCosmosDBInput2(
@af:CosmosDBInput { connectionStringSetting: "CosmosDBConnection",
databaseName: "db1", collectionName: "c1",
id: "{Query.id}", partitionKey: "{Query.country}" } Person? dbReq)
returns @af:HTTPOutput string|error {
returns @af:HttpOutput string|error {
return dbReq.toString();
}
Expand All @@ -159,14 +159,14 @@ public isolated function httpTriggerCosmosDBInput3(
databaseName: "db1", collectionName: "c1",
sqlQuery: "select * from c1 where c1.country = {country}" }
Person[] dbReq)
returns @af:HTTPOutput string|error {
returns @af:HttpOutput string|error {
return dbReq.toString();
}
// HTTP request to write records to CosmosDB
@af:Function
public isolated function httpTriggerCosmosDBOutput1(
@af:HTTPTrigger af:HTTPRequest httpReq, @af:HTTPOutput af:HTTPBinding hb)
@af:HTTPTrigger af:HTTPRequest httpReq, @af:HttpOutput af:HTTPBinding hb)
returns @af:CosmosDBOutput { connectionStringSetting: "CosmosDBConnection",
databaseName: "db1", collectionName: "c1" } json {
json entry = { id: uuid:createType1AsString(), name: "Saman", country: "Sri Lanka" };
Expand All @@ -177,7 +177,7 @@ public isolated function httpTriggerCosmosDBOutput1(
@af:Function
public isolated function httpTriggerCosmosDBOutput2(
@af:HTTPTrigger af:HTTPRequest httpReq,
@af:HTTPOutput af:HTTPBinding hb)
@af:HttpOutput af:HTTPBinding hb)
returns @af:CosmosDBOutput {
connectionStringSetting: "CosmosDBConnection",
databaseName: "db1", collectionName: "c1" } json {
Expand Down
7 changes: 6 additions & 1 deletion ballerina-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
[package]
org = "ballerinax"
name = "azure_functions_tests"
version = "2.1.1"
version = "3.0.0-alpha.1"

[[dependency]]
org = "ballerinax"
name = "azure_functions"
version = "3.0.0-alpha.1"
4 changes: 2 additions & 2 deletions ballerina-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import org.apache.tools.ant.taskdefs.condition.Os
description = 'Ballerinax - Azure Functions Tests'

def packageName = "azure_functions"
def packageOrg = "ballerinax" //TODO change
def packageOrg = "ballerinax"
def moduleName = "tests"
def tomlVersion = stripBallerinaExtensionVersion("${project.version}")
def ballerinaTomlFilePlaceHolder = new File("${project.rootDir}/build-config/resources/BallerinaTest.toml")
def ballerinaTomlFile = new File("$project.projectDir/Ballerina.toml")
def ballerinaDist = "${project.rootDir}/target/ballerina-runtime"
def distributionBinPath = "${ballerinaDist}/bin"
def testCoverageParam = "--code-coverage --includes=*"
def testCoverageParam = "--test-report --code-coverage --coverage-format=xml --includes=io.ballerina.stdlib.azure.functions.*:ballerinax.azure_functions"

def stripBallerinaExtensionVersion(String extVersion) {
if (extVersion.matches(project.ext.timestampedVersionRegex)) {
Expand Down
187 changes: 0 additions & 187 deletions ballerina-tests/main.bal

This file was deleted.

Loading

0 comments on commit 883e697

Please sign in to comment.