I currently have an Angular frontend and a dockerized Django backend. Both are deployed separately. Angular via Netlify and Django via Heroku. Both are triggered to deploy any publishes to the master branch.
I've written end to end tests using Cypress and integrated it to the CI using GitHub actions. At the moment I ended up deploying a test backend server which is a replica of the production on a separate Heroku instance and am using that link as the backend for the cypress test suite that lives inside the UI repo and runs every time before pushing to master. To be more specific, whenever I need to publish changes, I push to staging and on push to staging, the CI workflow is triggered and runs the test and if the tests pass, the changes to staging get merged with master and from there changes are automatically deployed. The backend gets published to production without any prior testing.
There are two problems with this setup. First is that for the CI to rely on an external API is time consuming. Second thing is that for me to push changes to the API without the e2e suite running and having it only be run when corresponding UI changes get published is sort of problematic because breaking changes to the API could get published unchecked.
Is there a more elegant way to do this within GitHub actions? Because I find it convenient. If not, what other solution do I have to address these 2 issues?