Skip to content

Commit

Permalink
Merge pull request #164 from NipunaMadhushan/main
Browse files Browse the repository at this point in the history
Refractor module along with opentelemetry version update
  • Loading branch information
NipunaMadhushan authored May 6, 2024
2 parents 741c932 + 3a62082 commit f04f41e
Show file tree
Hide file tree
Showing 63 changed files with 1,476 additions and 287 deletions.
31 changes: 29 additions & 2 deletions .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ name: Build

on:
workflow_dispatch:
inputs:
ballerina_version:
description: 'Ballerina version'
required: true
default: '2201.9.0'
push:
branches:
- main

env:
BALLERINA_DISTRIBUTION_VERSION: 2201.9.0 # Update this with the latest Ballerina version

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -16,8 +24,27 @@ jobs:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: adopt
distribution: 'temurin'
java-version: 17.0.7
- name: Set up Ballerina
if: github.event_name == 'workflow_dispatch'
uses: ballerina-platform/[email protected]
with:
version: ${{ github.event.inputs.ballerina_version }}
- name: Set up Ballerina
if: github.event_name == 'push'
uses: ballerina-platform/[email protected]
with:
version: ${{ env.BALLERINA_DISTRIBUTION_VERSION }}
- 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
echo TIMESTAMPED_VERSION=$updatedVersion >> $GITHUB_ENV
sed -i "s/version=\(.*\)/version=$updatedVersion/g" gradle.properties
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Set Docker Host env variable
Expand All @@ -40,5 +67,5 @@ jobs:
with:
name: distribution
path: |
jaeger-extension-ballerina/build/distributions/jaeger-extension-ballerina-*.zip
ballerina/build/distributions/jaeger-extension-ballerina-*.zip
if-no-files-found: error
12 changes: 9 additions & 3 deletions .github/workflows/central-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Publish to the Ballerina central
on:
workflow_dispatch:
inputs:
ballerina_version:
description: 'Ballerina version'
required: true
default: '2201.9.0'
environment:
type: choice
description: Select environment
Expand All @@ -23,18 +27,20 @@ jobs:
with:
distribution: 'temurin'
java-version: 17.0.7
- name: Set up Ballerina
uses: ballerina-platform/[email protected]
with:
version: ${{ github.event.inputs.ballerina_version }}
- 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 jaeger-extension-ballerina/lib
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: 'rootfs'
scan-ref: '/github/workspace/jaeger-extension-ballerina/lib'
scan-ref: '/github/workspace/ballerina/lib'
format: 'table'
timeout: '10m0s'
exit-code: '1'
Expand Down
61 changes: 48 additions & 13 deletions .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,66 @@
name: Daily build
name: Daily Build

on:
schedule:
- cron: '30 2 * * *'
- cron: '30 18 * * *'
workflow_dispatch:
inputs:
ballerina_version:
description: 'Ballerina version'
required: true
default: '2201.9.0'

env:
BALLERINA_DISTRIBUTION_VERSION: 2201.9.0 # Update this with the latest Ballerina version

jobs:
build:
runs-on: ubuntu-latest

if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v3

- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: adopt
distribution: 'temurin'
java-version: 17.0.7

# Build the project with Gradle
- name: Set up Ballerina
if: github.event_name == 'workflow_dispatch'
uses: ballerina-platform/[email protected]
with:
version: ${{ github.event.inputs.ballerina_version }}
- name: Set up Ballerina
if: github.event_name == 'push'
uses: ballerina-platform/[email protected]
with:
version: ${{ env.BALLERINA_DISTRIBUTION_VERSION }}
- 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
echo TIMESTAMPED_VERSION=$updatedVersion >> $GITHUB_ENV
sed -i "s/version=\(.*\)/version=$updatedVersion/g" gradle.properties
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Set Docker Host env variable
run: echo "DOCKER_HOST=$(docker context ls --format '{{print .DockerEndpoint}}' | tr -d '\n')" >> $GITHUB_ENV
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
DOCKER_HOST: unix:///var/run/docker.sock
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
packagePublishRepo: ${{ github.repository }}
run: |
./gradlew clean build
# Send notification when build fails
./gradlew clean build publish --stacktrace --scan --console=plain --no-daemon
./gradlew codeCoverageReport --console=plain --no-daemon
- name: Upload Coverage Report
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true
- name: Notify failure
if: ${{ failure() }}
run: |
Expand Down
34 changes: 20 additions & 14 deletions .github/workflows/graalvm-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,59 @@ on:
schedule:
- cron: '30 18 * * *'
workflow_dispatch:
inputs:
ballerina_version:
description: 'Ballerina version'
required: true
default: '2201.9.0'

env:
BALLERINA_DISTRIBUTION_VERSION: 2201.9.0 # Update this with the latest Ballerina version

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
java-version: '17.0.7'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Check GraalVM installation
run: |
echo "GRAALVM_HOME: ${{ env.GRAALVM_HOME }}"
echo "JAVA_HOME: ${{ env.JAVA_HOME }}"
native-image --version
- name: Set up Ballerina
if: github.event_name == 'workflow_dispatch'
uses: ballerina-platform/[email protected]
with:
version: ${{ github.event.inputs.ballerina_version }}
- name: Set up Ballerina
if: github.event_name == 'schedule'
uses: ballerina-platform/[email protected]
with:
version: ${{ env.BALLERINA_DISTRIBUTION_VERSION }}
- 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 }}
JAVA_OPTS: -DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true
run: |
./gradlew build
- name: Set Up Ballerina
uses: ballerina-platform/setup-ballerina@v1
with:
version: 2201.6.0

- name: Update dependency versions
run: ./gradlew :jaeger-extension-ballerina:updateTomlVerions
env:
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
JAVA_OPTS: -DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true

- name: Run Ballerina build using the native executable
run: bal build --native ./jaeger-extension-ballerina

run: bal build --native ./ballerina
- name: Run Ballerina tests using the native executable
run: bal test --native ./jaeger-extension-ballerina
run: bal test --native ./ballerina
36 changes: 27 additions & 9 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Publish Release

on: [workflow_dispatch]
on:
workflow_dispatch:
inputs:
distribution_version:
description: 'Ballerina distribution version (e.g.; 2201.9.0)'
required: true
default: '2201.9.0'

jobs:
publish-release:
Expand All @@ -12,8 +18,12 @@ jobs:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: adopt
distribution: 'temurin'
java-version: 17.0.7
- name: Set up Ballerina
uses: ballerina-platform/[email protected]
with:
version: ${{ github.event.inputs.ballerina_version }}
- name: Set version env variable
run: echo "VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)" >> $GITHUB_ENV
- name: Pre release depenency version update
Expand All @@ -24,18 +34,25 @@ jobs:
git config user.name ${{ secrets.BALLERINA_BOT_USERNAME }}
git config user.email ${{ secrets.BALLERINA_BOT_EMAIL }}
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/observe\(.*\)=\(.*\)-SNAPSHOT/observe\1=\2/g' gradle.properties
sed -i 's/observe\(.*\)=\(.*\)-[0-9]\{8\}-[0-9]\{6\}-.*$/observe\1=\2/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
git add gradle.properties
git commit -m "Move dependencies to stable version" || echo "No changes to commit"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Set Docker Host env variable
run: echo "DOCKER_HOST=$(docker context ls --format '{{print .DockerEndpoint}}' | tr -d '\n')" >> $GITHUB_ENV
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew build -x check -x test
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: 'rootfs'
scan-ref: '/github/workspace/ballerina/lib'
format: 'table'
timeout: '10m0s'
exit-code: '1'
- name: Publish artifact
env:
DOCKER_HOST: unix:///var/run/docker.sock
Expand All @@ -45,11 +62,12 @@ jobs:
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
packagePublishRepo: ${{ github.repository }}
run: |
git stash
./gradlew release -Prelease.useAutomaticVersion=true
./gradlew -Pversion=${VERSION} publish -x test
- name: Create Github release from the release tag
run: |
curl --request POST 'https://api.github.com/repos/ballerina-platform/module-ballerinax-jaeger/releases' \
curl --request POST 'https://api.github.com/repos/${{ github.repository }}/releases' \
--header 'Accept: application/vnd.github.v3+json' \
--header 'Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}' \
--header 'Content-Type: application/json' \
Expand Down
38 changes: 9 additions & 29 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Validate Pull Request

on: pull_request

env:
BALLERINA_DISTRIBUTION_VERSION: 2201.9.0 # Update this with the latest Ballerina version

jobs:
ubuntu-build:
runs-on: ubuntu-latest
Expand All @@ -13,6 +16,10 @@ jobs:
with:
distribution: adopt
java-version: 17.0.7
- name: Set up Ballerina
uses: ballerina-platform/[email protected]
with:
version: ${{ env.BALLERINA_DISTRIBUTION_VERSION }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Set Docker Host env variable
Expand All @@ -25,33 +32,6 @@ jobs:
./gradlew clean build --stacktrace --scan --console=plain --no-daemon
./gradlew codeCoverageReport --console=plain --no-daemon
- name: Upload Coverage Report
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true

windows-build:
if: false # because there is no opentelemetry-jaeger-executable available
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: codecov/codecov-action@v3
with:
distribution: adopt
java-version: 17.0.7
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Download Jaeger server executable
env:
JAEGER_VERSION: 1.21.0
run: |
Invoke-WebRequest https://github.com/jaegertracing/jaeger/releases/download/v$env:JAEGER_VERSION/jaeger-$env:JAEGER_VERSION-windows-amd64.tar.gz -O jaeger.tar.gz
tar -xzvf jaeger.tar.gz
mv jaeger-$env:JAEGER_VERSION-windows-amd64 jaeger
echo "JAEGER_SERVER_EXECUTABLE=$(Resolve-Path jaeger\jaeger-all-in-one.exe)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew.bat clean build --stacktrace --scan --console=plain --no-daemon
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ build/
gradle-app.setting
!gradle-wrapper.jar
.gradletasknamecache
.DS_Store

# Ballerina
target/
bin/
Loading

0 comments on commit f04f41e

Please sign in to comment.