-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Explicitly run coveralls step #2306
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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,30 @@ | ||
steps: | ||
- script: npm i -g npm@$(npm_version) | ||
displayName: Use legacy npm version $(npm_version) | ||
condition: ne(variables['npm_version'], '') | ||
|
||
- task: NodeTool@0 | ||
inputs: | ||
versionSpec: '$(node_version)' | ||
displayName: Use Node $(node_version) | ||
|
||
- script: npm install | ||
displayName: npm install | ||
|
||
- script: istanbul cover _mocha --report lcovonly && istanbul-coveralls | ||
env: | ||
COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN_SECRET) | ||
displayName: Run coveralls | ||
condition: eq(variables['run_coveralls'], true) | ||
|
||
- script: npm test | ||
displayName: Run tests | ||
condition: ne(variables['run_coveralls'], true) | ||
|
||
- script: npm run azure-pipelines | ||
displayName: Write tests to xml | ||
|
||
- task: PublishTestResults@2 | ||
inputs: | ||
testResultsFiles: '**/test.xunit' | ||
condition: succeededOrFailed() |
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,72 @@ | ||
trigger: | ||
- master | ||
- releases/* | ||
|
||
jobs: | ||
- job: Test_Linux | ||
displayName: Run Tests on Linux | ||
pool: | ||
vmImage: "Ubuntu 16.04" | ||
variables: | ||
run_coveralls: true | ||
strategy: | ||
matrix: | ||
Node_v10: | ||
node_version: 10 | ||
Node_v8: | ||
node_version: 8 | ||
Node_v6: | ||
node_version: 6 | ||
Node_v4: | ||
node_version: 4 | ||
Node_v0_12: | ||
node_version: 0.12 | ||
Node_v0_10: | ||
node_version: 0.10 | ||
steps: | ||
- template: .azure-pipelines-steps.yml | ||
|
||
- job: Test_Windows | ||
displayName: Run Tests on Windows | ||
pool: | ||
vmImage: vs2017-win2016 | ||
strategy: | ||
matrix: | ||
Node_v10: | ||
node_version: 10 | ||
Node_v8: | ||
node_version: 8 | ||
Node_v6: | ||
node_version: 6 | ||
Node_v4: | ||
node_version: 4 | ||
npm_version: 2 | ||
Node_v0_12: | ||
node_version: 0.12 | ||
npm_version: 2 | ||
Node_v0_10: | ||
node_version: 0.10 | ||
npm_version: 2 | ||
steps: | ||
- template: .azure-pipelines-steps.yml | ||
|
||
- job: Test_MacOS | ||
displayName: Run Tests on MacOS | ||
pool: | ||
vmImage: macos-10.13 | ||
strategy: | ||
matrix: | ||
Node_v10: | ||
node_version: 10 | ||
Node_v8: | ||
node_version: 8 | ||
Node_v6: | ||
node_version: 6 | ||
Node_v4: | ||
node_version: 4 | ||
Node_v0_12: | ||
node_version: 0.12 | ||
Node_v0_10: | ||
node_version: 0.10 | ||
steps: | ||
- template: .azure-pipelines-steps.yml |
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 |
---|---|---|
|
@@ -29,3 +29,6 @@ node_modules | |
|
||
# Garbage files | ||
.DS_Store | ||
|
||
# Test results | ||
xunit.xml |
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
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.
I know I'm being a little paranoid here but what would happen if someone changed the
package.json
to pointistanbul
oristanbul-coveralls
at some git repository that replaced the commands with something that dumped the env?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.
Can someone do that? My understanding of how npm works is that it makes that sort of behavior impossible. They'd have to change the dependency name in
package.json
at which point it would no longer be added to the path asIstanbul
orIstanbul-coveralls
, it would get added as something else.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.
I'm allowed to do something like:
And as long as "malicious-package" contained an
istanbul
bin, it'd run.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.
Maybe this step needs to forcefully install the packages from npm. We can probably achieve that by using
npx --ignore-existing istanbul && npx --ignore-existing istanbul-coveralls
- Thoughts?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.
Ah, I see what you mean now - I guess that could be an issue. I think that solution should work in theory, I'm having a bit of trouble getting it to work though because it looks like npx doesn't work correctly on lower versions of npm or Node - see build here.
We can keep looking for a solution here, to be honest I'm not sure how necessary this is though. I don't think there's anything a malicious actor could do with this token outside of messing with your code coverage results - the work to do that seems to far outweighs the benefits, especially since you can just regen the token and delete the bad builds. In the codecov docs they don't even recommend keeping it as a secret variable even though this would affect all CI's outside of Travis and I think most repos that use this without Travis just keep it as plaintext.
If you want I can keep trying to tweak npx though, I'm happy to continue to work on this if we think its worthwhile. Just don't want to overcomplicate things if we don't need to.