Getting Github Actions CI to Run Your Rspec Tests - rubyforgood/casa GitHub Wiki

It's usually faster to run tests locally but sometimes you might want to let github actions run your test.

Reduce RSpec run time

The Rspec job takes about 6 minutes to run by default.
The first thing you want to do is limit rspec to run only your relevant test file.
Open .github/workflows/rspec.yml and edit bundle exec rspec to bundle exec rspec <path to your test file>
Commit and Push.
Now the rspec job for your pull request will only take around 2 minutes.
Don't forget to change the workflow file back in your last commit.

Squashing Commits

If you can only run tests on github workflows, there may be many commits in a row attempting to do the same thing.
Ideally we would like overall changes made by these commits to be under the same commit so the commit history is easier to read. This is what squashing commits accomplishes.
It's easiest to squash as you go.
Lets say you had 3 commits all trying to do the same thing and the latest commit was the only successful one.
You would run

git reset --soft HEAD~3 &&
git commit

to squash the commits.