-
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.
- Loading branch information
Siyaram Meena
committed
Sep 4, 2024
1 parent
bfc62c6
commit a226a45
Showing
5 changed files
with
122 additions
and
175 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 |
---|---|---|
@@ -1,49 +1,49 @@ | ||
#name: Check Code Coverage | ||
# | ||
#on: | ||
# push: | ||
# branches: | ||
# - main | ||
# paths-ignore: | ||
# - '**.md' | ||
# pull_request: | ||
# branches: | ||
# - main | ||
# paths-ignore: | ||
# - '**.md' | ||
# workflow_dispatch: | ||
# | ||
#jobs: | ||
# code-coverage: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# | ||
# - name: Set Node.js 20.x | ||
# uses: actions/setup-node@v4 | ||
# with: | ||
# node-version: 20.x | ||
# | ||
# - name: Install dependencies | ||
# run: cd synopsys-task && npm ci | ||
# | ||
# - name: Unit Test Cases | ||
# id: unit-test-cases | ||
# shell: bash | ||
# run: | | ||
# cd synopsys-task && npm run test | ||
# coverageFile="coverage/index.html" | ||
# | ||
# ### fetching line coverage from coverage/index.html file | ||
# coverageSpan=$(grep -B 1 '<span class="quiet">Lines</span>' $coverageFile | head -n 1) | ||
# coverageHtml=$(echo "$coverageSpan" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') | ||
# coverageInPercent=$(echo $coverageHtml | sed -n 's/.*<span class="strong">\([0-9.]*%\).*/\1/p' | tr -d ' ') | ||
# echo "Line Coverage: $coverageInPercent" | ||
# | ||
# ### remove percentage sign from coverageInPercent and convert to a floatin-point number | ||
# coverageValue=$(echo "$coverageInPercent" | tr -d '%' | sed 's/,/./g') | ||
# ### check if the coverage is below 90% | ||
# if [[ $coverageValue < 90 ]]; then | ||
# echo "##[error]Line coverage is below 90%" | ||
# exit 1 | ||
# fi | ||
name: Check Code Coverage | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- '**.md' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
code-coverage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set Node.js 20.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: Install dependencies | ||
run: cd synopsys-task && npm ci | ||
|
||
- name: Unit Test Cases | ||
id: unit-test-cases | ||
shell: bash | ||
run: | | ||
cd synopsys-task && npm run test | ||
coverageFile="coverage/index.html" | ||
### fetching line coverage from coverage/index.html file | ||
coverageSpan=$(grep -B 1 '<span class="quiet">Lines</span>' $coverageFile | head -n 1) | ||
coverageHtml=$(echo "$coverageSpan" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') | ||
coverageInPercent=$(echo $coverageHtml | sed -n 's/.*<span class="strong">\([0-9.]*%\).*/\1/p' | tr -d ' ') | ||
echo "Line Coverage: $coverageInPercent" | ||
### remove percentage sign from coverageInPercent and convert to a floatin-point number | ||
coverageValue=$(echo "$coverageInPercent" | tr -d '%' | sed 's/,/./g') | ||
### check if the coverage is below 90% | ||
if [[ $coverageValue < 90 ]]; then | ||
echo "##[error]Line coverage is below 90%" | ||
exit 1 | ||
fi |
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 |
---|---|---|
@@ -1,54 +1,54 @@ | ||
## `dist/index.js` is a special file in Actions. | ||
## When you reference an action with `uses:` in a workflow, | ||
## `index.js` is the code that will run. | ||
## For our project, we generate this file through a build process from other source files. | ||
## We need to make sure the checked-in `index.js` actually matches what we expect it to be. | ||
#name: Check dist/ | ||
# | ||
#on: | ||
# push: | ||
# branches: | ||
# - main | ||
# paths-ignore: | ||
# - '**.md' | ||
# pull_request: | ||
# branches: | ||
# - main | ||
# paths-ignore: | ||
# - '**.md' | ||
# workflow_dispatch: | ||
# | ||
#jobs: | ||
# check-dist: | ||
# runs-on: ubuntu-latest | ||
# | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# | ||
# - name: Set Node.js 20.x | ||
# uses: actions/setup-node@v4 | ||
# with: | ||
# node-version: 20.x | ||
# | ||
# - name: Install dependencies | ||
# run: cd synopsys-task && npm ci | ||
# | ||
# - name: Rebuild the dist/ directory | ||
# run: cd synopsys-task && npm run build && npm run package | ||
# | ||
# - name: Compare the expected and actual dist/ directories | ||
# run: | | ||
# cd synopsys-task | ||
# if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then | ||
# echo "Detected uncommitted changes after build. See status below:" | ||
# git diff | ||
# exit 1 | ||
# fi | ||
# id: diff | ||
# | ||
# # If index.js was different than expected, upload the expected version as an artifact | ||
# - uses: actions/upload-artifact@v3 | ||
# if: ${{ failure() && steps.diff.conclusion == 'failure' }} | ||
# with: | ||
# name: dist | ||
# path: synopsys-task/dist/ | ||
# `dist/index.js` is a special file in Actions. | ||
# When you reference an action with `uses:` in a workflow, | ||
# `index.js` is the code that will run. | ||
# For our project, we generate this file through a build process from other source files. | ||
# We need to make sure the checked-in `index.js` actually matches what we expect it to be. | ||
name: Check dist/ | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- '**.md' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
check-dist: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set Node.js 20.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: Install dependencies | ||
run: cd synopsys-task && npm ci | ||
|
||
- name: Rebuild the dist/ directory | ||
run: cd synopsys-task && npm run build && npm run package | ||
|
||
- name: Compare the expected and actual dist/ directories | ||
run: | | ||
cd synopsys-task | ||
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then | ||
echo "Detected uncommitted changes after build. See status below:" | ||
git diff | ||
exit 1 | ||
fi | ||
id: diff | ||
|
||
# If index.js was different than expected, upload the expected version as an artifact | ||
- uses: actions/upload-artifact@v3 | ||
if: ${{ failure() && steps.diff.conclusion == 'failure' }} | ||
with: | ||
name: dist | ||
path: synopsys-task/dist/ |
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
extension_version=2.2.8 | ||
published_extension_version=2.2.8 |