Skip to content

Commit

Permalink
Merge pull request ballerina-platform#1 from ballerina-platform/apply…
Browse files Browse the repository at this point in the history
…-templates-79

Add Generated Connector Template (Standard)
  • Loading branch information
MohamedSabthar authored Dec 17, 2024
2 parents abd35b0 + f5bc634 commit 06bde0a
Show file tree
Hide file tree
Showing 32 changed files with 1,129 additions and 74 deletions.
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf
8 changes: 8 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.

# See: https://help.github.com/articles/about-codeowners/

# TODO: Add code owners
# These owners will be the default owners for everything in the repo.
*
10 changes: 10 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Purpose

## Examples

## Checklist
- [ ] Linked to an issue
- [ ] Updated the changelog
- [ ] Added tests
- [ ] Updated the spec
- [ ] Checked native-image compatibility
17 changes: 17 additions & 0 deletions .github/workflows/build-with-bal-test-graalvm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: GraalVM Check

on:
schedule:
- cron: "30 18 * * *"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
call_stdlib_workflow:
name: Run StdLib Workflow
if: ${{ github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'ballerina-platform') }}
uses: ballerina-platform/ballerina-library/.github/workflows/build-with-bal-test-graalvm-connector-template.yml@main
secrets: inherit
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build

on:
push:
branches:
- main
- 2201.[0-9]+.x
repository_dispatch:
types: check_connector_for_breaking_changes

jobs:
call_workflow:
name: Run Connector Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/build-connector-template.yml@main
secrets: inherit
with:
repo-name: module-ballerinax-hubspot.crm.commerce.quotes
14 changes: 14 additions & 0 deletions .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Daily build

on:
schedule:
- cron: "30 2 * * *"

jobs:
call_workflow:
name: Run Daily Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/daily-build-connector-template.yml@main
secrets: inherit
with:
repo-name: module-ballerinax-hubspot.crm.commerce.quotes
21 changes: 21 additions & 0 deletions .github/workflows/dev-stg-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Publish to the Ballerina Dev\Stage Central

on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Select Environment
required: true
options:
- DEV CENTRAL
- STAGE CENTRAL

jobs:
call_workflow:
name: Run Dev\Stage Central Publish Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/dev-stage-central-publish-connector-template.yml@main
secrets: inherit
with:
environment: ${{ github.event.inputs.environment }}
16 changes: 16 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: PR Build

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

on: pull_request

jobs:
call_workflow:
name: Run PR Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/pr-build-connector-template.yml@main
secrets: inherit
with:
additional-test-flags: ${{ github.event.pull_request.head.repo.full_name != github.repository && '-x test' || ''}}
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Publish Release

on:
workflow_dispatch:
repository_dispatch:
types: [ stdlib-release-pipeline ]

jobs:
call_workflow:
name: Run Release Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/release-package-connector-template.yml@main
secrets: inherit
with:
package-name: hubspot.crm.commerce.quotes
package-org: ballerinax
13 changes: 13 additions & 0 deletions .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Trivy

on:
workflow_dispatch:
schedule:
- cron: "30 20 * * *"

jobs:
call_workflow:
name: Run Trivy Scan Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/trivy-scan-template.yml@main
secrets: inherit
42 changes: 38 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Compiled class file
*.class

*.balx
# Log file
*.log

Expand All @@ -10,15 +10,49 @@
# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
# .DS_Store files
*.DS_Store

# Package Files
*.jar
!gradle/wrapper/gradle-wrapper.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
*.deb

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

# Ignore everything in this directory
target
.classpath
.settings
.project
*.iml
*.iws
*.ipr
.idea
.m2
.vscode/

# Ignore ballerina files
accessToken.bal
temp.bal.ballerina/
target/
generated/
.DS_Store
*Ballerina.lock
.ballerina
**/Config.toml

# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build

# Ignore Docker env file
docker.env
16 changes: 16 additions & 0 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
distribution = "2201.10.0"
org = "ballerinax"
name = "hubspot.crm.commerce.quotes"
version = "1.0.0"
license = ["Apache-2.0"]
authors = ["Ballerina"]
keywords = []
# icon = "icon.png" # TODO: update icon.png
repository = "https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.commerce.quotes"

[build-options]
observabilityIncluded = true

[platform.java21]
graalvmCompatible = true
17 changes: 17 additions & 0 deletions ballerina/Module.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Overview

[//]: # (TODO: Add overview mentioning the purpose of the module, supported REST API versions, and other high-level details.)

## Setup guide

[//]: # (TODO: Add detailed steps to obtain credentials and configure the module.)

## Quickstart

[//]: # (TODO: Add a quickstart guide to demonstrate a basic functionality of the module, including sample code snippets.)

## Examples

The `HubSpot CRM Commerce Quotes` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/module-ballerinax-hubspot.crm.commerce.quotes/tree/main/examples/), covering the following use cases:

[//]: # (TODO: Add examples)
17 changes: 17 additions & 0 deletions ballerina/Package.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Overview

[//]: # (TODO: Add overview mentioning the purpose of the module, supported REST API versions, and other high-level details.)

## Setup guide

[//]: # (TODO: Add detailed steps to obtain credentials and configure the module.)

## Quickstart

[//]: # (TODO: Add a quickstart guide to demonstrate a basic functionality of the module, including sample code snippets.)

## Examples

The `HubSpot CRM Commerce Quotes` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/module-ballerinax-hubspot.crm.commerce.quotes/tree/main/examples/), covering the following use cases:

[//]: # (TODO: Add examples)
100 changes: 100 additions & 0 deletions ballerina/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. 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.
*/

import org.apache.tools.ant.taskdefs.condition.Os

plugins {
id 'io.ballerina.plugin'
}

description = 'HubSpot CRM Commerce Quotes - Ballerina'

def packageName = "hubspot.crm.commerce.quotes"
def packageOrg = "ballerinax"
def tomlVersion = stripBallerinaExtensionVersion("${project.version}")
def ballerinaTomlFilePlaceHolder = new File("${project.rootDir}/build-config/resources/Ballerina.toml")
def ballerinaTomlFile = new File("$project.projectDir/Ballerina.toml")

def stripBallerinaExtensionVersion(String extVersion) {
if (extVersion.matches(project.ext.timestampedVersionRegex)) {
def splitVersion = extVersion.split('-')
if (splitVersion.length > 3) {
def strippedValues = splitVersion[0..-4]
return strippedValues.join('-')
} else {
return extVersion
}
} else {
return extVersion.replace("${project.ext.snapshotVersion}", "")
}
}

ballerina {
packageOrganization = packageOrg
module = packageName
testCoverageParam = "--code-coverage --coverage-format=xml"
isConnector = true
platform = "any"
}

task updateTomlFiles {
doLast {
def newBallerinaToml = ballerinaTomlFilePlaceHolder.text.replace("@project.version@", project.version)
newBallerinaToml = newBallerinaToml.replace("@toml.version@", tomlVersion)
ballerinaTomlFile.text = newBallerinaToml
}
}

task commitTomlFiles {
doLast {
project.exec {
ignoreExitValue true
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', "git commit -m \"[Automated] Update the toml files\" Ballerina.toml Dependencies.toml"
} else {
commandLine 'sh', '-c', "git commit -m '[Automated] Update the toml files' Ballerina.toml Dependencies.toml"
}
}
}
}

publishing {
publications {
maven(MavenPublication) {
artifact source: createArtifactZip, extension: 'zip'
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/ballerina-platform/module-${packageOrg}-${packageName}")
credentials {
username = System.getenv("publishUser")
password = System.getenv("publishPAT")
}
}
}
}

clean {
delete 'build'
}

build.dependsOn "generatePomFileForMavenPublication"
publishToMavenLocal.dependsOn build
publish.dependsOn build
15 changes: 15 additions & 0 deletions ballerina/client.bal
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com).
//
// WSO2 LLC. 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.
16 changes: 16 additions & 0 deletions build-config/resources/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
distribution = "2201.10.0"
org = "ballerinax"
name = "hubspot.crm.commerce.quotes"
version = "@toml.version@"
license = ["Apache-2.0"]
authors = ["Ballerina"]
keywords = [] # TODO: Add keywords
# icon = "icon.png" # TODO: Add icon
repository = "https://github.com/ballerina-platform/module-ballerinax-hubspot.crm.commerce.quotes"

[build-options]
observabilityIncluded = true

[platform.java21]
graalvmCompatible = true
Loading

0 comments on commit 06bde0a

Please sign in to comment.