Skip to content

Commit

Permalink
Merge pull request #2 from DharshiBalasubramaniyam/client
Browse files Browse the repository at this point in the history
Add client code
  • Loading branch information
Nuvindu authored Jan 21, 2025
2 parents 62df2df + 24ac89c commit f62c352
Show file tree
Hide file tree
Showing 55 changed files with 3,927 additions and 250 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
# Binary files should be left untouched
*.jar binary

# Ensure all Java files use LF.
*.java eol=lf
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

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

# TODO: Add code owners
# These owners will be the default owners for everything in the repo.
* @DharshiBalasubramaniyam @shafreenAnfar @daneshk @ThisaruGuruge
18 changes: 0 additions & 18 deletions .github/worflows/build-with-bal-test-graalvm.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/worflows/ci.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/worflows/daily-build.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/worflows/dev-stg-release.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/worflows/pull-request.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/worflows/release.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/worflows/trivy-scan.yml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/build-timestamped-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build

on:
push:
branches:
- main
paths-ignore:
- '*.md'
- 'docs/**'
- 'load-tests/**'

workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
if: github.repository_owner == 'xlibb'
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17.0.7

- name: Change to Timestamped Version
run: |
startTime=$(TZ="Asia/Kolkata" date +'%Y%m%d-%H%M00')
latestCommit=$(git log -n 1 --pretty=format:"%h")
VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)
updatedVersion=$VERSION-$startTime-$latestCommit
echo $updatedVersion
sed -i "s/version=\(.*\)/version=$updatedVersion/g" gradle.properties
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
env:
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
publishUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
publishPAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: ./gradlew publish --no-daemon --scan

- name: Generate Codecov Report
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ballerina-runtime
path: target/ballerina-runtime/
81 changes: 81 additions & 0 deletions .github/workflows/central-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Publish to the Ballerina central

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

jobs:
publish-release:
runs-on: ubuntu-latest
if: github.repository_owner == 'xlibb'
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17.0.7

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew build -x check -x test

- name: Create lib directory if not exists
run: mkdir -p ballerina/lib

- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
scan-type: "rootfs"
scan-ref: '/github/workspace/ballerina/lib'
format: "table"
timeout: "10m0s"
exit-code: "1"
scanners: "vuln"

- name: Publish artifact
env:
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }}
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: ./gradlew clean build -PpublishToCentral=true

- name: Ballerina Central Dev Push
if: ${{ inputs.environment == 'DEV CENTRAL' }}
env:
BALLERINA_DEV_CENTRAL: true
BALLERINA_STAGE_CENTRAL: false
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }}
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
sed -i 's/version=\(.*\)-SNAPSHOT/version=\1/g' gradle.properties
./gradlew clean build -PpublishToCentral=true ${{ inputs.additional-publish-flags }}
- name: Ballerina Central Stage Push
if: ${{ inputs.environment == 'STAGE CENTRAL' }}
env:
BALLERINA_DEV_CENTRAL: false
BALLERINA_STAGE_CENTRAL: true
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_STAGE_ACCESS_TOKEN }}
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
sed -i 's/version=\(.*\)-SNAPSHOT/version=\1/g' gradle.properties
./gradlew clean build -PpublishToCentral=true ${{ inputs.additional-publish-flags }}
86 changes: 86 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Publish Release

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

jobs:
publish-release:
name: Release Package
runs-on: ubuntu-latest
if: github.repository_owner == 'xlibb'
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17.0.7

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- 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 -x :selenium-examples:build
- name: Create lib directory if not exists
run: mkdir -p ballerina/lib

- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
scan-type: "rootfs"
scan-ref: '/github/workspace/ballerina/lib'
format: "table"
timeout: "10m0s"
exit-code: "1"
scanners: "vuln"

- name: Get Release Version
run: echo "VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)" >> $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 Package
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-selenium-v$VERSION"
gh pr create --title "[Automated] Sync main after $VERSION release" --body "Sync main after $VERSION release"
Loading

0 comments on commit f62c352

Please sign in to comment.