realworld icon indicating copy to clipboard operation
realworld copied to clipboard

[Feature Request]: Github Action for checking backend API compliance

Open AndreasHae opened this issue 2 years ago • 2 comments

Relevant Scope

Backend specs

Description

Right now, the process of checking API compliance within your CI pipeline (as you should) is a bit tedious to set up. You have to manually copy the Postman collection and the run-api-tests.sh script and integrate it into your pipeline which involves some trial and error.

Furthermore, once the API spec evolves, there's really no way for me as an implementation maintainer to find out other than periodically checking the repository and copying the new endpoint definitions if they changed.

I believe it's in this project's interest to make this process as frictionless as possible to ensure that implementations are always compliant with the spec.

Describe the solution you'd like

Creating a Github action would be the perfect way to make this process super simple, as it removes the need to manually copy the test files and keep them up to date. The way I imagine it, you could pass the following parameters:

  • Spec version (latest by default)
  • All parameters of test script (base url, email, etc.)

Using a Github action for this purpose could also enable a more complex test suite than a Postman collection because setting it up would not be the maintainers' responsibility anymore, other than including the action in their workflows.

Describe alternatives you've considered

Other CI providers with custom actions like CircleCI could also be considered, but I think Github Actions would be the most obvious choice because most (if not all) realworld implementations are on Github and it's the least hassle to set up.

AndreasHae avatar Mar 26 '22 15:03 AndreasHae

Hey @AndreasHae,

I agree but couldn't find enough time to work on it. With the current situation, not only do you need to retrieve the collection but to run it but it requires NodeJS as well.

I'll create a dedicated GitHub Action.

Why would the collection not be the maintainer' responsibility anymore?

geromegrignon avatar Apr 02 '22 07:04 geromegrignon

Hi @geromegrignon,

What I meant is that the collection itself would be updated by realworld project members whenever there's an API spec change. This way, developers don't have to manually check for spec changes, they just need to make sure the action is up-to-date, which can be automated by tools like dependabot. Of course it would still be their responsibility to keep the project up-to-date with new API changes

AndreasHae avatar Apr 23 '22 10:04 AndreasHae