diff --git a/.github/workflows/build-timestamped-master.yml b/.github/workflows/build-timestamped-master.yml new file mode 100644 index 00000000..f3b7a5d5 --- /dev/null +++ b/.github/workflows/build-timestamped-master.yml @@ -0,0 +1,18 @@ +name: Build + +on: + push: + branches: + - master + paths-ignore: + - '*.md' + - 'docs/**' + + workflow_dispatch: + +jobs: + 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 new file mode 100644 index 00000000..77cdaece --- /dev/null +++ b/.github/workflows/build-with-bal-test-graalvm.yml @@ -0,0 +1,37 @@ +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 build 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 + +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: '-J-Xmx7G ${{ inputs.native_image_options }}' diff --git a/.github/workflows/build-with-bal-test-native.yml b/.github/workflows/build-with-bal-test-native.yml deleted file mode 100644 index a464b142..00000000 --- a/.github/workflows/build-with-bal-test-native.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: GraalVM Check - -on: - schedule: - - cron: '30 18 * * *' - workflow_dispatch: - -jobs: - build: - 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: Set Up Ballerina - uses: ballerina-platform/setup-ballerina@v1.1.0 - with: - version: latest - - - 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 -x test - - - name: Set up GraalVM - uses: graalvm/setup-graalvm@v1 - with: - java-version: '17' - distribution: 'graalvm-community' - github-token: ${{ secrets.GITHUB_TOKEN }} - set-java-home: 'false' - - - name: Check GraalVM installation - run: | - echo "GRAALVM_HOME: ${{ env.GRAALVM_HOME }}" - echo "JAVA_HOME: ${{ env.JAVA_HOME }}" - native-image --version - - - name: Run Ballerina tests using the native executable - run: bal test --graalvm ./ballerina - env: - JAVA_HOME: /usr/lib/jvm/default-jvm - CONNECTION_STRING: ${{ secrets.CONNECTION_STRING }} - QUEUE_NAME: ${{ secrets.QUEUE_NAME }} - TOPIC_NAME: ${{ secrets.TOPIC_NAME }} - SUBSCRIPTION_NAME1: ${{ secrets.SUBSCRIPTION_NAME1 }} - SUBSCRIPTION_NAME2: ${{ secrets.SUBSCRIPTION_NAME2 }} - SUBSCRIPTION_NAME3: ${{ secrets.SUBSCRIPTION_NAME3 }} diff --git a/.github/workflows/central-publish.yml b/.github/workflows/central-publish.yml new file mode 100644 index 00000000..a80ffaed --- /dev/null +++ b/.github/workflows/central-publish.yml @@ -0,0 +1,21 @@ +name: Publish to the Ballerina central + +on: + workflow_dispatch: + inputs: + environment: + type: choice + description: Select Environment + required: true + options: + - DEV CENTRAL + - STAGE CENTRAL + +jobs: + 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/dev-stg-release.yml b/.github/workflows/dev-stg-release.yml deleted file mode 100644 index 5d0bc9bc..00000000 --- a/.github/workflows/dev-stg-release.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Dev/Staging BCentral Release - -on: - workflow_dispatch: - inputs: - bal_central_environment: - description: Ballerina Central Environment - type: choice - options: - - STAGE - - DEV - required: true - -jobs: - release: - runs-on: ubuntu-latest - env: - BALLERINA_${{ github.event.inputs.bal_central_environment }}_CENTRAL: true - - steps: - - uses: actions/checkout@v3 - - # Set up Java Environment - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: 17.0.7 - - # Setup Ballerina Environment - - name: Set Up Ballerina - uses: ballerina-platform/setup-ballerina@v1.1.0 - with: - version: 2201.8.0 - - # Grant execute permission to the gradlew script - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - # Build the project with Gradle - - 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 -x test -x :azure-service-bus-examples:build - - # Perform Trivy scan - - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@master - with: - scan-type: 'rootfs' - scan-ref: '.' - skip-dirs: 'gradle/' - format: 'table' - timeout: '10m0s' - exit-code: '1' - - # Push to Ballerina Staging Central - - name: Push to Staging - if: github.event.inputs.bal_central_environment == 'STAGE' - run: bal push - working-directory: ./ballerina - env: - BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_STAGE_ACCESS_TOKEN }} - JAVA_HOME: /usr/lib/jvm/default-jvm - - # Push to Ballerina Dev Central - - name: Push to Dev - if: github.event.inputs.bal_central_environment == 'DEV' - run: bal push - working-directory: ./ballerina - env: - BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }} - JAVA_HOME: /usr/lib/jvm/default-jvm diff --git a/.github/workflows/fossa_scan.yml b/.github/workflows/fossa_scan.yml new file mode 100644 index 00000000..651f73a6 --- /dev/null +++ b/.github/workflows/fossa_scan.yml @@ -0,0 +1,16 @@ +name: Fossa Scan +on: + workflow_dispatch: + schedule: + - cron: '30 18 * * *' # 00:00 in LK time (GMT+5:30) +jobs: + fossa-scan: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: fossas/fossa-action@main + env: + packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} + packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} + with: + api-key: ${{secrets.FOSSA_APIKEY}} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 00000000..8738a2ec --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,16 @@ +name: Publish Release + +on: + workflow_dispatch: + repository_dispatch: + types: [ stdlib-release-pipeline ] + +jobs: + 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: asb + package-org: ballerina diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 9e743073..a83a8634 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,59 +1,14 @@ name: Pull Request -on: [ pull_request ] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - # Set up Java Environment - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: 17.0.7 - - # Setup Ballerina Environment - - name: Set Up Ballerina - uses: ballerina-platform/setup-ballerina@v1.1.0 - with: - version: latest - - # Grant execute permission to the gradlew script - - name: Grant execute permission for gradlew - run: chmod +x gradlew +on: pull_request - # Build the project with Gradle - - name: Build with Gradle - env: - packageUser: ${{ github.actor }} - packagePAT: ${{ secrets.GITHUB_TOKEN }} - JAVA_OPTS: -DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true - run: | - ./gradlew build -x test - - # Build Ballerina Project - - name: Ballerina Build - run: bal pack ./ballerina - env: - JAVA_HOME: /usr/lib/jvm/default-jvm - - # Test Ballerina Project - - name: Ballerina Test - # tests will be skipped if the PR is from a forked repository (as the secrets are not available) - if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} - run: bal test --test-report --code-coverage --coverage-format=xml ./ballerina - env: - JAVA_HOME: /usr/lib/jvm/default-jvm - CONNECTION_STRING: ${{ secrets.CONNECTION_STRING }} - QUEUE_NAME: ${{ secrets.QUEUE_NAME }} - TOPIC_NAME: ${{ secrets.TOPIC_NAME }} - SUBSCRIPTION_NAME1: ${{ secrets.SUBSCRIPTION_NAME1 }} - SUBSCRIPTION_NAME2: ${{ secrets.SUBSCRIPTION_NAME2 }} - SUBSCRIPTION_NAME3: ${{ secrets.SUBSCRIPTION_NAME3 }} - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 +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 + secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 4c563d35..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Deployment - -on: - release: - types: [ published ] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - # Set up Java Environment - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: 17.0.7 - - # Setup Ballerina Environment - - name: Set Up Ballerina - uses: ballerina-platform/setup-ballerina@v1.1.0 - with: - version: 2201.8.0 - - # Grant execute permission to the gradlew script - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - # Build the project with Gradle - - 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 -x test -x :azure-service-bus-examples:build - - # Perform Trivy scan - - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@master - with: - scan-type: 'rootfs' - scan-ref: '.' - skip-dirs: 'gradle/' - format: 'table' - timeout: '10m0s' - exit-code: '1' - - # Build Ballerina Project - - name: Ballerina Build - run: bal pack ./ballerina - env: - JAVA_HOME: /usr/lib/jvm/default-jvm - CONNECTION_STRING: ${{ secrets.CONNECTION_STRING }} - QUEUE_NAME: ${{ secrets.QUEUE_NAME }} - TOPIC_NAME: ${{ secrets.TOPIC_NAME }} - SUBSCRIPTION_NAME1: ${{ secrets.SUBSCRIPTION_NAME1 }} - SUBSCRIPTION_NAME2: ${{ secrets.SUBSCRIPTION_NAME2 }} - SUBSCRIPTION_NAME3: ${{ secrets.SUBSCRIPTION_NAME3 }} - - # Push to Ballerina Central - - name: Ballerina Push - run: bal push - working-directory: ./ballerina - env: - BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }} - JAVA_HOME: /usr/lib/jvm/default-jvm diff --git a/.github/workflows/stale_check.yml b/.github/workflows/stale_check.yml new file mode 100644 index 00000000..8763360a --- /dev/null +++ b/.github/workflows/stale_check.yml @@ -0,0 +1,19 @@ +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/trivy-scan.yml b/.github/workflows/trivy-scan.yml index 4a286aa6..20e3aa24 100644 --- a/.github/workflows/trivy-scan.yml +++ b/.github/workflows/trivy-scan.yml @@ -1,40 +1,13 @@ name: Trivy on: - workflow_dispatch: - schedule: - - cron: '30 20 * * *' + workflow_dispatch: + schedule: + - 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: Set Up Ballerina - uses: ballerina-platform/setup-ballerina@v1.1.0 - with: - version: latest - - - name: Build with Gradle - env: - packageUser: ${{ github.actor }} - packagePAT: ${{ secrets.GITHUB_TOKEN }} - run: ./gradlew build -x check -x test -x :azure-service-bus-examples:build - - - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@master - with: - scan-type: 'rootfs' - scan-ref: '.' - skip-dirs: 'gradle/' - 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/.github/workflows/update-spec.yml b/.github/workflows/update-spec.yml new file mode 100644 index 00000000..7815278d --- /dev/null +++ b/.github/workflows/update-spec.yml @@ -0,0 +1,48 @@ +name: Update Specifications + +env: + SPEC_FOLDER_PATH: 'docs/spec' + +on: + workflow_dispatch: + push: + branches: + - master + paths: + - 'docs/spec/**' + +jobs: + update_specs: + name: Update Specifications + if: github.repository_owner == 'ballerina-platform' + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + + - name: Get Repo Name + id: repo_name + run: | + MODULE=${{ github.event.repository.name }} + echo "::set-output name=short_name::${MODULE##*-}" + + - name: Trigger Workflow + run: | + curl --request POST \ + 'https://api.github.com/repos/ballerina-platform/ballerina-dev-website/dispatches' \ + -H 'Accept: application/vnd.github.v3+json' \ + -H 'Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}' \ + --data "{ + \"event_type\": \"update-stdlib-specs\", + \"client_payload\": { + \"module_name\": \"${{ github.event.repository.name }}\", + \"short_name\": \"${{ steps.repo_name.outputs.short_name }}\", + \"file_dir\": \"${{ github.event.repository.name }}/${{ env.SPEC_FOLDER_PATH }}\", + \"release_date\": \"${{ steps.date.outputs.date }}\" + } + }"