Rebuild-Black-Business / RBB-Website

Website to help connect black-owned businesses with consumers and resources
https://www.rebuildblackbusiness.com/
MIT License
118 stars 72 forks source link

add cypress ci github action #244

Closed jamiebuilds closed 4 years ago

jamiebuilds commented 4 years ago

Describe your PR

Adding cypress integration tests to CI on pull requests

Pages/Interfaces that will change

None

Steps to test

  1. Might have to create a new PR to see if it actually runs

Additional notes

(Gonna see if it just works on this PR, I've never tried this on GitHub PRs before)

netlify[bot] commented 4 years ago

Deploy request for rebuild-black-business accepted.

Accepted with commit 9a8f9dc74131028d389b8f3c0264ce891902cdd6

https://app.netlify.com/sites/rebuild-black-business/deploys/5ee30892d735340008b1144f

racedale commented 4 years ago

This is the issue we ran into for context

With the exception of GITHUB_TOKEN, secrets are not passed to the runner when a workflow is triggered from a forked repository.

racedale commented 4 years ago

There's also probably a few secrets that need added/updated. I just updated the AIRTABLE_API_KEY and added another for AIRTABLE_BASE_ID. Not sure how many are actually needed to get Cypress connected

jamiebuilds commented 4 years ago

@racedale Okay, how about I try this in two stages then. Right now it ran a couple of the tests just fine. But the a11y test needs the airtable token. I can omit that test from CI for now and work on that in a separate PR

jamiebuilds commented 4 years ago

Oh lol, missed a lot of the test results, I thought only one of them failed. Will dig more

racedale commented 4 years ago

It looks like the API key is required to connect to Airtable comes just from Gatsby trying to start up. I recommend starting on just the navigation tests, those should be able to be passing

jamiebuilds commented 4 years ago

Hm, it kinda sounds like this repo actually need a merge queue like https://bors.tech/ which can run CI actions prior to merge. By having you approve a pull request before it runs privileged CI processes, you can protect your secrets and ensure that everything you are merging is safe.

I can help you set that up if you'd like, but we should probably do it over a video call.

jamiebuilds commented 4 years ago

I don't actually have it setup in a repo right now but this is vaguely what it looks like:

Comment on PR to merge bors r+

Do this instead of clicking "merge"

Screen Shot 2020-06-11 at 10 18 57 PM

Dashboard of pending merges

Bors does everything in "batches" so it avoids long queues building up with lots of PRs being merged.

Screen Shot 2020-06-11 at 10 19 02 PM

Creates a branch with changes

Since this is a branch that lives in the repo, it will be privileged.

Screen Shot 2020-06-11 at 10 22 47 PM

racedale commented 4 years ago

Before setting up Bors I first setup Circle CI to run the builds in #257 . I has the ability to provide secrets to forked PR's unlike GitHub actions so it's working for now. May look into adding Bors in the future though!