Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build scripts #794

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 6 additions & 36 deletions .github/workflows/build-timestamped-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,12 @@ on:
paths-ignore:
- '*.md'
- 'load-tests/**'
- 'docs/**'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
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 --scan --no-daemon
- name: Generate Codecov Report
uses: codecov/codecov-action@v3
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ballerina-runtime
path: target/ballerina-runtime/
call_workflow:
name: Run Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-standard-library/.github/workflows/build-timestamp-master-template.yml@main
secrets: inherit
64 changes: 32 additions & 32 deletions .github/workflows/build-with-bal-test-graalvm.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
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 buid will be skipped)
required: false
default: ''
native_image_options:
description: Default native-image options
required: false
default: ''
schedule:
- cron: '30 18 * * *'
pull_request:
branches:
- master
types: [opened, synchronize, reopened, labeled, unlabeled]
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 buid will be skipped)
required: false
default: ''
native_image_options:
description: Default native-image options
required: false
default: ''
schedule:
- cron: '30 18 * * *'
pull_request:
branches:
- master
types: [opened, synchronize, reopened, labeled, unlabeled]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
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-standard-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: ${{ inputs.native_image_options }}
additional_ubuntu_build_flags: '-x :nats-compiler-plugin-tests:test'
additional_windows_build_flags: '-x test'
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-standard-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 }}'
additional_ubuntu_build_flags: '-x :nats-compiler-plugin-tests:test'
additional_windows_build_flags: '-x test'
122 changes: 122 additions & 0 deletions .github/workflows/build-with-ballerina-lang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Build with Ballerina Lang
Copy link
Member

@MohamedSabthar MohamedSabthar Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this workflow? Does the other ballerinax connectors have this workflow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got these workflows from the ballerinax/kafka connector, since these have the compiler plugin I was asked to add the standard library workflows. https://github.com/ballerina-platform/module-ballerinax-kafka/blob/master/.github/workflows/build-with-ballerina-lang.yml


on:
workflow_dispatch:
inputs:
lang_tag:
description: Branch/Release Tag of the Ballerina Lang
required: false
default: master
lang_version:
description: Ballerina Lang Version (If given ballerina lang buid will be skipped)
required: false
default: ''
build_properties:
description: Additional build properties
required: false
default: ''

jobs:
ubuntu-build-with-bal-test-native:
name: Build with Ballerina Lang on Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 90

steps:
- name: Checkout Ballerina Lang Repository
if: ${{ inputs.lang_version == '' }}
uses: actions/checkout@v3
with:
repository: 'ballerina-platform/ballerina-lang'
ref: ${{ inputs.lang_tag || 'master' }}

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

- name: Set Ballerina Lang version
run: |
if ${{ inputs.lang_version != ''}}; then
LANG_VERSION=${{ inputs.lang_version }}
else
VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)
LANG_VERSION=$VERSION-NATIVE
fi
echo "BALLERINA_LANG_VERSION=$LANG_VERSION" >> $GITHUB_ENV
echo "BALLERINA_LANG_VERSION: $LANG_VERSION"

- name: Build Ballerina Lang
if: ${{ inputs.lang_version == '' }}
run: |
perl -pi -e "s/^\s*version=.*/version=${{ env.BALLERINA_LANG_VERSION }}/" gradle.properties
./gradlew build -x check -x test publishToMavenLocal --scan --no-daemon

- name: Checkout Module Repository
uses: actions/checkout@v3

- name: Build Module
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
perl -pi -e "s/^\s*ballerinaLangVersion=.*/ballerinaLangVersion=${{ env.BALLERINA_LANG_VERSION }}/" gradle.properties
./gradlew build ${{ inputs.build_properties }}

windows-build-with-bal-test-native:
name: Build with Ballerina Lang on Windows
runs-on: windows-latest
timeout-minutes: 90

steps:
- name: Checkout Ballerina Lang Repository
if: ${{ inputs.lang_version == '' }}
uses: actions/checkout@v3
with:
repository: 'ballerina-platform/ballerina-lang'
ref: ${{ inputs.lang_tag || 'master' }}

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

- name: Set Ballerina Lang version
run: |
if ("${{ inputs.lang_version }}" -eq "") {
$properties = convertfrom-stringdata (get-content ./gradle.properties -raw)
$LANG_VERSION = $properties.'version'.split("-",2)[0] + "-NATIVE"
} else {
$LANG_VERSION = "${{ inputs.lang_version }}"
}
"BALLERINA_LANG_VERSION=$LANG_VERSION" >> $env:GITHUB_ENV
Write-Output "BALLERINA_LANG_VERSION: $LANG_VERSION"

- name: Configure Pagefile
uses: al-cheb/configure-pagefile-action@v1.3
with:
minimum-size: 10GB
maximum-size: 16GB

- name: Get configured pagefile base size
run: (Get-CimInstance Win32_PageFileUsage).AllocatedBaseSize

- name: Build Ballerina Lang
if: ${{ inputs.lang_version == '' }}
run: |
perl -pi -e "s/^\s*version=.*/version=${{ env.BALLERINA_LANG_VERSION }}/" gradle.properties
./gradlew.bat build -x check -x test publishToMavenLocal --continue -x createJavadoc --stacktrace -scan --console=plain --no-daemon --no-parallel

- name: Checkout Module Repository
uses: actions/checkout@v3

- name: Build Module
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
run: |
perl -pi -e "s/^\s*ballerinaLangVersion=.*/ballerinaLangVersion=${{ env.BALLERINA_LANG_VERSION }}/" gradle.properties
./gradlew.bat build ${{ inputs.build_properties }} -x test
68 changes: 7 additions & 61 deletions .github/workflows/central-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,64 +13,10 @@ on:
- STAGE CENTRAL

jobs:
publish-release:
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17.0.7
- 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/trivy-action@master
with:
scan-type: 'rootfs'
scan-ref: '/github/workspace/ballerina/lib'
format: 'table'
timeout: '10m0s'
exit-code: '1'

- name: Ballerina Central Push
if: ${{ github.event.inputs.environment == 'CENTRAL' }}
env:
BALLERINA_DEV_CENTRAL: false
BALLERINA_STAGE_CENTRAL: false
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: ${{ github.event.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
- name: Ballerina Central Stage Push
if: ${{ github.event.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
call_workflow:
name: Run Central Publish Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-standard-library/.github/workflows/central-publish-template.yml@main
secrets: inherit
with:
environment: ${{ github.event.inputs.environment }}
5 changes: 3 additions & 2 deletions .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
with:
distribution: 'temurin'
java-version: 17.0.7

- name: Set environment variable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is workflow is not centralized. Is this because this module has compiler plugin?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if: github.event.action == 'check_connector_for_breaking_changes'
run: |
echo "BUILD_USING_DOCKER=-PbuildUsingDocker=nightly" >> $GITHUB_ENV
echo "GRADLE_SKIP_TASKS=-x :nats-compiler-plugin-tests:test -x :nats-ballerina-tests:build -x :nats-ballerina-tests:test" >> $GITHUB_ENV
echo "GRADLE_SKIP_TASKS=-x :nats-compiler-plugin-tests:test" >> $GITHUB_ENV

# Build the project with Gradle
- name: Build with Gradle
Expand All @@ -32,6 +32,7 @@ jobs:
run: |
./gradlew clean build $GRADLE_SKIP_TASKS $BUILD_USING_DOCKER

# Send notification when build fails
- name: Notify failure
if: ${{ failure() }}
run: |
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/process-load-test-result.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
types: [nats-load-test]

jobs:
call_stdlib_process_load_test_results_workflow:
name: Run StdLib Process Load Test Results Workflow
uses: ballerina-platform/ballerina-standard-library/.github/workflows/process-load-test-results-template.yml@main
with:
results: ${{ toJson(github.event.client_payload.results) }}
secrets:
ballerina_bot_token: ${{ secrets.BALLERINA_BOT_TOKEN }}
ballerina_reviewer_bot_token: ${{ secrets.BALLERINA_REVIEWER_BOT_TOKEN }}
call_stdlib_process_load_test_results_workflow:
name: Run StdLib Process Load Test Results Workflow
uses: ballerina-platform/ballerina-standard-library/.github/workflows/process-load-test-results-template.yml@main
with:
results: ${{ toJson(github.event.client_payload.results) }}
secrets:
ballerina_bot_token: ${{ secrets.BALLERINA_BOT_TOKEN }}
ballerina_reviewer_bot_token: ${{ secrets.BALLERINA_REVIEWER_BOT_TOKEN }}
Loading
Loading