wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

Make sure that the monorepo is linked when deploying feature branches to Yoast-dist.

Open hansjovis opened this issue 6 years ago • 5 comments

Summary

When deploying a feature branch to Yoast-dist we do not link the monorepo. This means that we need to release the JavaScript monorepo packages as release candidates, and point to them in the plugin's package.json, to be able to test any monorepo package changes related to a feature in the plugin.

Technical details

One way to solve this is to add a new deploy job specifically for feature branches to the travis.yml configuration.

This job...

  • .. should only be run on feature branches.
  • .. should have the same configuration as the Deploy to Yoast-dist-job, except:
  • .. should link the monorepo by running these steps before running yarn install:
    git clone https://github.com/yoast/javascript /tmp/javascript
    echo '{"monorepo-location":"/tmp/javascript"}' > .yoast
    yarn link-monorepo
    

hansjovis avatar Feb 03 '20 16:02 hansjovis

The problem that releasing the internal linking as release candidates brings us is that lerna currently only looks at the changes to the current branch and the latest release (rc or real). This resulted in it giving no changes, while there were changes, just not comparing to internal linking. There could be a solution in lerna / how we release too.

igorschoester avatar Feb 03 '20 16:02 igorschoester

@hansjovis How do I recognize a feature branch, not sure if this can be solve in a general way, as for "all feature branches" i can hard code the branch name for this for sure.

noud-github avatar Feb 04 '20 07:02 noud-github

All feature branches are named feature/<feature-name>

herregroen avatar Feb 04 '20 08:02 herregroen

in the .travis.yml this needs to be changed:

      install:
        - yarn global add grunt-cli
        - yarn install
      before_script: skip

to

install:
  - yarn global add grunt-cli
  - |
    if [[ $TRAVIS_BRANCH =~ ^feature\/* &&  "$TRAVIS_EVENT_TYPE" = "push" ]] ; then
     git clone https://github.com/yoast/javascript /tmp/javascript
     echo '{"monorepo-location":"/tmp/javascript"}' > .yoast
     yarn link-monorepo
   fi
 - yarn install
before_script: skip

noud-github avatar Feb 05 '20 10:02 noud-github

Probably fixed in https://github.com/Yoast/wordpress-seo/commit/005604c947522b3a1ca07bf2b9f7772ddeb04e85, https://github.com/Yoast/wordpress-seo/commit/3fd21e50b3d0b4a73a888cb426dbdb6cda0f3e8b and 8b5c124ebf0d62b4ad9236101880e6ebd1ab95ed. It needs to be double-checked, and, if everything works fine, cherry-picked to trunk (to make it work for all existing and future feature branches).

To do:

  • [ ] Get the new yoast-dist build to staging.
  • [ ] Verify that the monorepo changes are present.
  • [x] Cherrypick the above changes to trunk (or redo the changes in 1 commit).
  • [x] Verify that on trunk the monorepo doesn't get linked.

@noud-github Also has context on this, so he might be able to help when things go wrong.

IreneStr avatar Feb 13 '20 14:02 IreneStr