From f3bafb06b5d228a6d302134155f411685b18eb07 Mon Sep 17 00:00:00 2001 From: Nipuna Fernando Date: Fri, 11 Aug 2023 23:55:08 +0530 Subject: [PATCH] Update the github workflows --- .../workflows/build-with-bal-test-native.yml | 69 +++++------ .github/workflows/ci.yml | 107 ++++++++++-------- .github/workflows/daily-build.yml | 107 ++++++++---------- .github/workflows/dev-stg-release.yml | 75 ++++++------ .github/workflows/pull-request.yml | 45 ++++---- .github/workflows/release.yml | 56 ++++----- 6 files changed, 237 insertions(+), 222 deletions(-) diff --git a/.github/workflows/build-with-bal-test-native.yml b/.github/workflows/build-with-bal-test-native.yml index 14884d4..97c742c 100644 --- a/.github/workflows/build-with-bal-test-native.yml +++ b/.github/workflows/build-with-bal-test-native.yml @@ -1,44 +1,45 @@ name: GraalVM Check -on: +on: schedule: - cron: '30 18 * * *' workflow_dispatch: jobs: - build: - runs-on: ubuntu-latest + build: + runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 + steps: + - uses: actions/checkout@v2 - - name: Set up GraalVM - uses: graalvm/setup-graalvm@v1 - with: - version: 'latest' - java-version: '11' - 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 - uses: ballerina-platform/setup-ballerina@v1.1.0 - with: - version: latest + - name: Set up GraalVM + uses: graalvm/setup-graalvm@v1 + with: + version: 'latest' + java-version: '11' + components: 'native-image' + github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Run Ballerina tests using the native executable - run: bal test --graalvm ./teams - env: - JAVA_HOME: /usr/lib/jvm/default-jvm - REFRESH_URL: ${{ secrets.REFRESH_URL }} - REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} - CLIENT_ID: ${{ secrets.CLIENT_ID }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - USER_ID_1: ${{ secrets.USER_ID_1 }} - USER_ID_2: ${{ secrets.USER_ID_2 }} - USER_ID_3: ${{ secrets.USER_ID_3 }} + - name: Check GraalVM installation + run: | + echo "GRAALVM_HOME: ${{ env.GRAALVM_HOME }}" + echo "JAVA_HOME: ${{ env.JAVA_HOME }}" + native-image --version + + - name: Set Up Ballerina + uses: ballerina-platform/setup-ballerina@v1.1.0 + with: + version: latest + + - name: Run Ballerina tests using the native executable + working-directory: ./calendar + run: bal test --graalvm + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + REFRESH_URL: ${{ secrets.REFRESH_URL }} + REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} + CLIENT_ID: ${{ secrets.CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + USER_ID_1: ${{ secrets.USER_ID_1 }} + USER_ID_2: ${{ secrets.USER_ID_2 }} + USER_ID_3: ${{ secrets.USER_ID_3 }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4525eca..ef51dba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,58 +2,65 @@ name: CI on: push: - branches: - - '**' + branches-ignore: + - "automated/dependency_version_update" + - "automated/dependency_version_update_tmp" repository_dispatch: types: check_connector_for_breaking_changes jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Ballerina Build - uses: ballerina-platform/ballerina-action/@nightly - with: - args: - pack ./teams - env: - REFRESH_URL: ${{ secrets.REFRESH_URL }} - REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} - CLIENT_ID: ${{ secrets.CLIENT_ID }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - USER_ID_1: ${{ secrets.USER_ID_1 }} - USER_ID_2: ${{ secrets.USER_ID_2 }} - USER_ID_3: ${{ secrets.USER_ID_3 }} - - name: Ballerina Tests - run: bal test --test-report --code-coverage --coverage-format=xml - env: - WORKING_DIR: ./teams - REFRESH_URL: ${{ secrets.REFRESH_URL }} - REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} - CLIENT_ID: ${{ secrets.CLIENT_ID }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - USER_ID_1: ${{ secrets.USER_ID_1 }} - USER_ID_2: ${{ secrets.USER_ID_2 }} - USER_ID_3: ${{ secrets.USER_ID_3 }} - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 - - - name: Alert notifier on failure - if: failure() && (github.event.action == 'check_connector_for_breaking_changes') - run: | - curl -X POST \ - 'https://api.github.com/repos/ballerina-platform/ballerina-release/dispatches' \ - --header 'Accept: application/vnd.github.v3+json' \ - --header 'Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}' \ - --data-raw '{ - "event_type": "notify-ballerinax-connector-build-failure", - "client_payload": { - "repoName": "module-ballerinax-microsoft.teams", - "workflow": "CI" - } - }' + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + # Setup Ballerina Environment + - name: Set Up Ballerina + uses: ballerina-platform/setup-ballerina@v1.1.0 + with: + version: latest + + # Build Ballerina Project + - name: Ballerina Build + run: bal pack ./ballerina + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Build Module Examples + - name: Ballerina Examples Build + run: chmod +x ./examples/build.sh && ./examples/build.sh build + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Test Ballerina Project + - name: Ballerina Test + run: bal test ./ballerina --test-report --code-coverage --coverage-format=xml + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + REFRESH_URL: ${{ secrets.REFRESH_URL }} + REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} + CLIENT_ID: ${{ secrets.CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + USER_ID_1: ${{ secrets.USER_ID_1 }} + USER_ID_2: ${{ secrets.USER_ID_2 }} + USER_ID_3: ${{ secrets.USER_ID_3 }} + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + + # Send notification when build fails + - name: Alert notifier on failure + if: failure() && (github.event.action == 'check_connector_for_breaking_changes') + run: | + curl -X POST \ + 'https://api.github.com/repos/ballerina-platform/ballerina-release/dispatches' \ + --header 'Accept: application/vnd.github.v3+json' \ + --header 'Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}' \ + --data-raw '{ + "event_type": "notify-ballerinax-connector-build-failure", + "client_payload": { + "repoName": "module-ballerinax-microsoft.teams", + "workflow": "CI" + } + }' diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index b68353a..1d1dad7 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -1,68 +1,61 @@ name: Daily build -# Controls when the action will run. -on: +on: schedule: - cron: '30 2 * * *' -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-latest + build: + runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + steps: + - uses: actions/checkout@v2 - # Build the ballerina project - - name: Ballerina Build - uses: ballerina-platform/ballerina-action/@nightly - with: - args: - pack ./teams - env: - JAVA_HOME: /usr/lib/jvm/default-jvm - REFRESH_URL: ${{ secrets.REFRESH_URL }} - REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} - CLIENT_ID: ${{ secrets.CLIENT_ID }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - USER_ID_1: ${{ secrets.USER_ID_1 }} - USER_ID_2: ${{ secrets.USER_ID_2 }} - USER_ID_3: ${{ secrets.USER_ID_3 }} + # Setup Ballerina Environment + - name: Set Up Ballerina + uses: ballerina-platform/setup-ballerina@v1.1.0 + with: + version: latest - - name: Ballerina Tests - uses: ballerina-platform/ballerina-action/@nightly - with: - args: - test --test-report --code-coverage --coverage-format=xml - env: - JAVA_HOME: /usr/lib/jvm/default-jvm - WORKING_DIR: ./teams - REFRESH_URL: ${{ secrets.REFRESH_URL }} - REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} - CLIENT_ID: ${{ secrets.CLIENT_ID }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - USER_ID_1: ${{ secrets.USER_ID_1 }} - USER_ID_2: ${{ secrets.USER_ID_2 }} - USER_ID_3: ${{ secrets.USER_ID_3 }} + # Build Ballerina Project + - name: Ballerina Build + run: bal pack ./ballerina + env: + JAVA_HOME: /usr/lib/jvm/default-jvm - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 + # Build Module Examples + - name: Ballerina Examples Build + run: chmod +x ./examples/build.sh && ./examples/build.sh build + env: + JAVA_HOME: /usr/lib/jvm/default-jvm - # Send notification when build fails - - name: Notify failure - if: ${{ failure() }} - run: | - curl -X POST \ - 'https://api.github.com/repos/ballerina-platform/ballerina-release/dispatches' \ - -H 'Accept: application/vnd.github.v3+json' \ - -H 'Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}' \ - --data "{ - \"event_type\": \"notify-build-failure\", - \"client_payload\": { - \"repoName\": \"module-ballerinax-microsoft.teams\" - } - }" + # Test Ballerina Project + - name: Ballerina Test + run: bal test ./ballerina --test-report --code-coverage --coverage-format=xml + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + REFRESH_URL: ${{ secrets.REFRESH_URL }} + REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} + CLIENT_ID: ${{ secrets.CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + USER_ID_1: ${{ secrets.USER_ID_1 }} + USER_ID_2: ${{ secrets.USER_ID_2 }} + USER_ID_3: ${{ secrets.USER_ID_3 }} + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + + # Send notification when build fails + - name: Notify failure + if: ${{ failure() }} + run: | + curl -X POST \ + 'https://api.github.com/repos/ballerina-platform/ballerina-release/dispatches' \ + -H 'Accept: application/vnd.github.v3+json' \ + -H 'Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}' \ + --data "{ + \"event_type\": \"notify-build-failure\", + \"client_payload\": { + \"repoName\": \"module-ballerinax-microsoft.teams\" + } + }" diff --git a/.github/workflows/dev-stg-release.yml b/.github/workflows/dev-stg-release.yml index 7634999..9febee1 100644 --- a/.github/workflows/dev-stg-release.yml +++ b/.github/workflows/dev-stg-release.yml @@ -7,41 +7,50 @@ on: description: Ballerina Central Environment type: choice options: - - STAGE - - DEV + - STAGE + - DEV required: true jobs: - build: + release: + runs-on: ubuntu-latest + env: + BALLERINA_${{ github.event.inputs.bal_central_environment }}_CENTRAL: true + steps: + - uses: actions/checkout@v2 - runs-on: ubuntu-latest - env: - BALLERINA_${{ github.event.inputs.bal_central_environment }}_CENTRAL: true + # Setup Ballerina Environment + - name: Set Up Ballerina + uses: ballerina-platform/setup-ballerina@v1.1.0 + with: + version: latest - steps: - - uses: actions/checkout@v2 - - name: Ballerina Build - uses: ballerina-platform/ballerina-action/@2201.2.1 - with: - args: - pack ./teams - - - name: Push to Staging - uses: ballerina-platform/ballerina-action/@2201.2.1 - if: github.event.inputs.bal_central_environment == 'STAGE' - with: - args: - push - env: - WORKING_DIR: ./teams - BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_STAGE_ACCESS_TOKEN }} - - name: Push to Dev - uses: ballerina-platform/ballerina-action/@2201.2.1 - if: github.event.inputs.bal_central_environment == 'DEV' - with: - args: - push - env: - WORKING_DIR: ./teams - BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }} - + # Build Ballerina Project + - name: Ballerina Build + run: bal pack ./ballerina + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Build Module Examples + - name: Ballerina Examples Build + run: chmod +x ./examples/build.sh && ./examples/build.sh build + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # 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/pull-request.yml b/.github/workflows/pull-request.yml index 42b9484..699e6df 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,35 +1,38 @@ -name: CI_pull_request +name: Pull Request -on: [pull_request] +on: [ pull_request ] jobs: build: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - - name: Ballerina Build - uses: ballerina-platform/ballerina-action/@nightly + + # Setup Ballerina Environment + - name: Set Up Ballerina + uses: ballerina-platform/setup-ballerina@v1.1.0 with: - args: - pack ./teams - env: - REFRESH_URL: ${{ secrets.REFRESH_URL }} - REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} - CLIENT_ID: ${{ secrets.CLIENT_ID }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - USER_ID_1: ${{ secrets.USER_ID_1 }} - USER_ID_2: ${{ secrets.USER_ID_2 }} - USER_ID_3: ${{ secrets.USER_ID_3 }} - - name: Ballerina Tests + version: latest + + # Build Ballerina Project + - name: Ballerina Build + run: bal pack ./ballerina + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Build Module Examples + - name: Ballerina Examples Build + run: chmod +x ./examples/build.sh && ./examples/build.sh build + 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 }} - uses: ballerina-platform/ballerina-action/@nightly - with: - args: - test --test-report --code-coverage --coverage-format=xml ./teams + run: bal test ./ballerina --test-report --code-coverage --coverage-format=xml env: + JAVA_HOME: /usr/lib/jvm/default-jvm REFRESH_URL: ${{ secrets.REFRESH_URL }} REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} CLIENT_ID: ${{ secrets.CLIENT_ID }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 18af2bd..3b50649 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,34 +2,36 @@ name: Deployment on: release: - types: [published] + types: [ published ] jobs: - build: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 - runs-on: ubuntu-latest + # Setup Ballerina Environment + - name: Set Up Ballerina + uses: ballerina-platform/setup-ballerina@v1.1.0 + with: + version: latest - steps: - - uses: actions/checkout@v2 - - name: Ballerina Build - uses: ballerina-platform/ballerina-action/@2201.2.1 - with: - args: - pack ./teams - env: - REFRESH_URL: ${{ secrets.REFRESH_URL }} - REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} - CLIENT_ID: ${{ secrets.CLIENT_ID }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - USER_ID_1: ${{ secrets.USER_ID_1 }} - USER_ID_2: ${{ secrets.USER_ID_2 }} - USER_ID_3: ${{ secrets.USER_ID_3 }} - - name: Ballerina Push - uses: ballerina-platform/ballerina-action/@2201.2.1 - with: - args: - push - env: - WORKING_DIR: ./teams - BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }} - \ No newline at end of file + # Build Ballerina Project + - name: Ballerina Build + run: bal pack ./ballerina + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Build Module Examples + - name: Ballerina Examples Build + run: chmod +x ./examples/build.sh && ./examples/build.sh build + env: + JAVA_HOME: /usr/lib/jvm/default-jvm + + # Push to Ballerina Central + - name: Ballerina Push + run: bal push + working-directory: ./ballerina + env: + BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }} + JAVA_HOME: /usr/lib/jvm/default-jvm