Skip to content

Commit

Permalink
Merge pull request #229 from ThisaruGuruge/master
Browse files Browse the repository at this point in the history
Migrate to Gradle Build and Update Workflows
  • Loading branch information
ThisaruGuruge authored Oct 24, 2023
2 parents 7390db0 + 91aca74 commit 3696126
Show file tree
Hide file tree
Showing 21 changed files with 380 additions and 657 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# See: https://help.github.com/articles/about-codeowners/

# These owners will be the default owners for everything in the repo.
* @indikasampath2000 @abeykoon @kasthuriraajan
* @ThisaruGuruge
18 changes: 0 additions & 18 deletions .github/issue_template.md

This file was deleted.

56 changes: 8 additions & 48 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,12 @@
## Purpose
> Describe the problems, issues, or needs driving this feature/fix and include links to related issues in the following format: Resolves issue1, issue2, etc.

## Goals
> Describe the solutions that this feature/fix will introduce to resolve the problems described above
Fixes:

## Approach
> Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email [email protected] to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.
## Examples

## User stories
> Summary of user stories addressed by this change>
## Release note
> Brief description of the new feature or bug fix as it will appear in the release notes
## Documentation
> Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact
## Training
> Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable
## Certification
> Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to [email protected] and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why.
## Marketing
> Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable
## Automation tests
- Unit tests
> Code coverage information
- Integration tests
> Details about the test cases and coverage
## Security checks
- Followed secure coding standards in http://wso2.com/technical-reports/wso2-secure-engineering-guidelines? yes/no
- Ran FindSecurityBugs plugin and verified report? yes/no
- Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? yes/no

## Samples
> Provide high-level details about the samples related to this feature
## Related PRs
> List any other related PRs
## Migrations (if applicable)
> Describe migration steps and platforms on which migration has been tested
## Test environment
> List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested
## Learning
> Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.
## Checklist
- [ ] Linked to an issue
- [ ] Updated the changelog
- [ ] Added tests
- [ ] Updated the spec
- [ ] Checked native-image compatibility
80 changes: 10 additions & 70 deletions .github/workflows/build-with-bal-test-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,16 @@ name: GraalVM Check

on:
schedule:
- cron: '30 18 * * *'
- cron: "30 18 * * *"
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:4.2.0
env:
# Following credentials are only used during testing in docker container
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin
ports:
- 27011:27017
mongodb-ssl:
image: rzhilkibaev/mongo-x509-auth-ssl:latest
ports:
- 27012:27017

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(MongoDB-SSL) using the native executable
run: bal test --graalvm --groups mongodb-ssl ./ballerina
env:
JAVA_HOME: /usr/lib/jvm/default-jvm
# Following credentials are only used during testing in docker container
MONGODB_USER: C=US,ST=CA,L=San Francisco,O=Jaspersoft,OU=JSDev,CN=admin

- name: Run Ballerina tests(MongoDB) using the native executable
run: bal test --graalvm --groups mongodb ./ballerina
env:
JAVA_HOME: /usr/lib/jvm/default-jvm
# Following credentials are only used during testing in docker container
MONGODB_USER: admin
MONGODB_PASSWORD: admin
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-standard-library/.github/workflows/build-with-bal-test-graalvm-connector-template.yml@main
secrets: inherit
100 changes: 9 additions & 91 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,100 +1,18 @@
name: CI

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

jobs:
build:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:4.2.0
env:
# Following credentials are only used during testing in docker container
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin
ports:
- 27011:27017
mongodb-ssl:
image: rzhilkibaev/mongo-x509-auth-ssl:latest
ports:
- 27012:27017

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
JAVA_OPTS: -DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true

# Test Ballerina MongoDB-SSL
- name: SSL Tests
run: bal test --groups mongodb-ssl --test-report --code-coverage --coverage-format=xml ./ballerina
env:
JAVA_HOME: /usr/lib/jvm/default-jvm
# Following credentials are only used during testing in docker container
MONGODB_USER: C=US,ST=CA,L=San Francisco,O=Jaspersoft,OU=JSDev,CN=admin

- name: Upload SSL test coverage reports to Codecov
uses: codecov/codecov-action@v3

# Test Ballerina MongoDB
- name: MongoDB Test
run: bal test --groups mongodb --test-report --code-coverage --coverage-format=xml ./ballerina
env:
JAVA_HOME: /usr/lib/jvm/default-jvm
# Following credentials are only used during testing in docker container
MONGODB_USER: admin
MONGODB_PASSWORD: admin

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

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

jobs:
build:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:4.2.0
env:
# Following credentials are only used during testing in docker container
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin
ports:
- 27011:27017
mongodb-ssl:
image: rzhilkibaev/mongo-x509-auth-ssl:latest
ports:
- 27012:27017

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 MongoDB-SSL
- name: SSL Tests
run: bal test --groups mongodb-ssl --test-report --code-coverage --coverage-format=xml ./ballerina
env:
JAVA_HOME: /usr/lib/jvm/default-jvm
# Following credentials are only used during testing in docker container
MONGODB_USER: C=US,ST=CA,L=San Francisco,O=Jaspersoft,OU=JSDev,CN=admin

- name: Upload SSL test coverage reports to Codecov
uses: codecov/codecov-action@v3

# Test Ballerina MongoDB
- name: MongoDB Test
run: bal test --groups mongodb --test-report --code-coverage --coverage-format=xml ./ballerina
env:
JAVA_HOME: /usr/lib/jvm/default-jvm
# Following credentials are only used during testing in docker container
MONGODB_USER: admin
MONGODB_PASSWORD: admin

- name: Upload MongoDB test 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-mongodb\"
}
}"
call_workflow:
name: Run Daily Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-standard-library/.github/workflows/daily-build-connector-template.yml@main
secrets: inherit
with:
repo-name: module-ballerinax-mongodb
Loading

0 comments on commit 3696126

Please sign in to comment.