-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup for L0 Testcases #6
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2f3751f
SetUp for L0 TestCases
rgsubh 754444a
Issue Fix
rgsubh e9392bc
Issue Fix
rgsubh 7f8240f
Issue Fix
rgsubh 0439767
Issue Fix
rgsubh bb74f7f
Issue Fix
rgsubh 86c45b1
Issue Fix
rgsubh 00c14b2
Review comments fix: run npm install only with our build, npm install…
rgsubh 0bd0f9e
Running code covrage only on PR of master and releases
rgsubh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,68 @@ | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- 'releases/*' | ||
|
||
jobs: | ||
build_test_job: | ||
name: 'Build and test job' | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [windows-latest, ubuntu-latest, macos-latest] | ||
steps: | ||
|
||
- name: 'Checking out repo code' | ||
uses: actions/checkout@v1 | ||
|
||
- name: 'Validate build' | ||
run: | | ||
npm install | ||
npm build | ||
- name: 'Run L0 tests' | ||
run: | | ||
npm run test | ||
- name : 'Run test coverage' | ||
if: runner.os == 'Windows' | ||
env: | ||
PR_NUMBER: ${{ github.event.pull_request.number }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
$coverage_result = npm run test-coverage | ||
$start = $false; | ||
$middle = $false; | ||
$end = $false; | ||
$count = 0; | ||
|
||
foreach ($j in $coverage_result) | ||
{ | ||
if ($j.tostring().startswith("----------")) | ||
{ | ||
if (!$start) | ||
{ | ||
$start = $true; | ||
$start_index = $count | ||
} | ||
elseif (!$middle) | ||
{ | ||
$middle = $true; | ||
} | ||
elseif (!$end) | ||
{ | ||
$end = $true; | ||
$end_index = $count | ||
} | ||
} | ||
$count++ | ||
} | ||
|
||
$tbl_md = $coverage_result[($start_index+1)..($end_index-1)] -join "\n" | ||
$summary = $coverage_result[($end_index + 1)..$count] -join "\n" | ||
$comment = $tbl_md + "\n" + $summary | ||
$url = "https://api.github.com/repos/${env:GITHUB_REPOSITORY}/issues/${env:PR_NUMBER}/comments" | ||
$headers = @{ | ||
"Authorization" = "token ${env:GITHUB_TOKEN}" | ||
} | ||
Invoke-RestMethod -Method POST -Uri $url -Headers $headers -Body "{ `"body`": `"${comment}`" }" | ||
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 |
---|---|---|
|
@@ -327,3 +327,4 @@ ASALocalRun/ | |
|
||
# MFractors (Xamarin productivity tool) working folder | ||
.mfractor/ | ||
node_modules |
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,7 @@ | ||
import {run} from '../src/run' | ||
|
||
describe('This is a placeholder for intial test cases, to be removed', () => { | ||
test('Dummy test case', async () => { | ||
await expect(run()).rejects.toThrow(); | ||
}) | ||
}) |
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,18 @@ | ||
module.exports = { | ||
clearMocks: true, | ||
moduleFileExtensions: ['js', 'ts'], | ||
testEnvironment: 'node', | ||
testMatch: ['**/*.test.ts'], | ||
transform: { | ||
'^.+\\.ts$': 'ts-jest' | ||
}, | ||
verbose: true, | ||
coverageThreshold: { | ||
"global": { | ||
"branches": 0, | ||
"functions": 14, | ||
"lines": 27, | ||
"statements": 27 | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -4,7 +4,9 @@ | |
"private": true, | ||
"main": "lib/run.js", | ||
"scripts": { | ||
"build": "tsc --outDir .\\lib\\ --rootDir .\\src\\" | ||
"build": "tsc --outDir .\\lib\\ --rootDir .\\src\\", | ||
"test": "jest", | ||
"test-coverage": "jest --coverage" | ||
}, | ||
"keywords": [ | ||
"actions", | ||
|
@@ -19,6 +21,10 @@ | |
"@actions/tool-cache": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^12.0.4" | ||
"@types/node": "^12.0.4", | ||
"jest": "^26.0.1", | ||
"@types/jest": "^25.2.2", | ||
"ts-jest": "^25.5.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
"typescript": "3.9.2" | ||
} | ||
} |
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
"module": "commonjs" | ||
}, | ||
"exclude": [ | ||
"node_modules" | ||
"node_modules", | ||
"__tests__" | ||
] | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comments as Azure/k8s-set-context#8