Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github Action Migration #1700

Merged
merged 9 commits into from
Apr 5, 2022
Merged

Conversation

cea2aj
Copy link
Member

@cea2aj cea2aj commented Apr 4, 2022

Delete the Circle CI config and migrate to Github Actions

The original gh-action-migration feature branch was based on develop, and we don't want to merge the extra commits from develop into master just yet. For this release, we only want the github action migration. Once this is merged into master, we can merge master into develop.

J=SLAP-2023
TEST=none

The functionality was tested in the individual items.

cea2aj and others added 7 commits April 4, 2022 12:48
Create callable build and unit test workflows for GH actions

These are split into callable workflows so that they can be reused for other workflows (e.g. i18n builds, and search bar assets)

Note: A current limitation of callable workflows is that they currently need to specify the full repo and the branch. The PM for Github Actions said that they would be releasing an update in a couple of weeks which would allow us to call workflows from within the same repo. We can keep this migration in a feature branch until they release that feature and then we can update the code and complete the migration

Some additional optimizations include adding caching to NPM node modules and setting up concurrency so that new commits will cancel the GH action jobs for previous commits

J=SLAP-1811, SLAP-1812
TEST=manual

Observe that in the 'Actions' tab the build and unit tests run successfully
Add GitHub Action deployment

Add a deploy.yml file and connect it to the build_and_deploy workflow. Comment out the corresponding build_and_deploy from CircleCI. When the migration is complete, we can delete the commented out portions from the CircleCI config. I added the AWS credentials to the repo's secrets. I also set up branch name formatting where any '/' is replaced with '-' in order to match the CircleCI behavior.

J=SLAP-1816
TEST=manual

Observe the build and deploy in the Github Actions panel. Point the theme test site to the assets and see the page work correctly.
Added ANSWERS.setGeolocation to all acceptance testing fixtures.

Without these, a number of acceptance tests would pretty consistently fail.
This seems to have been due to GH runners having a different location than
CircleCI runners, resulting in different API responses.
We already set the geolocation in the theme's acceptance tests.

I included the useragent tests in the acceptance test workflow, despite them also being considered
part of "miscellaneous tests". I felt like it's nice to have all the browserstack tests in one place.

J=SLAP-1815
TEST=manual,auto

see the acceptance tests run in parallel
saw that the `if` statement in the acceptance script works #1657
add a new workflow for build and deploy internationalization assets.
- for develop branch: only run canary deployments (canary/latests and canary/[github.sha])
- for non-develop branch within the restricted set of branches specified in trigger event: run normal deployment (dev/[branch-name])
- Also pull the process for formatting branch name into its own reusable workflow to avoid duplicating that code portion for build and deploy workflows.

J=SLAP-1817
TEST=manual

- check in s3 bucket for this branch and see that i18n assets are deployed.
- check github actions for normal build_and_deploy and build_and_deploy_i18n, see that both works with the new format_branch_name refactor
- with canary build and conditional deployment base on specific branch name, see that only canary deployment jobs ran. See in s3 buckets, the two set of canary assets in the corresponding mock directories base on this branch are present. https://github.com/yext/answers-search-ui/actions/runs/1762091174
Also fixes a bug in the translation test bash script, where a non-zero exit code would only be returned
if the LAST .po file in the for loop had a msgcmp error.

J=SLAP-1815
TEST=manual,auto

tested using #1659
tests run in a support branch
tests fail if any of the translations in a pot file are missing, in either the last po file or a different one
short circuits if pot file is not up to date
this pr add a build and deploy workflow with hold state.

- Requires an environment `production` set in repo's settings with a 'require reviewers' protection rule on for team slapshot as qualify members to approve before workflow start deployment.
- `deploy_hold.yml` is made to use the environment `production` setting. The github action `build_and_deploy_hold`, after receiving approval, will deploy three set of assets in folders with name based on tag version, major version and minor version. (/v1.2.3, /v1.2, /v1)
  - For tag release for support branches, such as cases where v1.2.1 is release but there's a newer version v1.3.0 previously release, we don't want to deploy to v1 (major version) and only to v1.2 (minor version) and v1.2.1 (tag version). Added `should_deploy_major_version` job to ensure this behavior

Note: There are some limitations in how secrets and environments can work with reusable workflows (discussions in this [github post](https://github.community/t/reusable-workflows-secrets-and-environments/203695)). There's also a [repo](https://github.com/AllanOricil/workflow-template-bug/blob/master/.github/workflows/workflow-inplementation.yml) with some examples to show issues with environment and secrets when use certain ways.

To summarize:
I can't set `environment` in the top level job and use `uses` to call `deploy` workflow. That's not supported and seems to [error out during testing](https://github.com/yext/answers-search-ui/actions/runs/1763550565/workflow): `workflow is not valid, unexpected value 'uses'`. This mean `environment` have to either:
1) get pass into the reusable workflow `deploy.yml` as an input (similar to my-workflow-job-4 in the example repo):
   - this requires a default `staging` environment without approval restriction and this would spam prs with messages of deploying to staging (as shown in this pr), which could get annoying and cluttering up prs. But if the team is alright with this, I can update to use this approach.
2) hardcode into the workflow (similar to my-workflow-job-3 in the example repo):
   - this is what I have in `deploy_hold.yml` workflow where environment is hardcoded to `production`. Supposedly, when trying to access secrets in an action with an environment specified, github would check for the environment secrets first before checking repo secrets automatically so we don't have to pass in the secrets. But that [didn't work during testing](850e86e) so I kept the secrets as inputs.

I also can't combine all the deploy jobs into one with 'steps' field because `secrets` input field for workflows in `steps` field is not supported. But I think it make sense for them to be separate jobs anyway since they are not dependent on each other, even though it feels a little like duplicating code.

J=SLAP-1818
TEST=manual

push a tag to repo, and see build_and_deploy_hold workflow ran: https://github.com/yext/answers-search-ui/actions/runs/1763784557. Check in s3 buckets from this branch's dir and see the expected assets in folders with major/minor/full versions in there.
push two tags: test-v3.4.0 and test-v3.3.0 in order. See that the first tag deploy all versions and the second tag cancel the major version deployment ([test](https://github.com/yext/answers-search-ui/actions/runs/1774931889))
Deploy the search bar assets on Github Actions

The logic is based on the logic from the Circle CI config, however this also checks whether or not the major version should be deployed.

The search bar relies on much of the same deploy logic as the regular build_and_deploy_hold workflow, so I extracted out the extract_version and the should_deploy_major_version workflows. In order to support the search bar, I added an `ignore_prefix` to those workflows.

Remove the circle CI config because this is the last piece of the migration.

J=SLAP-1819
TEST=manual

For testing, update the search bar deploy workflow to run based off of the branch name, and create a search-bar-v0.1.0 branch and see it deploy v0, v0.1, and v0.1.0. Create a test tag to confirm the build and deploy hold script didn't break
@coveralls
Copy link

coveralls commented Apr 4, 2022

Coverage Status

Coverage remained the same at 61.752% when pulling 5765246 on feature/gh-action-migration-rebase into ab92a33 on release/v1.13.

Remove the useragent acceptance tests from the Github migration because they were removed from the Circle CI tests in #1662

J=SLAP-2023
TEST=none

Confirm the useragent acceptance test is no longer being ran
Fix the FacetsOnLoad test which failed because the c_popularity facet was added on the backend

J=none
TEST=manual

Run the test and confirm it now passes
@tmeyer2115 tmeyer2115 self-requested a review April 5, 2022 13:06
@cea2aj cea2aj merged commit a83bc9f into release/v1.13 Apr 5, 2022
@cea2aj cea2aj deleted the feature/gh-action-migration-rebase branch April 5, 2022 14:10
cea2aj added a commit that referenced this pull request Apr 6, 2022
Delete the Circle CI config and migrate to Github Actions

The original gh-action-migration feature branch was based on develop, and we don't want to merge the extra commits from develop into master just yet. For this release, we only want the github action migration. Once this is merged into master, we can merge master into develop.

J=SLAP-2023
TEST=none

The functionality was tested in the individual items.
cea2aj added a commit that referenced this pull request Apr 7, 2022
Delete the Circle CI config and migrate to Github Actions

The original gh-action-migration feature branch was based on develop, and we don't want to merge the extra commits from develop into master just yet. For this release, we only want the github action migration. Once this is merged into master, we can merge master into develop.

J=SLAP-2023
TEST=none

The functionality was tested in the individual items.
cea2aj added a commit that referenced this pull request Apr 7, 2022
Delete the Circle CI config and migrate to Github Actions

The original gh-action-migration feature branch was based on develop, and we don't want to merge the extra commits from develop into master just yet. For this release, we only want the github action migration. Once this is merged into master, we can merge master into develop.

J=SLAP-2023
TEST=none

The functionality was tested in the individual items.
cea2aj added a commit that referenced this pull request Apr 7, 2022
Delete the Circle CI config and migrate to Github Actions

The original gh-action-migration feature branch was based on develop, and we don't want to merge the extra commits from develop into master just yet. For this release, we only want the github action migration. Once this is merged into master, we can merge master into develop.

J=SLAP-2023
TEST=none

The functionality was tested in the individual items.
cea2aj added a commit that referenced this pull request Apr 7, 2022
Delete the Circle CI config and migrate to Github Actions

The original gh-action-migration feature branch was based on develop, and we don't want to merge the extra commits from develop into master just yet. For this release, we only want the github action migration. Once this is merged into master, we can merge master into develop.

J=SLAP-2023
TEST=none

The functionality was tested in the individual items.
cea2aj added a commit that referenced this pull request Apr 7, 2022
Delete the Circle CI config and migrate to Github Actions

The original gh-action-migration feature branch was based on develop, and we don't want to merge the extra commits from develop into master just yet. For this release, we only want the github action migration. Once this is merged into master, we can merge master into develop.

J=SLAP-2023
TEST=none

The functionality was tested in the individual items.
cea2aj added a commit that referenced this pull request Apr 7, 2022
Delete the Circle CI config and migrate to Github Actions

The original gh-action-migration feature branch was based on develop, and we don't want to merge the extra commits from develop into master just yet. For this release, we only want the github action migration. Once this is merged into master, we can merge master into develop.

J=SLAP-2023
TEST=none

The functionality was tested in the individual items.
cea2aj added a commit that referenced this pull request Apr 7, 2022
Delete the Circle CI config and migrate to Github Actions

The original gh-action-migration feature branch was based on develop, and we don't want to merge the extra commits from develop into master just yet. For this release, we only want the github action migration. Once this is merged into master, we can merge master into develop.

J=SLAP-2023
TEST=none

The functionality was tested in the individual items.
cea2aj added a commit that referenced this pull request Apr 7, 2022
Delete the Circle CI config and migrate to Github Actions

The original gh-action-migration feature branch was based on develop, and we don't want to merge the extra commits from develop into master just yet. For this release, we only want the github action migration. Once this is merged into master, we can merge master into develop.

J=SLAP-2023
TEST=none

The functionality was tested in the individual items.
cea2aj added a commit that referenced this pull request Apr 8, 2022
Delete the Circle CI config and migrate to Github Actions

The original gh-action-migration feature branch was based on develop, and we don't want to merge the extra commits from develop into master just yet. For this release, we only want the github action migration. Once this is merged into master, we can merge master into develop.

J=SLAP-2023
TEST=none

The functionality was tested in the individual items.
cea2aj added a commit that referenced this pull request Apr 8, 2022
Delete the Circle CI config and migrate to Github Actions

The original gh-action-migration feature branch was based on develop, and we don't want to merge the extra commits from develop into master just yet. For this release, we only want the github action migration. Once this is merged into master, we can merge master into develop.

J=SLAP-2023
TEST=none

The functionality was tested in the individual items.
cea2aj added a commit that referenced this pull request Apr 8, 2022
Delete the Circle CI config and migrate to Github Actions

The original gh-action-migration feature branch was based on develop, and we don't want to merge the extra commits from develop into master just yet. For this release, we only want the github action migration. Once this is merged into master, we can merge master into develop.

J=SLAP-2023
TEST=none

The functionality was tested in the individual items.
cea2aj added a commit that referenced this pull request Apr 8, 2022
Delete the Circle CI config and migrate to Github Actions

The original gh-action-migration feature branch was based on develop, and we don't want to merge the extra commits from develop into master just yet. For this release, we only want the github action migration. Once this is merged into master, we can merge master into develop.

J=SLAP-2023
TEST=none

The functionality was tested in the individual items.
cea2aj added a commit that referenced this pull request Apr 8, 2022
Delete the Circle CI config and migrate to Github Actions

The original gh-action-migration feature branch was based on develop, and we don't want to merge the extra commits from develop into master just yet. For this release, we only want the github action migration. Once this is merged into master, we can merge master into develop.

J=SLAP-2023
TEST=none

The functionality was tested in the individual items.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants