Skip to content

Commit

Permalink
Migrate to Gradle build
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisaruGuruge committed Sep 19, 2023
1 parent fbf51ff commit ddada2a
Show file tree
Hide file tree
Showing 23 changed files with 1,138 additions and 94 deletions.
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

86 changes: 44 additions & 42 deletions .github/workflows/build-with-bal-test-native.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,52 @@
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 * * *'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
pull_request:
branches:
- master
types: [ opened, synchronize, reopened, labeled, unlabeled ]

steps:
- uses: actions/checkout@v2
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
java-version: '11'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
JAVA_OPTS: -DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
REFRESH_URL: ${{ secrets.REFRESH_URL }}
RECIPIENT: ${{ secrets.RECIPIENT }}
SENDER: ${{ secrets.SENDER }}
CC: ${{ secrets.CC }}
ATTACHMENT_PATH: ${{ secrets.ATTACHMENT_PATH }}
ATTACHMENT_CONTENT_TYPE: ${{ secrets.ATTACHMENT_CONTENT_TYPE }}
INLINE_IMAGE_PATH: ${{ secrets.INLINE_IMAGE_PATH }}
INLINE_IMAGE_NAME: ${{ secrets.INLINE_IMAGE_NAME }}
IMAGE_CONTENT_TYPE: ${{ secrets.IMAGE_CONTENT_TYPE }}

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

- name: Run Ballerina tests using the native executable
working-directory: ./ballerina
run: bal test --graalvm
env:
JAVA_OPTS: -DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
REFRESH_URL: ${{ secrets.REFRESH_URL }}
RECIPIENT: ${{ secrets.RECIPIENT }}
SENDER: ${{ secrets.SENDER }}
CC: ${{ secrets.CC }}
ATTACHMENT_PATH: ${{ secrets.ATTACHMENT_PATH }}
ATTACHMENT_CONTENT_TYPE: ${{ secrets.ATTACHMENT_CONTENT_TYPE }}
INLINE_IMAGE_PATH: ${{ secrets.INLINE_IMAGE_PATH }}
INLINE_IMAGE_NAME: ${{ secrets.INLINE_IMAGE_NAME }}
IMAGE_CONTENT_TYPE: ${{ secrets.IMAGE_CONTENT_TYPE }}
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 }}'
24 changes: 11 additions & 13 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,31 @@ name: Pull Request
on: [ pull_request ]

jobs:
build:
build-on-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout the Repository
uses: actions/checkout@v3

# Setup Ballerina Environment
- name: Set Up Ballerina
uses: ballerina-platform/[email protected]
with:
version: latest

# Build Ballerina Project
- name: Ballerina Build
run: bal pack ./ballerina
# Build Gradle Project
- name: Gradle Build
run: ./gradlew build -x test
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
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}

# Test Ballerina Project
- name: Ballerina Test
working-directory: ./ballerina
# 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
run: ./gradlew test
env:
JAVA_OPTS: -DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true
CLIENT_ID: ${{ secrets.CLIENT_ID }}
Expand All @@ -47,6 +43,8 @@ jobs:
INLINE_IMAGE_NAME: ${{ secrets.INLINE_IMAGE_NAME }}
IMAGE_CONTENT_TYPE: ${{ secrets.IMAGE_CONTENT_TYPE }}
JAVA_HOME: /usr/lib/jvm/default-jvm
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
45 changes: 12 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,16 @@
name: Deployment
name: Publish Release

on:
release:
types: [ published ]
workflow_dispatch:
repository_dispatch:
types: [ stdlib-release-pipeline ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# Setup Ballerina Environment
- name: Set Up Ballerina
uses: ballerina-platform/[email protected]
with:
version: 2201.7.0

# 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
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: googleapis.gmail
package-org: ballerinax
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Config.toml

# Package Files #
*.jar
!gradle/wrapper/gradle-wrapper.jar
*.war
*.ear
*.zip
Expand Down
2 changes: 1 addition & 1 deletion ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
distribution = "2201.7.0"
org = "ballerinax"
name = "googleapis.gmail"
version = "3.5.0"
version = "4.0.0"
authors = ["Ballerina"]
repository = "https://github.com/ballerina-platform/module-ballerinax-googleapis.gmail"
keywords = ["Communication/Email", "Cost/Free", "Vendor/Google"]
Expand Down
Loading

0 comments on commit ddada2a

Please sign in to comment.