diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..35887fc --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,12 @@ +## Purpose + +Fixes: + +## Examples + +## Checklist +- [ ] Linked to an issue +- [ ] Updated the specification +- [ ] Updated the changelog +- [ ] Added tests +- [ ] Checked native-image compatibility diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ed595b4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml new file mode 100644 index 0000000..029271a --- /dev/null +++ b/.github/workflows/daily-build.yml @@ -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 diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..559f803 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5bf327b --- /dev/null +++ b/.github/workflows/release.yml @@ -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" diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..ccf9e65 --- /dev/null +++ b/changelog.md @@ -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. diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..f60b970 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,8 @@ +coverage: + precision: 2 + round: down + range: "60...80" + status: + project: + default: + target: 80