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

Reliable builds and deploys #1840

Closed
kasparsd opened this issue Jan 26, 2019 · 9 comments
Closed

Reliable builds and deploys #1840

kasparsd opened this issue Jan 26, 2019 · 9 comments
Assignees
Labels
Infrastructure Changes impacting testing infrastructure or build tooling P2 Low priority WS:Core Work stream for Plugin core

Comments

@kasparsd
Copy link

Currently the build process defined in Gruntfile.js relies on an unknown state of the checked out repository -- For example, it uses existing dependencies in /vendor and /node_modules directories without installing them according to the rules in the lock files.

For reliable and reproducible builds we need to isolate any local overrides and always start from a known state. I suggest to update the deploy process to the following steps:

  • Create an empty /build/src directory.

  • Copy the .git directory from the root to /build/src/.git.

  • Checkout the required release branch such as develop or master. This ensures that we never accidentally deploy a feature brunch.

  • Install all dependencies via npm install and composer install --no-dev --optimize-autoloader.

  • Build assets npm run build and replace any version strings as necessary.

  • Copy the release files to /build/release and make sure to exclude node_modules and other development specific files. Maybe introduce .distignore that defines all files and directories that shouldn't be part of the final release. Maybe use parse-gitignore to generate the exclude list.

  • Now deploy the /build/release to WP plugin SVN or create a release zip file.

All of these steps can be made cross-platform, too.

@westonruter
Copy link
Member

Some of this is addressed by #1836 correct? Note that the release instructions in contributing.md include a step to run npm install and composer install. It should also include a step to make sure the right branch is checked out.

But yeah, these are manual steps that would ideally be automated as much as possible.

@kasparsd
Copy link
Author

@westonruter Yes, some of this is covered by #1836 and for reasons similar to what you mentioned in this comment it would be better to introduce a completely standalone build and deploy process.

Only by moving the build process away from the working directory we can ensure that none of the work in progress is affected.

With this kind of setup we could even make Travis deploy to the WP.org repo since it would follow the exact same steps as one does locally.

@swissspidy
Copy link
Collaborator

Thanks for opening this!

I would love to see continuous builds on Travis instead of having to do things like #1836. Happy to lead work on that front too.

Continuous deployments to WordPress.org is probably a stretch goal and not easy to do because of SVN credentials. I'd leave this out for the moment.

@swissspidy
Copy link
Collaborator

I would love to see continuous builds on Travis

I was just briefly looking at this again since I was working on the Travis config.

Travis supports uploading assets to GitHub releases for tagged builds. So this would run for new versions automatically, but could also work for nightly builds, where a nightly tag could simply always point to the latest commit in develop.

Another possibility would be using a GitHub Action. They're rather new and rely on Docker containers to put together such a workflow. It would probably mean way more work (and maintenance) than just using Travis CI's built-in integration that does the same job.

Either solution requires a GitHub API token with at least public_repo permission, which grants write access to all of a user's public repositories. So that might not be feasible to achieve.

The alternative would be to use a service that leverages GitHub's deployments API to upload builds somewhere else. For example, Now for GitHub allows that. I am not aware of any other service that has such an integration, but I assume the same could be built manually using GCP or similar.

With this kind of setup we could even make Travis deploy to the WP.org repo

10up have been working on a GitHub Action for this. Looks promising, but does not support plugins with a build process yet. So this is currently not an option.

@swissspidy swissspidy added the Infrastructure Changes impacting testing infrastructure or build tooling label Jun 6, 2019
@westonruter westonruter added this to the v1.2.1 milestone Jun 15, 2019
@westonruter westonruter removed this from the v1.2.1 milestone Jul 15, 2019
@westonruter
Copy link
Member

Moving from 1.2.1 milestone to 2.0 planning

@westonruter westonruter added this to the v1.3 milestone Aug 31, 2019
@westonruter westonruter added the P0 High priority label Aug 31, 2019
@westonruter
Copy link
Member

@schlessera schlessera reopened this Sep 3, 2019
@schlessera schlessera self-assigned this Sep 3, 2019
@schlessera
Copy link
Collaborator

The Gutenberg script doesn't seem to take Composer into account at all. But that might be straight-forward to add, provided there's no surprises with the build system itself.

@westonruter westonruter added [Size] M and removed [Size] M P0 High priority labels Sep 9, 2019
@westonruter westonruter removed this from the v1.3 milestone Sep 9, 2019
@westonruter
Copy link
Member

Improvements to the build process are being merged as part of #3183, but I'm leaving this issue open because it doesn't touch on the deployment aspects and the overall build pipeline should be evaluated, but that's out of the scope for what we need to get out the door for 1.3.

@kmyram kmyram added the P2 Low priority label Mar 3, 2020
@kmyram kmyram added the WS:Core Work stream for Plugin core label Aug 5, 2020
@pierlon
Copy link
Contributor

pierlon commented Aug 11, 2020

Given the current state of the build process for the plugin I'd say reproducible builds are now possible, and so this issue can now be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Changes impacting testing infrastructure or build tooling P2 Low priority WS:Core Work stream for Plugin core
Projects
None yet
Development

No branches or pull requests

6 participants