Merge pull request #117 from NipunaRanasinghe/2201.4.x #748
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
name: CI | |
on: | |
push: | |
branches: | |
- '**' | |
repository_dispatch: | |
types: | |
check_connector_for_breaking_changes | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Ballerina Build | |
uses: ballerina-platform/ballerina-action/@2201.4.1 | |
with: | |
args: pack ./s3 | |
- name: Ballerina Test | |
uses: ballerina-platform/ballerina-action/@2201.4.1 | |
with: | |
args: test --code-coverage ./s3 | |
env: | |
ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY_ID }} | |
SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS_KEY }} | |
REGION: ${{ secrets.REGION }} | |
BUCKET_NAME: ${{ secrets.BUCKET_NAME }} | |
# Read the ballerina test results | |
- name: Read Ballerina Test Results | |
id: test_results | |
run: | | |
content=`cat ./s3/target/report/test_results.json` | |
content="${content//'%'/'%25'}" | |
content="${content//$'\n'/'%0A'}" | |
content="${content//$'\r'/'%0D'}" | |
echo "::set-output name=testResultsJson::$content" | |
# Print the code coverage information | |
- name: Code Coverage | |
run: | | |
echo "Covered Code Lines : ${{fromJson(steps.test_results.outputs.testResultsJson).coveredLines}}" | |
echo "Total Code Lines : $(expr ${{fromJson(steps.test_results.outputs.testResultsJson).missedLines}} + ${{fromJson(steps.test_results.outputs.testResultsJson).coveredLines}})" | |
echo "Code Coverage Percentage : ${{fromJson(steps.test_results.outputs.testResultsJson).coveragePercentage}}" | |
- name: Alert notifier on failure | |
if: failure() && (github.event.action == 'check_connector_for_breaking_changes') | |
run: | | |
curl -X POST \ | |
'https://api.github.com/repos/ballerina-platform/ballerina-release/dispatches' \ | |
--header 'Accept: application/vnd.github.v3+json' \ | |
--header 'Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}' \ | |
--data-raw '{ | |
"event_type": "notify-ballerinax-connector-build-failure", | |
"client_payload": { | |
"repoName": "module-ballerinax-aws.s3", | |
"workflow": "CI" | |
} | |
}' |