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

Migrate to Gradle Build and Update Workflows in ASB Connector #205

Merged
merged 8 commits into from
Nov 22, 2023
Merged
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
File renamed without changes.
10 changes: 10 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Purpose

## Examples

## Checklist
- [ ] Linked to an issue
- [ ] Updated the specification
- [ ] Updated the changelog
- [ ] Added tests
- [ ] Checked native-image compatibility
62 changes: 10 additions & 52 deletions .github/workflows/build-with-bal-test-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,16 @@ name: GraalVM Check

on:
schedule:
- cron: '30 18 * * *'
- 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/[email protected]
with:
version: latest

- name: Grant execute permission for gradlew
run: chmod +x gradlew
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

- 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 }}
jobs:
call_workflow_template:
name: Run Workflow Template
if: ${{ github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'ballerina-platform') }}
uses: ballerina-platform/ballerina-library/.github/workflows/build-with-bal-test-graalvm-connector-template.yml@main
secrets: inherit
78 changes: 9 additions & 69 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,18 @@
name: CI

on:
push:
branches:
- main
- 2201.[0-9]+.x
repository_dispatch:
types:
check_connector_for_breaking_changes
types: check_connector_for_breaking_changes

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/[email protected]
with:
version: latest

# 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

# Build Ballerina Project
- name: Ballerina Build
run: bal pack ./ballerina
env:
JAVA_HOME: /usr/lib/jvm/default-jvm

# Test Ballerina Project
- name: Ballerina Test
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

- 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-azure-service-bus",
"workflow": "CI"
}
}'
call_workflow:
name: Run Connector Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/build-connector-template.yml@main
secrets: inherit
with:
repo-name: module-ballerinax-azure-service-bus
75 changes: 8 additions & 67 deletions .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,72 +2,13 @@ name: Daily build

on:
schedule:
- cron: '30 2 * * *'
- cron: "30 2 * * *"

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/[email protected]
with:
version: latest

# 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

# Build Ballerina Project
- name: Ballerina Build
run: bal pack ./ballerina
env:
JAVA_HOME: /usr/lib/jvm/default-jvm

# Test Ballerina Project
- name: Ballerina Test
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

# 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-azure-service-bus\"
}
}"
call_workflow:
name: Run Daily Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/daily-build-connector-template.yml@main
secrets: inherit
with:
repo-name: module-ballerinax-azure-service-bus
81 changes: 13 additions & 68 deletions .github/workflows/dev-stg-release.yml
Original file line number Diff line number Diff line change
@@ -1,76 +1,21 @@
name: Dev/Staging BCentral Release
name: Publish to the Ballerina Dev\Stage Central

on:
workflow_dispatch:
inputs:
bal_central_environment:
description: Ballerina Central Environment
environment:
type: choice
options:
- STAGE
- DEV
description: Select Environment
required: true
options:
- DEV CENTRAL
- STAGE CENTRAL

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/[email protected]
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
call_workflow:
name: Run Dev\Stage Central Publish Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/dev-stage-central-publish-connector-template.yml@main
secrets: inherit
with:
environment: ${{ github.event.inputs.environment }}
Loading
Loading