Skip to content

Commit

Permalink
Merge pull request #228 from ballerina-platform/gradle-migration
Browse files Browse the repository at this point in the history
Migrate to Gradle build
  • Loading branch information
NipunaRanasinghe authored Sep 20, 2023
2 parents fbf51ff + d6a37e1 commit 191b931
Show file tree
Hide file tree
Showing 25 changed files with 1,106 additions and 70 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

13 changes: 4 additions & 9 deletions .github/workflows/build-with-bal-test-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Checkout the Repository
uses: actions/checkout@v3

- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
Expand All @@ -26,14 +27,8 @@ jobs:
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
- name: Build Using GraalVM
run: ./gradlew build -P balGraalVMTest
env:
JAVA_OPTS: -DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true
CLIENT_ID: ${{ secrets.CLIENT_ID }}
Expand Down
39 changes: 19 additions & 20 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,37 @@ 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
env:
JAVA_HOME: /usr/lib/jvm/default-jvm
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 17.0.7

# Build Module Examples
- name: Ballerina Examples Build
run: chmod +x ./examples/build.sh && ./examples/build.sh build
- name: Gradle Build without Tests
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
run: ./gradlew build -x test
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)
- name: Gradle Build
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
run: bal test --test-report --code-coverage --coverage-format=xml
run: ./gradlew build
env:
JAVA_OPTS: -DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
REFRESH_URL: ${{ secrets.REFRESH_URL }}
RECIPIENT: ${{ secrets.RECIPIENT }}
Expand All @@ -46,7 +44,8 @@ jobs:
INLINE_IMAGE_PATH: ${{ secrets.INLINE_IMAGE_PATH }}
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
Loading

0 comments on commit 191b931

Please sign in to comment.