-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ae0a9b
commit 06c0810
Showing
35 changed files
with
1,407 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Ensure all Java files use LF. | ||
*.java eol=lf |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# 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/ | ||
|
||
# These owners will be the default owners for everything in the repo. | ||
* @LakshanWeerasinghe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
## Purpose | ||
|
||
Fixes: | ||
|
||
## Examples | ||
|
||
## Checklist | ||
- [ ] Linked to an issue | ||
- [ ] Updated the changelog | ||
- [ ] Added tests | ||
- [ ] Updated the spec | ||
- [ ] Checked native-image compatibility |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- '*.md' | ||
- 'docs/**' | ||
- 'load-tests/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
call_workflow: | ||
name: Run Build Workflow | ||
if: ${{ github.repository_owner == 'ballerina-platform' }} | ||
uses: ballerina-platform/ballerina-library/.github/workflows/build-timestamp-master-template.yml@main | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: GraalVM Check | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
lang_tag: | ||
description: Branch/Release Tag of the Ballerina Lang | ||
required: true | ||
default: master | ||
lang_version: | ||
description: Ballerina Lang Version (If given ballerina lang build will be skipped) | ||
required: false | ||
default: '' | ||
native_image_options: | ||
description: Default native-image options | ||
required: false | ||
default: '' | ||
schedule: | ||
- cron: '30 18 * * *' | ||
pull_request: | ||
branches: | ||
- main | ||
types: [ opened, synchronize, reopened, labeled, unlabeled ] | ||
|
||
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-template.yml@main | ||
with: | ||
lang_tag: ${{ inputs.lang_tag }} | ||
lang_version: ${{ inputs.lang_version }} | ||
native_image_options: '-J-Xmx7G ${{ inputs.native_image_options }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Publish to the Ballerina central | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
type: choice | ||
description: Select Environment | ||
required: true | ||
options: | ||
- DEV CENTRAL | ||
- STAGE CENTRAL | ||
|
||
jobs: | ||
call_workflow: | ||
name: Run Central Publish Workflow | ||
if: ${{ github.repository_owner == 'ballerina-platform' }} | ||
uses: ballerina-platform/ballerina-library/.github/workflows/central-publish-template.yml@main | ||
secrets: inherit | ||
with: | ||
environment: ${{ github.event.inputs.environment }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-template.yml@main | ||
secrets: inherit | ||
with: | ||
package-name: data.yaml | ||
package-org: ballerina |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Pull Request | ||
|
||
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/pull-request-build-template.yml@main | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: 'Close stale pull requests' | ||
|
||
on: | ||
schedule: | ||
- cron: '30 19 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
stale: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/stale@v3 | ||
with: | ||
stale-pr-message: 'This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the `stale` label is removed or commented.' | ||
close-pr-message: 'Closed PR due to inactivity for more than 18 days.' | ||
days-before-pr-stale: 15 | ||
days-before-pr-close: 3 | ||
days-before-issue-stale: -1 | ||
days-before-issue-close: -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[package] | ||
org = "ballerina" | ||
name = "data.toml" | ||
version = "0.1.0" | ||
authors = ["Ballerina"] | ||
keywords = ["toml"] | ||
repository = "https://github.com/ballerina-platform/module-ballerina-data.toml" | ||
license = ["Apache-2.0"] | ||
distribution = "2201.9.0" | ||
|
||
[platform.java17] | ||
graalvmCompatible = true | ||
|
||
[[platform.java17.dependency]] | ||
groupId = "io.ballerina.lib" | ||
artifactId = "toml-native" | ||
version = "0.1.0" | ||
path = "../native/build/libs/data.toml-native-0.1.0-SNAPSHOT.jar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# AUTO-GENERATED FILE. DO NOT MODIFY. | ||
|
||
# This file is auto-generated by Ballerina for managing dependency versions. | ||
# It should not be modified by hand. | ||
|
||
[ballerina] | ||
dependencies-toml-version = "2" | ||
distribution-version = "2201.9.0" | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "data.toml" | ||
version = "0.1.0" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "test"} | ||
] | ||
modules = [ | ||
{org = "ballerina", packageName = "data.toml", moduleName = "data.toml"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "jballerina.java" | ||
version = "0.0.0" | ||
modules = [ | ||
{org = "ballerina", packageName = "jballerina.java", moduleName = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.__internal" | ||
version = "0.0.0" | ||
scope = "testOnly" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.object"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.array" | ||
version = "0.0.0" | ||
scope = "testOnly" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.__internal"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.error" | ||
version = "0.0.0" | ||
scope = "testOnly" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"} | ||
] | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "lang.object" | ||
version = "0.0.0" | ||
scope = "testOnly" | ||
|
||
[[package]] | ||
org = "ballerina" | ||
name = "test" | ||
version = "0.0.0" | ||
scope = "testOnly" | ||
dependencies = [ | ||
{org = "ballerina", name = "jballerina.java"}, | ||
{org = "ballerina", name = "lang.array"}, | ||
{org = "ballerina", name = "lang.error"} | ||
] | ||
modules = [ | ||
{org = "ballerina", packageName = "test", moduleName = "test"} | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Ballerina TOML Data Library | ||
|
||
The Ballerina data.toml library provides robust and flexible functionalities for working with TOML data within | ||
Ballerina applications. | ||
This library enables developers to seamlessly integrate TOML processing capabilities, | ||
ensuring smooth data interchange and configuration management. | ||
|
||
## Key Features | ||
|
||
- **Versatile Input Handling**: Convert TOML input provided as strings, byte arrays, or streams of byte arrays into | ||
Ballerina's record sub-types. | ||
- **Data Projection**: Efficiently project data from TOML, | ||
allowing for precise data extraction and manipulation. | ||
- **Serialization**: Serialize Ballerina values into TOML-formatted strings, enabling easy generation of TOML content | ||
from Ballerina applications for configuration files, data storage, or data exchange purposes. | ||
|
||
## Usage | ||
|
||
### Converting external TOML document to a record value | ||
|
||
For transforming TOML content from an external source into a record value, | ||
the `parseString`, `parseBytes`, `parseStream` functions can be used. | ||
This external source can be in the form of a string or a byte array/byte-block-stream that houses the TOML data. | ||
This is commonly extracted from files or network sockets. The example below demonstrates the conversion of an | ||
TOML value from an external source into a record value. | ||
|
||
```ballerina | ||
import ballerina/data.toml; | ||
import ballerina/io; | ||
type ServerConfig record {| | ||
int port; | ||
string host; | ||
string proxy; | ||
|}; | ||
public function main() returns error? { | ||
string content = check io:fileReadString("path/to/<file-name>.yaml"); | ||
ServerConfig serverConfig = check toml:parseString(content); | ||
io:println(serverConfig); | ||
} | ||
``` | ||
|
||
Make sure to handle possible errors that may arise during the file reading or YAML to anydata conversion process. | ||
The `check` keyword is utilized to handle these errors, | ||
but more sophisticated error handling can be implemented as per your requirements. | ||
|
||
## Serialize anydata value to TOML | ||
|
||
The serialization of anydata value into TOML-formatted strings can be done in the below way. | ||
|
||
```ballerina | ||
import ballerina/data.toml; | ||
import ballerina/io; | ||
public function main() returns error? { | ||
json content = { | ||
name: "Clean Code", | ||
author: "Robert C. Martin", | ||
year: 2008 | ||
}; | ||
string tomlString = check toml:toTomlString(content); | ||
io:println(tomlString); | ||
} | ||
``` |
Oops, something went wrong.