Skip to content

Commit

Permalink
Add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
niveathika committed Jun 4, 2024
1 parent e3fc630 commit b6a2b3d
Show file tree
Hide file tree
Showing 7 changed files with 248 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Purpose

Fixes:

## Examples

## Checklist
- [ ] Linked to an issue
- [ ] Updated the specification
- [ ] Updated the changelog
- [ ] Added tests
- [ ] Checked native-image compatibility
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build

on:
push:
branches:
- main

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

- name: Get Ballerina Version
run: |
BAL_VERSION=$(grep -w 'ballerinaLangVersion' gradle.properties | cut -d= -f2 | rev | cut --complement -d- -f1 | rev)
if [ -z "$BAL_VERSION" ]; then
BAL_VERSION="latest"
fi
echo "BAL_VERSION=$BAL_VERSION" >> $GITHUB_ENV
echo "Ballerina Version: $BAL_VERSION"
- name: Set Up Ballerina
uses: ballerina-platform/setup-ballerina@v1.1.0
with:
version: ${{ env.BAL_VERSION }}

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17.0.7

- name: Build the Package
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew build -x test
./gradlew test
- name: Generate Codecov Report
uses: codecov/codecov-action@v3
38 changes: 38 additions & 0 deletions .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Daily build

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

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

- name: Set Up Ballerina
uses: ballerina-platform/setup-ballerina@v1.1.0
with:
version: latest

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 17.0.7

- name: Build the Package
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew build -x test -PbuildUsingDocker=nightly
- name: Test the Package
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew test -PbuildUsingDocker=nightly
42 changes: 42 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: PR Build

on: pull_request

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

- name: Get Ballerina Version
run: |
BAL_VERSION=$(grep -w 'ballerinaLangVersion' gradle.properties | cut -d= -f2 | rev | cut --complement -d- -f1 | rev)
if [ -z "$BAL_VERSION" ]; then
BAL_VERSION="latest"
fi
echo "BAL_VERSION=$BAL_VERSION" >> $GITHUB_ENV
echo "Ballerina Version: $BAL_VERSION"
- name: Set Up Ballerina
uses: ballerina-platform/setup-ballerina@v1.1.0
with:
version: ${{ env.BAL_VERSION }}

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17.0.7

- name: Build the Package
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew build -x test
./gradlew test
- name: Generate Codecov Report
uses: codecov/codecov-action@v3
86 changes: 86 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Publish Release

on:
workflow_dispatch:

jobs:
publish-release:
name: Release Package
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Get Ballerina Version
run: |
BAL_VERSION=$(grep -w 'ballerinaLangVersion' gradle.properties | cut -d= -f2 | rev | cut --complement -d- -f1 | rev)
if [ -z "$BAL_VERSION" ]; then
BAL_VERSION="latest"
fi
echo "BAL_VERSION=$BAL_VERSION" >> $GITHUB_ENV
echo "Ballerina Version: $BAL_VERSION"
- name: Set Up Ballerina
uses: ballerina-platform/setup-ballerina@v1.1.0
with:
version: ${{ env.BAL_VERSION }}

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17.0.7

- name: Build without Tests
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name ${{ secrets.USERNAME }}
git config --global user.email ${{ secrets.EMAIL }}
./gradlew build -x test
- name: Create lib Directory if not Exists
run: mkdir -p ballerina/lib

- name: Run Trivy Vulnerability Scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: "rootfs"
scan-ref: "/github/workspace/ballerina/lib"
format: "table"
timeout: "10m0s"
exit-code: "1"
skip-dirs: "examples"

- name: Get Release Version
run: echo "VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut -d- -f2 | rev)" >> $GITHUB_ENV

- name: Checkout to Release Branch
run: |
echo "Version: ${VERSION}"
git checkout -b release-${VERSION}
- name: Remove Target Directory
run: |
sudo rm -rf ballerina/target
sudo rm -rf ballerina/build
- name: Publish Package
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }}
packageUser: ${{ secrets.USERNAME }}
packagePAT: ${{ secrets.TOKEN }}
publishUser: ${{ secrets.USERNAME }}
publishPAT: ${{ secrets.TOKEN }}
run: |
./gradlew clean release -Prelease.useAutomaticVersion=true
./gradlew -Pversion=${VERSION} publish -x test -PpublishToCentral=true
- name: GitHub Release and Release Sync PR
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
run: |
gh release create v$VERSION --title "module-niveathika-pluralize-v$VERSION"
gh pr create --base ${GITHUB_REF##*/} --title "[Automated] Sync ${GITHUB_REF##*/} after $VERSION release" --body "Sync ${GITHUB_REF##*/} after $VERSION release"
17 changes: 17 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

This file contains all the notable changes done to the Ballerina `pluralize` package through the releases.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

### Changed

## [1.0.0] - 03/06/2024

### Added
- Add `pluralize` library.
8 changes: 8 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
coverage:
precision: 2
round: down
range: "60...80"
status:
project:
default:
target: 80

0 comments on commit b6a2b3d

Please sign in to comment.