-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ballerina-platform#3 from Ajai-Suvendran/main
Finalize v1.0.0 Release Preparations for SWIFT MT Library
- Loading branch information
Showing
54 changed files
with
358 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
name: execute-build | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
working_dir: | ||
required: true | ||
type: string | ||
bal_central_environment: | ||
required: true | ||
type: string | ||
env: | ||
BALLERINA_VERSION: 2201.10.1 | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
env: | ||
JAVA_OPTS: -Xmx4G | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set Up Ballerina | ||
uses: ballerina-platform/[email protected] | ||
with: | ||
version: $BALLERINA_VERSION | ||
|
||
- name: Run ballerina build for staging | ||
if: inputs.bal_central_environment == 'STAGE' | ||
env: | ||
BALLERINA_STAGE_CENTRAL: true | ||
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_STAGE_ACCESS_TOKEN }} | ||
run: | | ||
pushd "${{ inputs.working_dir }}" | ||
bal pack | ||
popd | ||
- name: Run ballerina build for dev | ||
if: inputs.bal_central_environment == 'DEV' | ||
env: | ||
BALLERINA_DEV_CENTRAL: true | ||
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }} | ||
run: | | ||
pushd "${{ inputs.working_dir }}" | ||
bal pack | ||
popd | ||
- name: Run ballerina build for prod | ||
if: inputs.bal_central_environment == 'PROD' | ||
run: | | ||
pushd "${{ inputs.working_dir }}" | ||
bal pack | ||
popd | ||
- name: Push to Staging | ||
if: inputs.bal_central_environment == 'STAGE' | ||
env: | ||
BALLERINA_STAGE_CENTRAL: true | ||
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_STAGE_ACCESS_TOKEN }} | ||
run: | | ||
pushd "${{ inputs.working_dir }}" | ||
bal push | ||
popd | ||
- name: Push to Dev | ||
if: inputs.bal_central_environment == 'DEV' | ||
env: | ||
BALLERINA_DEV_CENTRAL: true | ||
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }} | ||
run: | | ||
pushd "${{ inputs.working_dir }}" | ||
bal push | ||
popd | ||
- name: Push to Prod | ||
if: inputs.bal_central_environment == 'PROD' | ||
env: | ||
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }} | ||
run: | | ||
pushd "${{ inputs.working_dir }}" | ||
bal push | ||
popd | ||
- name: Publish Release | ||
if: inputs.bal_central_environment == 'PROD' | ||
id: publish_release | ||
run: | | ||
# Get Branch Name | ||
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/}) | ||
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT | ||
# Release name | ||
RELEASE_NAME=${BRANCH_NAME#release-} | ||
curl \ | ||
-s -X POST \ | ||
-H "Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-d '{ | ||
"tag_name": "'$RELEASE_NAME'", | ||
"name": "'$RELEASE_NAME'", | ||
"body": "[Automated] Creating tag: '$RELEASE_NAME'.", | ||
"draft": false, | ||
"prerelease": false, | ||
"target_commitish": "'$BRANCH_NAME'" | ||
}' \ | ||
"https://api.github.com/repos/${{ github.repository }}/releases" | ||
- name: Update version in Ballerina.toml | ||
if: ${{ inputs.bal_central_environment == 'PROD' }} | ||
id: increment_patch_version | ||
run: | | ||
CURRENT_VERSION=$(grep -Po -m 1 '(?<=version = ")[\d.]+' ${{ inputs.working_dir }}/Ballerina.toml) | ||
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION" | ||
PATCH_VERSION=$((VERSION_PARTS[2] + 1)) | ||
NEW_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.$PATCH_VERSION" | ||
sed -i "0,/version = \"${CURRENT_VERSION}\"/s//version = \"${NEW_VERSION}\"/" ${{ inputs.working_dir }}/Ballerina.toml | ||
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_OUTPUT | ||
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_OUTPUT | ||
- name: Ballerina Build after incrementing version | ||
if: ${{ inputs.bal_central_environment == 'PROD' }} | ||
run: | | ||
pushd "${{ inputs.working_dir }}" | ||
bal pack | ||
popd | ||
- name: Commit changes and make a PR | ||
if: ${{ inputs.bal_central_environment == 'PROD' }} | ||
run: | | ||
# Extract the package name from working directory | ||
packageName=$(basename ${{ inputs.working_dir }}) | ||
# Commit changes | ||
git config --global user.name ${{ secrets.BALLERINA_BOT_USERNAME }} | ||
git config --global user.email ${{ secrets.BALLERINA_BOT_EMAIL }} | ||
git add ${{ inputs.working_dir }}/Ballerina.toml | ||
git add ${{ inputs.working_dir }}/Dependencies.toml | ||
git commit -m "[Release ${packageName} ${{ steps.increment_patch_version.outputs.CURRENT_VERSION }}] Prepare for next dev cycle" | ||
git push origin ${{ steps.publish_release.outputs.BRANCH_NAME }} | ||
# Set the base and head branches | ||
BASE_BRANCH="main" | ||
HEAD_BRANCH="${{ steps.publish_release.outputs.BRANCH_NAME }}" | ||
# Create the pull request using the GitHub REST API | ||
RESPONSE=$(curl -s -X POST \ | ||
-H "Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-d '{ | ||
"title": "[Release ${packageName} ${{ steps.increment_patch_version.outputs.CURRENT_VERSION }}] Prepare for next dev cycle", | ||
"body": "", | ||
"head": "'"$HEAD_BRANCH"'", | ||
"base": "'"$BASE_BRANCH"'" | ||
}' \ | ||
"https://api.github.com/repos/${{ github.repository }}/pulls") | ||
# Extract the pull request URL from the response | ||
PR_URL=$(echo "$RESPONSE" | jq -r '.html_url') | ||
echo "Pull Request created: $PR_URL" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: cd-swiftmt | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
bal_central_environment: | ||
description: Ballerina Central Environment | ||
type: choice | ||
options: | ||
- STAGE | ||
- DEV | ||
- PROD | ||
required: true | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build-executor.yml | ||
secrets: inherit | ||
with: | ||
working_dir: ./swiftmt | ||
bal_central_environment: ${{ inputs.bal_central_environment }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
|
||
env: | ||
FILE_PATTERN: '*/*' | ||
GITHUB_WORKFLOWS_DIR: '.github' | ||
BALLERINA_VERSION: 2201.10.1 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
JAVA_OPTS: -Xmx4G | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set Up Ballerina | ||
uses: ballerina-platform/[email protected] | ||
with: | ||
version: $BALLERINA_VERSION | ||
|
||
- name: Ballerina Build | ||
run: | | ||
pushd swiftmt | ||
bal pack | ||
popd | ||
test: | ||
runs-on: ubuntu-latest | ||
env: | ||
JAVA_OPTS: -Xmx4G | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set Up Ballerina | ||
uses: ballerina-platform/[email protected] | ||
with: | ||
version: $BALLERINA_VERSION | ||
|
||
- name: Ballerina Test | ||
run: | | ||
pushd swiftmt | ||
bal test --code-coverage | ||
popd | ||
- name: Read Ballerina Test Results | ||
id: test_results | ||
run: | | ||
# echo "TEST_RESULTS_JSON=" >> $GITHUB_OUTPUT | ||
echo "No test results file found." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# This workflow runs daily to build, test, and upload code coverage reports for Ballerina projects to Codecov. | ||
|
||
# Reason for using separate workflows per project/folder: GitHub Actions badges only show the overall status of a workflow. Separate workflows allow for individual build badges, which can be displayed on the ballerina-release-dashboard. | ||
|
||
name: daily-build-executor | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
working_dir: | ||
required: true | ||
type: string | ||
|
||
env: | ||
BALLERINA_VERSION: 2201.10.1 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
JAVA_OPTS: -Xmx4G | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set Up Ballerina | ||
uses: ballerina-platform/[email protected] | ||
with: | ||
version: $BALLERINA_VERSION | ||
|
||
- name: Ballerina Build and Test | ||
run: | | ||
pushd "${{ inputs.working_dir }}" | ||
bal build | ||
bal test --test-report --code-coverage --coverage-format=xml | ||
popd | ||
- name: Find Coverage Reports | ||
run: | | ||
FIND_REPORTS=$(find "${{ inputs.working_dir }}" -name 'coverage-report.xml' || true) | ||
if [[ $FIND_REPORTS != '' ]]; then | ||
echo "REPORTS=${FIND_REPORTS}" >> $GITHUB_ENV | ||
else | ||
echo "No coverage reports found." | ||
fi | ||
- name: Upload Coverage Reports to Codecov | ||
if: ${{env.REPORTS}} | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: true # Optional: Specify if the CI build should fail when Codecov fails. | ||
flags: ${{ inputs.working_dir }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: daily-build-swiftmt | ||
|
||
on: | ||
schedule: | ||
- cron: '00 20 * * *' # 01:30 in LK time (GMT+5:30) | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/daily-build-executor.yml | ||
secrets: inherit | ||
with: | ||
working_dir: swiftmt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.