From e631ec1cd0807dc0983673f8d9df053897cd57ac Mon Sep 17 00:00:00 2001 From: Kalaiyarasiganeshalingam Date: Thu, 10 Aug 2023 19:28:40 +0530 Subject: [PATCH 1/2] [Automated] Update the native jar versions --- ballerina/Ballerina.toml | 10 +++++----- ballerina/CompilerPlugin.toml | 2 +- ballerina/Dependencies.toml | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index f777b42..71731d7 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,13 +1,13 @@ [package] org = "ballerina" name = "file" -version = "1.8.1" +version = "1.9.0" authors = ["Ballerina"] keywords = ["file", "path", "directory", "filepath"] repository = "https://github.com/ballerina-platform/module-ballerina-file" icon = "icon.png" license = ["Apache-2.0"] -distribution = "2201.7.0" +distribution = "2201.8.0" [platform.java17] graalvmCompatible = true @@ -15,12 +15,12 @@ graalvmCompatible = true [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" artifactId = "file-native" -version = "1.8.1" -path = "../native/build/libs/file-native-1.8.1.jar" +version = "1.9.0" +path = "../native/build/libs/file-native-1.9.0-SNAPSHOT.jar" [[platform.java17.dependency]] path = "./lib/org.wso2.transport.local-file-system-6.0.55.jar" [[platform.java17.dependency]] -path = "../test-utils/build/libs/file-test-utils-1.8.1.jar" +path = "../test-utils/build/libs/file-test-utils-1.9.0-SNAPSHOT.jar" scope = "testOnly" diff --git a/ballerina/CompilerPlugin.toml b/ballerina/CompilerPlugin.toml index 47c24ab..a336844 100644 --- a/ballerina/CompilerPlugin.toml +++ b/ballerina/CompilerPlugin.toml @@ -3,4 +3,4 @@ id = "file-compiler-plugin" class = "io.ballerina.stdlib.file.compiler.FileCompilerPlugin" [[dependency]] -path = "../compiler-plugin/build/libs/file-compiler-plugin-1.8.1.jar" +path = "../compiler-plugin/build/libs/file-compiler-plugin-1.9.0-SNAPSHOT.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 6535271..f459405 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.7.0" +distribution-version = "2201.8.0-20230726-145300-b2bdf796" [[package]] org = "ballerina" name = "file" -version = "1.8.1" +version = "1.9.0" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, @@ -27,7 +27,7 @@ modules = [ [[package]] org = "ballerina" name = "io" -version = "1.5.0" +version = "1.6.0" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.value"} @@ -88,7 +88,7 @@ dependencies = [ [[package]] org = "ballerina" name = "os" -version = "1.7.0" +version = "1.8.0" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"} @@ -113,7 +113,7 @@ modules = [ [[package]] org = "ballerina" name = "time" -version = "2.3.0" +version = "2.4.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] From 30db7ecf6cb61340264ed8ce9a09f163267c86f9 Mon Sep 17 00:00:00 2001 From: Kalaiyarasiganeshalingam Date: Tue, 3 Oct 2023 17:28:11 +0530 Subject: [PATCH 2/2] Migrate workflows to reuse centralized workflows --- .../workflows/build-timestamped-master.yml | 45 ++---------- .github/workflows/central-publish.yml | 73 ++----------------- .github/workflows/publish-release.yml | 73 +++---------------- .github/workflows/pull-request.yml | 50 +++---------- .github/workflows/trivy-scan.yml | 32 ++------ 5 files changed, 41 insertions(+), 232 deletions(-) diff --git a/.github/workflows/build-timestamped-master.yml b/.github/workflows/build-timestamped-master.yml index 98c8a2c..4e6c54a 100644 --- a/.github/workflows/build-timestamped-master.yml +++ b/.github/workflows/build-timestamped-master.yml @@ -1,45 +1,16 @@ name: Build on: - workflow_dispatch: push: branches: - master paths-ignore: - - '*.md' + - "*.md" + workflow_dispatch: + jobs: - build: - 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 - - 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@v2 - - 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/central-publish.yml b/.github/workflows/central-publish.yml index e3df5da..c0bd478 100644 --- a/.github/workflows/central-publish.yml +++ b/.github/workflows/central-publish.yml @@ -5,74 +5,17 @@ on: inputs: environment: type: choice - description: Select environment + description: Select Environment required: true options: - - CENTRAL - DEV CENTRAL - 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 - - 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/publish-release.yml b/.github/workflows/publish-release.yml index 534efd8..8338abd 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -1,4 +1,4 @@ -name: Publish release +name: Publish Release on: workflow_dispatch: @@ -6,66 +6,11 @@ on: types: [stdlib-release-pipeline] 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 - - 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: - 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 }} - publishUser: ${{ secrets.BALLERINA_BOT_USERNAME }} - publishPAT: ${{ secrets.BALLERINA_BOT_TOKEN }} - run: | - git config user.name ${{ secrets.BALLERINA_BOT_USERNAME }} - git config user.email ${{ secrets.BALLERINA_BOT_EMAIL }} - ./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-ballerina-file-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: file + package-org: ballerina diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index bb4d678..00b6d64 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,43 +1,13 @@ -name: PR build +name: PR Build -on: pull_request +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true -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 - - name: Build with Gradle - env: - packageUser: ${{ github.actor }} - packagePAT: ${{ secrets.GITHUB_TOKEN }} - run: ./gradlew build --scan - - name: Generate CodeCov Report - if: github.event_name == 'pull_request' - uses: codecov/codecov-action@v2 - with: - token: ${{ secrets.CODECOV_TOKEN }} +on: [pull_request] - windows-build: - name: Build on Windows - runs-on: windows-latest - - steps: - - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: 17 - - name: Build with Gradle - env: - packageUser: ${{ github.actor }} - packagePAT: ${{ secrets.GITHUB_TOKEN }} - run: ./gradlew.bat build --scan +jobs: + 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 diff --git a/.github/workflows/trivy-scan.yml b/.github/workflows/trivy-scan.yml index fb502e6..e625103 100644 --- a/.github/workflows/trivy-scan.yml +++ b/.github/workflows/trivy-scan.yml @@ -3,31 +3,11 @@ name: Trivy on: workflow_dispatch: schedule: - - cron: '30 20 * * *' + - 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 - - 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