Skip to content
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

[Pulsar] Add Pulsar Badges for Stargazers & Downloads #8767

Merged
merged 11 commits into from
Aug 15, 2023

Conversation

confused-Techie
Copy link
Contributor

Hello folks, first time submitting a PR to this repo, so hopefully I've considered and followed all Contributing Guidelines.

But this PR adds badges for the Pulsar-Edit or Pulsar Package Registry Server.

Adding the following endpoints and Badges:

  • pulsar-edit/downloads/:packageName: To get a Packages Download Count
  • pulsar-edit/stargazers/:packageName: To get a Packages Stargazers Count

Pulsar is the emergent fork of Atom, and these badges now replace the apm badges for our service, which it may be worth removing the apm badges as they all no-longer work (But outside the scope of this PR).

Unfortunately I was unable to run the test suite locally on my machine and had to rely on GitHub Actions to test due to Issue #8437 and will add a comment to that issue as well, that the service tests do not run on Windows for me either.

But please provide any feedback as needed, and thanks for any time spent reviewing this!

@shields-ci
Copy link

shields-ci commented Jan 2, 2023

Messages
📖 ✨ Thanks for your contribution to Shields, @confused-Techie!

Generated by 🚫 dangerJS against d8f531f

@confused-Techie
Copy link
Contributor Author

confused-Techie commented Jan 2, 2023

Apparently, the test runner is unable to find my test suite, does it maybe not like the dash? Although it looks like eclipse-marktetplace got by with a dash, although the PR adding that doesn't show the tests that were run on it since it was a while ago.

If anyone has some pointers on what's causing the tests to be missing, I'd appreciate it

@github-actions
Copy link
Contributor

github-actions bot commented Jan 11, 2023

Messages
📖 ✨ Thanks for your contribution to Shields, @confused-Techie!

Generated by 🚫 dangerJS against 1dd2a88

@confused-Techie
Copy link
Contributor Author

Not sure why danger is failing to run after just merging in the main branch. A tad confusing, but I'll look at trying to get a Linux machine setup to see if I can run tests there, since I'm unable to run the test suite on Windows. So hopefully I can get the tests running on this PR

@calebcartwright
Copy link
Member

Odd. We have been in the process of converting our existing CI processes over to GitHub Actions, so the failure could be unrelated to your changes

@calebcartwright calebcartwright changed the title [Pulsar-Edit] Add Pulsar Badges for Stargazers & Downloads [PulsarEdit] Add Pulsar Badges for Stargazers & Downloads Jan 14, 2023
@calebcartwright calebcartwright added the service-badge New or updated service badge label Jan 14, 2023
@calebcartwright
Copy link
Member

Tests are running now, with failure details available at the link + inline below. The test runner framework by default is driven off the class name, so the hyphen is unnecessary unless the tester has been explicitly wired up in a different way.

https://app.circleci.com/pipelines/github/badges/shields/16711/workflows/b394e94a-c118-4411-af40-4914ddbb6a86/jobs/201806/tests#failed-test-0

2 tests failed  out of 4
Test Insights
New

PulsarEditDownloads [live] pulsar-edit downloads (not found) [ GET /test-package.json ]
[ GET /test-package.json ]
/home/circleci/project/core/service-test-runner/cli.js

AssertionError: color mismatch: expected 'red' to equal '#662d91'
    at Function._expectField (file:///home/circleci/project/core/service-test-runner/icedfrisby-shields.js:85:51)
    at IcedFrisbyNock.<anonymous> (file:///home/circleci/project/core/service-test-runner/icedfrisby-shields.js:73:26)
    at IcedFrisbyNock.<anonymous> (node_modules/icedfrisby/lib/icedfrisby.js:954:10)
    at invokeNextHook (node_modules/icedfrisby/lib/icedfrisby.js:1003:24)
    at /home/circleci/project/node_modules/icedfrisby/lib/icedfrisby.js:1017:7
    at new Promise (<anonymous>)
    at IcedFrisbyNock._runHooks (node_modules/icedfrisby/lib/icedfrisby.js:976:12)
    at IcedFrisbyNock.run (node_modules/icedfrisby/lib/icedfrisby.js:1276:20)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Context.<anonymous> (node_modules/icedfrisby/lib/icedfrisby.js:1348:9)

      + expected - actual

      -red
      +#662d91

PulsarEditStargazers [live] pulsar-edit stargazers (not found) [ GET /test-package.json ]
[ GET /test-package.json ]
/home/circleci/project/core/service-test-runner/cli.js

AssertionError: color mismatch: expected 'red' to equal '#662d91'
    at Function._expectField (file:///home/circleci/project/core/service-test-runner/icedfrisby-shields.js:85:51)
    at IcedFrisbyNock.<anonymous> (file:///home/circleci/project/core/service-test-runner/icedfrisby-shields.js:73:26)
    at IcedFrisbyNock.<anonymous> (node_modules/icedfrisby/lib/icedfrisby.js:954:10)
    at invokeNextHook (node_modules/icedfrisby/lib/icedfrisby.js:1003:24)
    at /home/circleci/project/node_modules/icedfrisby/lib/icedfrisby.js:1017:7
    at new Promise (<anonymous>)
    at IcedFrisbyNock._runHooks (node_modules/icedfrisby/lib/icedfrisby.js:976:12)
    at IcedFrisbyNock.run (node_modules/icedfrisby/lib/icedfrisby.js:1276:20)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Context.<anonymous> (node_modules/icedfrisby/lib/icedfrisby.js:1348:9)

      + expected - actual

      -red
      +#662d91

@confused-Techie
Copy link
Contributor Author

@calebcartwright Thanks a ton for providing some feedback and working out the test issue for me!

I'll get right on those changes, and glad to hear I didn't do something crazy causing that other test to fail. Appreciate your time!

@confused-Techie
Copy link
Contributor Author

@calebcartwright (I apologize if you are the wrong person to ping, or if the ping is unnecessary)
But wanted to add with your help the tests are now running and passing!

Was trying to expect the badges colour when the service returns a 404, but seems that no other badges do this, which I'm assuming the colour on failure is being set somewhere else in the application rather the my badges render method. So my bad there and this one should be good to check out, thanks again for your help!

@chris48s
Copy link
Member

The issue with danger is unrelated. I thought everything was just using API calls but there must be something in our dangerfile that is working out the list of changed files from the API and then tries to open some of the files in the PR from the local filesystem, which then fails because they're not checked out on the pull_request_target event sigh. I can't see immediately what it is, but I'll try to work it out tomorrow.

@calebcartwright
Copy link
Member

Thank you for the PR, now that all the tests & CI checks are passing we should be able to begin the review process.

Although we do not strictly require PRs have an associated issue, in cases like this where a new badge is being proposed absent an issue we'd still like to get the details and answers to the questions we pose as part of fielding new badge requests.

Sharing them inline below to streamline things, please follow up with responses whenever you get a chance!

Description

  • Which service is this badge for e.g: GitHub, Travis CI
  • What sort of information should this badge show?
  • Provide an example in plain text e.g: "version | v1.01" or as a static badge (static badge generator can be found at https://shields.io/#your-badge )

Where can we get the data from?

Please consider and cover details like:

  • Is there a public API?
  • Does the API require authentication or an API key? (If so, please review our documentation on Badges Requiring Authentication)
  • Link to the API documentation.

@confused-Techie
Copy link
Contributor Author

@calebcartwright Of course, apologies if this was not good form but here are the answers to those questions:

Also I appreciate you sorting out these testing issues and getting to my PR in such a timely manner

Description

  • These two badges are for the Pulsar Package Registry, otherwise the Package Registry for Pulsar. Pulsar is the newly developed fork of Atom. Of which the Pulsar Team has created the Pulsar Package Registry to fill in for what APM or the Atom.io servers once did, and that is allow the Pulsar/Atom community to publish, share and distribute their packages. So essentially this is for the new rebirth of Atom after it's sunset.
  • There are two badges here showing two different things. They are the "Download" count of a community package, and the other shows the "Stars" for that community package.
  • For downloads: downloads | 1,101 ... And for Stars (Or Stargazers) stargazers | 100
    downloads
    stagazers

Where can we get the data from?

  • Yes the API is Public, currently it exactly matches Atom's previous API to maintain compatibility, but even when changes occur the API will remain public
  • While some endpoints require authentication the endpoints used here do not require any kind of authentication, and are only subject to reasonable rate limiting per IP
  • Documentation: The most up to date documentation for the Pulsar Package Registry can be found here as this is a file generated from the source code. Additionally we have a swagger instance hosted alongside the API. (This one is manually updated, so may be slightly behind on the most recent changes)

Since I know Pulsar is a newer platform and service here's some links if you'd like to verify more:

@calebcartwright
Copy link
Member

That helps a lot, thanks! Last question before really diving into the code, but based on the commentary in this thread and the material on the links you posted I get the impression that "Pulsar" is the truer name & nomenclature that will most resonate with users, and I imagine the "edit" portion was just added in places where necessary for distinction (e.g. domain). Is that fair/accurate, or is the service/platform/etc. name indeed PulsarEdit/Pulsar-Edit?

If it's the former then we should update the naming utilized here as well to simply reflect Pulsar

@confused-Techie
Copy link
Contributor Author

That helps a lot, thanks! Last question before really diving into the code, but based on the commentary in this thread and the material on the links you posted I get the impression that "Pulsar" is the truer name & nomenclature that will most resonate with users, and I imagine the "edit" portion was just added in places where necessary for distinction (e.g. domain). Is that fair/accurate, or is the service/platform/etc. name indeed PulsarEdit/Pulsar-Edit?

If it's the former then we should update the naming utilized here as well to simply reflect Pulsar

Hm. That is a good point. The way we have essentially used it is Pulsar-Edit is the organization, meanwhile Pulsar is the editor itself.

But you have a good point that Pulsar may resonate more-so with the community of users as this is more recognizable as our naming. And talking quickly with other Pulsar devs seems they agree with your assessment.

I'll go ahead and get to those changes here, and ping once done. Thanks!

@confused-Techie confused-Techie changed the title [PulsarEdit] Add Pulsar Badges for Stargazers & Downloads [Pulsar] Add Pulsar Badges for Stargazers & Downloads Jan 23, 2023
@confused-Techie
Copy link
Contributor Author

@calebcartwright I've gone ahead with the rename, and am now simply using Pulsar in all locations here. Thanks for the assistance and feedback

@confused-Techie
Copy link
Contributor Author

Please feel free to let me know if there's anything I can do to further help this PR, such as updating it to the latest changes on master or any other information.

Otherwise appreciate any attention it's gotten so far!

@confused-Techie
Copy link
Contributor Author

Again feel free to let me know if you'd like me to update this from the master branch or do anything else to get it in a prime position. Appreciate any feedback. Thanks.

Copy link
Member

@PyvesB PyvesB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution and sorry for the long wait @confused-Techie. Mostly looks good to me, a couple of changes and I think we'll be ready to go. 😉

services/pulsar/pulsar-downloads.service.js Outdated Show resolved Hide resolved
services/pulsar/pulsar-downloads.service.js Outdated Show resolved Hide resolved
@confused-Techie
Copy link
Contributor Author

@PyvesB Thanks a ton for the review, I've gone ahead and made the requested choices.

Feel free to let me know if everything looks good.

Copy link
Member

@PyvesB PyvesB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me! 👍🏻

@PyvesB PyvesB added this pull request to the merge queue Aug 15, 2023
Merged via the queue into badges:master with commit d73a5eb Aug 15, 2023
19 checks passed
@confused-Techie
Copy link
Contributor Author

Thanks, looks good to me! 👍🏻

Thanks a ton for reviewing and getting this approved. Appreciate you!

@PyvesB
Copy link
Member

PyvesB commented Aug 15, 2023

You're welcome! Sorry this probably took longer than you'd have expected. It's a big project with many external requests and contributions, and only a small handful of maintainers dedicating their time for free. Sometimes it's just a matter of being patient and waiting for the PR to pique of the maintainers' interest. :)

I've gone ahead and deployed this to production, e.g. . Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge New or updated service badge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants