From 1d9340bf24f21f65668b819fed156bffd0e91044 Mon Sep 17 00:00:00 2001 From: aashikam Date: Tue, 20 Feb 2024 21:32:51 +0530 Subject: [PATCH 1/3] [Automated] Update the native jar versions --- ballerina-tests/Ballerina.toml | 2 +- ballerina-tests/Dependencies.toml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ballerina-tests/Ballerina.toml b/ballerina-tests/Ballerina.toml index 244bf1c7..f8a419ef 100644 --- a/ballerina-tests/Ballerina.toml +++ b/ballerina-tests/Ballerina.toml @@ -1,4 +1,4 @@ [package] org = "ballerinax" name = "nats_tests" -version = "2.10.0" +version = "2.10.1" diff --git a/ballerina-tests/Dependencies.toml b/ballerina-tests/Dependencies.toml index f6ede488..d43faf09 100644 --- a/ballerina-tests/Dependencies.toml +++ b/ballerina-tests/Dependencies.toml @@ -103,7 +103,7 @@ modules = [ [[package]] org = "ballerina" name = "observe" -version = "1.2.0" +version = "1.2.2" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -144,7 +144,7 @@ dependencies = [ [[package]] org = "ballerinax" name = "nats" -version = "2.10.0" +version = "2.10.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "crypto"}, @@ -158,7 +158,7 @@ modules = [ [[package]] org = "ballerinax" name = "nats_tests" -version = "2.10.0" +version = "2.10.1" dependencies = [ {org = "ballerina", name = "lang.runtime"}, {org = "ballerina", name = "lang.string"}, From 020424485aa5375420963bf470b2904b2a2f9d64 Mon Sep 17 00:00:00 2001 From: aashikam Date: Tue, 20 Feb 2024 21:32:51 +0530 Subject: [PATCH 2/3] [Automated] Update the native jar versions --- ballerina/Ballerina.toml | 6 +++--- ballerina/CompilerPlugin.toml | 2 +- ballerina/Dependencies.toml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 264df4a0..882cff95 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "ballerinax" name = "nats" -version = "2.10.0" +version = "2.10.1" authors = ["Ballerina"] keywords = ["service", "client", "messaging", "network", "pubsub"] repository = "https://github.com/ballerina-platform/module-ballerinax-nats" @@ -18,8 +18,8 @@ path = "./lib/jnats-2.16.0.jar" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" artifactId = "nats-native" -version = "2.10.0" -path = "../native/build/libs/nats-native-2.10.0.jar" +version = "2.10.1" +path = "../native/build/libs/nats-native-2.10.1-SNAPSHOT.jar" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/ballerina/CompilerPlugin.toml b/ballerina/CompilerPlugin.toml index 34338cac..48d4d416 100644 --- a/ballerina/CompilerPlugin.toml +++ b/ballerina/CompilerPlugin.toml @@ -3,4 +3,4 @@ id = "nats-compiler-plugin" class = "io.ballerina.stdlib.nats.plugin.NatsCompilerPlugin" [[dependency]] -path = "../compiler-plugin/build/libs/nats-compiler-plugin-2.10.0.jar" +path = "../compiler-plugin/build/libs/nats-compiler-plugin-2.10.1-SNAPSHOT.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index a5dbfbc7..df6ee3c1 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -119,7 +119,7 @@ modules = [ [[package]] org = "ballerina" name = "observe" -version = "1.2.0" +version = "1.2.2" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -160,7 +160,7 @@ modules = [ [[package]] org = "ballerinax" name = "nats" -version = "2.10.0" +version = "2.10.1" dependencies = [ {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "crypto"}, From 33ea76240b2c7ca38c5be2a7b5c3d09b330ff6b5 Mon Sep 17 00:00:00 2001 From: aashikam Date: Tue, 20 Feb 2024 21:37:43 +0530 Subject: [PATCH 3/3] Update scripts --- .../workflows/build-timestamped-master.yml | 42 +----- .../workflows/build-with-bal-test-graalvm.yml | 64 ++++----- .../workflows/build-with-ballerina-lang.yml | 122 ++++++++++++++++++ .github/workflows/central-publish.yml | 68 +--------- .github/workflows/daily-build.yml | 5 +- .../workflows/process-load-test-result.yml | 16 +-- .github/workflows/publish-release.yml | 70 ++-------- .github/workflows/pull-request.yml | 62 +-------- .github/workflows/stale_check.yml | 19 --- .github/workflows/trigger-load-tests.yml | 58 ++++----- .github/workflows/trivy-scan.yml | 30 +---- build.gradle | 9 -- gradle.properties | 1 + 13 files changed, 228 insertions(+), 338 deletions(-) create mode 100644 .github/workflows/build-with-ballerina-lang.yml delete mode 100644 .github/workflows/stale_check.yml diff --git a/.github/workflows/build-timestamped-master.yml b/.github/workflows/build-timestamped-master.yml index c0d0ae19..352b6568 100644 --- a/.github/workflows/build-timestamped-master.yml +++ b/.github/workflows/build-timestamped-master.yml @@ -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 diff --git a/.github/workflows/build-with-bal-test-graalvm.yml b/.github/workflows/build-with-bal-test-graalvm.yml index 60b1beb9..faf97f3c 100644 --- a/.github/workflows/build-with-bal-test-graalvm.yml +++ b/.github/workflows/build-with-bal-test-graalvm.yml @@ -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' diff --git a/.github/workflows/build-with-ballerina-lang.yml b/.github/workflows/build-with-ballerina-lang.yml new file mode 100644 index 00000000..a2d18d67 --- /dev/null +++ b/.github/workflows/build-with-ballerina-lang.yml @@ -0,0 +1,122 @@ +name: Build with Ballerina Lang + +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 diff --git a/.github/workflows/central-publish.yml b/.github/workflows/central-publish.yml index 2c62eb74..25d902ce 100644 --- a/.github/workflows/central-publish.yml +++ b/.github/workflows/central-publish.yml @@ -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 }} diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index c448ba4b..2ba524e5 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -17,12 +17,12 @@ jobs: with: distribution: 'temurin' java-version: 17.0.7 - + - name: Set environment variable 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 @@ -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: | diff --git a/.github/workflows/process-load-test-result.yml b/.github/workflows/process-load-test-result.yml index f502443e..8255202c 100644 --- a/.github/workflows/process-load-test-result.yml +++ b/.github/workflows/process-load-test-result.yml @@ -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 }} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 4188285b..dff94164 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -6,65 +6,11 @@ on: types: [ stdlib-release-pipeline ] jobs: - publish-release: - 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: 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 - - 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: 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 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 artifact - 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-ballerinax-nats-v$VERSION" - gh pr create --title "[Automated] Sync master after $VERSION release" --body "Sync master after $VERSION release" + call_workflow: + name: Run Release Workflow + if: ${{ github.repository_owner == 'ballerina-platform' }} + uses: ballerina-platform/ballerina-standard-library/.github/workflows/release-package-template.yml@main + secrets: inherit + with: + package-name: nats + package-org: ballerinax diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 77a654e3..b57ca21c 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,59 +1,11 @@ -name: Ballerina NATS module build +name: PR Build -on: pull_request +on: [pull_request] jobs: - ubuntu-build: - name: Build on Ubuntu - runs-on: ubuntu-latest - timeout-minutes: 60 - concurrency: - group: ${{ github.head_ref }}-ubuntu - cancel-in-progress: true - - 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: Build with Gradle - env: - packageUser: ${{ github.actor }} - packagePAT: ${{ secrets.GITHUB_TOKEN }} - run: ./gradlew build --scan - - name: Archive Code Coverage JSON - uses: actions/upload-artifact@v2 - with: - name: Code Coverage JSON - path: nats-ballerina/target/report/test_results.json - if-no-files-found: ignore - - name: Generate CodeCov Report - if: github.event_name == 'pull_request' - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - - windows-build: - name: Build on Windows - runs-on: windows-latest - timeout-minutes: 60 - concurrency: - group: ${{ github.head_ref }}-windows - cancel-in-progress: true - - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 + call_workflow: + name: Run PR Build Workflow + if: ${{ github.repository_owner == 'ballerina-platform' }} + uses: ballerina-platform/ballerina-standard-library/.github/workflows/pull-request-build-template.yml@main with: - distribution: 'temurin' - java-version: 17.0.7 - - name: Build with Gradle - env: - packageUser: ${{ github.actor }} - packagePAT: ${{ secrets.GITHUB_TOKEN }} - run: ./gradlew.bat build -x test + additional-windows-test-flags: "-x test" diff --git a/.github/workflows/stale_check.yml b/.github/workflows/stale_check.yml deleted file mode 100644 index 8763360a..00000000 --- a/.github/workflows/stale_check.yml +++ /dev/null @@ -1,19 +0,0 @@ -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 diff --git a/.github/workflows/trigger-load-tests.yml b/.github/workflows/trigger-load-tests.yml index f988db69..d2014123 100644 --- a/.github/workflows/trigger-load-tests.yml +++ b/.github/workflows/trigger-load-tests.yml @@ -1,34 +1,34 @@ name: Trigger Load Tests on: - workflow_dispatch: - inputs: - tests: - description: > - List of test names. This needs to be filled only if you want to run a specific set of tests. Example: foo,bar - required: false - clusterName: - description: 'Cluster name' - default: 'nats-perf-cluster-test' - required: false - branch: - description: 'Branch of the given repository' - default: '' - required: false - schedule: - - cron: '30 19 * * *' + workflow_dispatch: + inputs: + tests: + description: > + List of test names. This needs to be filled only if you want to run a specific set of tests. Example: foo,bar + required: false + clusterName: + description: 'Cluster name' + default: 'nats-perf-cluster-test' + required: false + branch: + description: 'Branch of the given repository' + default: '' + required: false + schedule: + - cron: '0 20 * * *' jobs: - call_stdlib_trigger_load_test_workflow: - name: Run StdLib Load Test Workflow - if: ${{ github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'ballerina-platform') }} - uses: ballerina-platform/ballerina-standard-library/.github/workflows/trigger-load-tests-template.yml@main - with: - repo_name: 'module-ballerinax-nats' - runtime_artifacts_url: 'https://api.github.com/repos/ballerina-platform/module-ballerinax-nats/actions/artifacts' - dispatch_type: 'nats-load-test' - cluster_name: ${{ inputs.clusterName }} - tests: ${{ inputs.tests }} - branch: ${{ inputs.branch }} - secrets: - ballerina_bot_token: ${{ secrets.BALLERINA_BOT_TOKEN }} + call_stdlib_trigger_load_test_workflow: + name: Run StdLib Load Test Workflow + if: ${{ github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'ballerina-platform') }} + uses: ballerina-platform/ballerina-standard-library/.github/workflows/trigger-load-tests-template.yml@main + with: + repo_name: 'module-ballerinax-nats' + runtime_artifacts_url: 'https://api.github.com/repos/ballerina-platform/module-ballerinax-nats/actions/artifacts' + dispatch_type: 'nats-load-test' + cluster_name: ${{ inputs.clusterName }} + tests: ${{ inputs.tests }} + branch: ${{ inputs.branch }} + secrets: + ballerina_bot_token: ${{ secrets.BALLERINA_BOT_TOKEN }} diff --git a/.github/workflows/trivy-scan.yml b/.github/workflows/trivy-scan.yml index e968e77a..b9b5a62e 100644 --- a/.github/workflows/trivy-scan.yml +++ b/.github/workflows/trivy-scan.yml @@ -6,28 +6,8 @@ on: - cron: '30 20 * * *' jobs: - ubuntu-build: - name: Build on Ubuntu - runs-on: ubuntu-latest - 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' + call_workflow: + name: Run Trivy Scan Workflow + if: ${{ github.repository_owner == 'ballerina-platform' }} + uses: ballerina-platform/ballerina-standard-library/.github/workflows/trivy-scan-template.yml@main + secrets: inherit diff --git a/build.gradle b/build.gradle index 4617f1ec..76a74fa4 100644 --- a/build.gradle +++ b/build.gradle @@ -23,15 +23,6 @@ plugins { id "net.researchgate.release" version "2.8.0" } -ext.ballerinaLangVersion = project.ballerinaLangVersion -ext.puppycrawlCheckstyleVersion = project.puppycrawlCheckstyleVersion -ext.slf4jVersion = "1.7.30" -ext.natsVersion = project.natsVersion -ext.stdlibCryptoVersion = project.stdlibCryptoVersion -ext.stdlibLogVersion = project.stdlibLogVersion -ext.stdlibTimeVersion = project.stdlibTimeVersion -ext.stdlibIoVersion = project.stdlibIoVersion - allprojects { group = project.group version = project.version diff --git a/gradle.properties b/gradle.properties index cf7b47e8..bc5fca3d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,6 +9,7 @@ natsVersion=2.16.0 puppycrawlCheckstyleVersion=10.12.1 testngVersion=7.6.1 gsonVersion=2.8.8 +slf4jVersion=1.7.30 stdlibIoVersion=1.6.0 stdlibTimeVersion=2.4.0