gocodebox / .github

0 stars 1 forks source link

Migrate from Travis to GitHub Actions #21

Open thomasplevy opened 2 years ago

thomasplevy commented 2 years ago

Alright... we're close enough to everything working that I'm ready to enlist y'all to help get us switched from Travis to GH actions and over to using update WP core utilities for phpunit testing.

Go through your plugins and update/add a codeowners file while you're at it

Updates to be made:

thomasplevy commented 2 years ago

How to create a status badge for a GH Action Workflow:

https://user-images.githubusercontent.com/1290739/135891932-50399ba3-ab6f-498b-a484-bc0e3c44cb58.mp4

pondermatic commented 2 years ago

Create the CC_TEST_REPORTER_ID repository secret

What should the value be?

@thomasplevy, I do not see the "Settings" menu item for any of the gocodebox projects.

From GitHub Encrypted secrets page:

To create secrets for a user account repository, you must be the repository owner. To create secrets for an organization repository, you must have admin access.

thomasplevy commented 2 years ago

@pondermatic I'll add them. i didn't realize secrets were only available to repo owner .

pondermatic commented 2 years ago

Should the .github directory also be in the dev branch, or just the trunk branch? The mail chimp plugin doesn't have it in the dev branch and it looks like Workflow Sync Bot added it to trunk .

thomasplevy commented 2 years ago

In almost all scenarios we want to move dev -> trunk but the workflow bot goes straight to trunk because it deploys not distributed files (workflows). One day I'll make a workflow to sync trunk to dev when we push changes directly there: https://github.com/gocodebox/.github/issues/19

For this particular project it's "safe" to push right to trunk and once the changes are ready sync those over to dev manually

thomasplevy commented 2 years ago

(or do dev first and then sync to trunk if you're more comfortable with that)

thomasplevy commented 2 years ago

@gocodebox/engineering CC_TEST_REPORTER_ID secret added to all the repos in question and I've updated the test coverage job to be skipped if the secret isn't present (as is the case when running checks on a PR from a fork)

pondermatic commented 2 years ago

I tried to push commits to the trunk branch of gocode/lifterlms-assignments and got error: GH006: Protected branch update failed for refs/heads/trunk..

thomasplevy commented 2 years ago

The branch requires signed commits, are your commits not signed?

pondermatic commented 2 years ago

The branch requires signed commits, are your commits not signed?

I set up a GPG key with GitHub and all my recent commits have a "Verified" button in GitHub. "This commit was signed with the committer’s verified signature."

However, when I use the git log --show-signature command, my commits do not show GPG info and yours and Rocco's do. Looks like there's more to configure.

BTW, do we have a place to store our public keys? 1Password maybe?

pondermatic commented 2 years ago

My commits to my local trunk branch of gocode/lifterlms-assignments are signed with a key that is registered with GitHub. However, I get this when I push to origin.

remote: error: GH006: Protected branch update failed for refs/heads/trunk.
remote: error: 4 of 4 required status checks are expected.
To https://github.com/gocodebox/lifterlms-assignments.git
! [remote rejected] trunk -> trunk (protected branch hook declined)
error: failed to push some refs to 'https://github.com/gocodebox/lifterlms-assignments.git'
pondermatic commented 2 years ago

I am able to push signed (and unsigned) commits to the trunk branch of gocodebox/lifterlms-mailchimp.

When I setup signing keys a few weeks ago, I didn't update my global git config to automatically GPG sign all my commits. Even though GitHub shows commits during the past few weeks as "verified", they were not GPG signed. They will be going forward.

eri-trabiccolo commented 2 years ago

@gocodebox/engineering https://github.com/gocodebox/lifterlms-integration-formidable-forms doesn't have any unit tests at all, no composer scripts no nothing. I just added the CODEOWNERS file and gitignored composer.lock (which btw, doesn't exist).

pondermatic commented 2 years ago

Once we get GitHub workflows to run successfully, should we delete the failed runs?

eri-trabiccolo commented 2 years ago

Once we get GitHub workflows to run successfully, should we delete the failed runs?

I was for the "I don't care" mode on :P eheh

pondermatic commented 2 years ago

For this particular project it's "safe" to push right to trunk and once the changes are ready sync those over to dev manually

In gocodebox/lifterlms-pdfs, I pushed commits to trunk and then cherry picked those commits to dev. The commits have different hashes between trunk and dev. I assumed they would be the same. GitHub suggests that I merge dev to trunk and confusingly the compare looks like the commits to trunk aren't there.

Please help me @gocodebox/engineering. You are my only hope.

eri-trabiccolo commented 2 years ago

@pondermatic fast way, to me: 1) delete local dev, pull remote dev 2) rebase local dev on the new trunk 3) force push to remote dev 4) push local dev to remote trunk

pondermatic commented 2 years ago

Thank you @eri-trabiccolo! Your suggested procedure worked perfectly.

eri-trabiccolo commented 2 years ago

My commits to my local trunk branch of gocode/lifterlms-assignments are signed with a key that is registered with GitHub. However, I get this when I push to origin.

remote: error: GH006: Protected branch update failed for refs/heads/trunk.
remote: error: 4 of 4 required status checks are expected.
To https://github.com/gocodebox/lifterlms-assignments.git
! [remote rejected] trunk -> trunk (protected branch hook declined)
error: failed to push some refs to 'https://github.com/gocodebox/lifterlms-assignments.git'

I have a similar issue with the lifterlms-rest:dev branch. Since the dev branch is some commits ahead of trunk, I rebased it and wanted then to force push it. Result:

remote: Resolving deltas: 100% (20/20), completed with 8 local objects.
remote: error: GH006: Protected branch update failed for refs/heads/dev.
remote: error: Cannot force-push to this protected branch
To https://github.com/gocodebox/lifterlms-rest
 ! [remote rejected] dev -> dev (protected branch hook declined)
error: failed to push some refs to 'https://github.com/gocodebox/lifterlms-assignments.git'

Note that I did something similar on lifterlms-integration-wpforms:dev and it went through. Also my commits are all verified...

eri-trabiccolo commented 2 years ago

@pondermatic do we want to work on the remaining repositories owned by Thomas? If so please tell me on which you're going to work so to avoid overlaps :D

pondermatic commented 2 years ago

@thomasplevy It seems that the lifterlms-integration-twilio project needs some secret environment variables set in order to run unit tests.

LLMS_TWILIO_SID
LLMS_TWILIO_AUTHKEY

Also, when I tried to log into Twilio to get our authentication to run tests locally, I got this page: image I do not have access to the help@lifterlms.com mailbox.

I was able to use my own Twilio account to run the tests successfully.

thomasplevy commented 2 years ago

Once we get GitHub workflows to run successfully, should we delete the failed runs?

@pondermatic Nope, don't bother, who cares!

thomasplevy commented 2 years ago

BTW, do we have a place to store our public keys? 1Password maybe?

You can store your keys in 1pass if you want but, in general I haven't found a need to have a centralized store for our dev public keys... I guess it makes sense to do so but I haven't needed them for anything so...

thomasplevy commented 2 years ago

I do not have access to the help@lifterlms.com mailbox.

Yes you do, it's the support inbox in HelpScout (recently renamed to "Conversation Team"

thomasplevy commented 2 years ago

It seems that the lifterlms-integration-twilio project needs some secret environment variables set in order to run unit tests.

Added

pondermatic commented 2 years ago

BTW, do we have a place to store our public keys? 1Password maybe?

You can store your keys in 1pass if you want but, in general I haven't found a need to have a centralized store for our dev public keys... I guess it makes sense to do so but I haven't needed them for anything so...

I added mine to 1pass today. If the developers had each other's public keys, then the git log --show-signature command would be "prettier". That's about the only benefit I know of. Unless we start encrypting emails to each other. Nah, you'd never read them.

pondermatic commented 2 years ago

It seems that the lifterlms-integration-twilio project needs some secret environment variables set in order to run unit tests.

Added

The LLMS_Twilio_Test_API::test_call_error_400 PHPUnit test fails with error code 20003, permission denied.

LLMS_Twilio_Test_API::test_call_success errors out, but the error is not echoed to the console.

Should I create an issue for these, or is this something you've seen before the change from TravisCI to GitHub actions?

thomasplevy commented 2 years ago

The LLMS_Twilio_Test_API::test_call_error_400 PHPUnit test fails with error code 20003, permission denied.

LLMS_Twilio_Test_API::test_call_success errors out, but the error is not echoed to the console.

Should I create an issue for these, or is this something you've seen before the change from TravisCI to GitHub actions?

Please create an issue (in Twilio repo) to track this, I haven't seen this particular error before and I'll need to investigate this further to determine what's happening.

eri-trabiccolo commented 2 years ago

@thomasplevy Trying to summarize below:

thomasplevy commented 2 years ago

@eri-trabiccolo force push has been enabled for the dev branch on the lifterlms-rest

thomasplevy commented 2 years ago

My commits to my local trunk branch of gocode/lifterlms-assignments are signed with a key that is registered with GitHub. However, I get this when I push to origin.

remote: error: GH006: Protected branch update failed for refs/heads/trunk.
remote: error: 4 of 4 required status checks are expected.
To https://github.com/gocodebox/lifterlms-assignments.git
! [remote rejected] trunk -> trunk (protected branch hook declined)
error: failed to push some refs to 'https://github.com/gocodebox/lifterlms-assignments.git'

@pondermatic I've turned force-push on for the trunk branch but I'd like to turn it back on after you're done. Let me know when you're happy here and I'll reenable.