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

PR deployments #1841

Merged
merged 2 commits into from
Aug 21, 2020
Merged

PR deployments #1841

merged 2 commits into from
Aug 21, 2020

Conversation

jorgeazevedo
Copy link
Contributor

@jorgeazevedo jorgeazevedo commented Aug 20, 2020

What does this change?

This adds a new action called PR deployment, which deploys every open PR to a public URL.

It has two main components:

A main action. While this action is running, the DCR server is running and accessible

PR_deployments_by_jorgeazevedo_·_Pull_Request__1841_·_guardian_dotcom-rendering

A status check. When the main action has successfully compiled and booted the node server, it announces it's ready by posting this check with the public URL.

PR_deployments_by_jorgeazevedo_·_Pull_Request__1841_·_guardian_dotcom-rendering

Why?

Part of this quarter's work to improve performance. It makes it easy to use external tools like pagespeed insights, the structured data testing tool etc

Notes

  • This is not set to run against every branch pushed to the repository - only against PRs when they are opened or synchronized (which is what github calls it when you push to the PR's branch)

  • It uses an action called workflow-run-cleanup-action to cancel any other PR deployments on the branch. When you push to a branch it will trigger a new PR deployment, but github does not cancel the old one so they can quickly accumulate. The action works fine as a workaround, but it generates email alerts for every cancelation. Not ideal 😕 it's easy to disable github actions notifications though.

  • The script will auto exit after 5 hours by using timeout. This is to preempt github canceling it after 6 and putting a big red cross next to the commit.

  • The workflow for using this will be really based on manually re-running the main action to bring the server back online. If the feature proves useful and the manual re-run too painful, the automation route is quite possible!

PR_deployments_by_jorgeazevedo_·_Pull_Request__1841_·_guardian_dotcom-rendering

@PRBuilds
Copy link

PRBuilds commented Aug 20, 2020

PRbuilds results:

💚 AMP validation
amp-report.txt

LightHouse Reporting
1597945430.report.html

--automated message

@github-actions
Copy link

github-actions bot commented Aug 20, 2020

Size Change: 0 B

Total Size: 621 kB

ℹ️ View Unchanged
Filename Size Change
dist/dynamicImport.js 1.9 kB 0 B
dist/dynamicImport.legacy.js 1.95 kB 0 B
dist/frontend.server.js 223 kB 0 B
dist/ga.js 2.89 kB 0 B
dist/ga.legacy.js 3.36 kB 0 B
dist/GetMatchStats.js 3.23 kB 0 B
dist/GetMatchStats.legacy.js 3.32 kB 0 B
dist/lotame.js 1.08 kB 0 B
dist/lotame.legacy.js 1.08 kB 0 B
dist/MostViewedFooterData.js 5.63 kB 0 B
dist/MostViewedFooterData.legacy.js 5.84 kB 0 B
dist/MostViewedRightWrapper.js 6.25 kB 0 B
dist/MostViewedRightWrapper.legacy.js 6.48 kB 0 B
dist/OnwardsLower.js 10.7 kB 0 B
dist/OnwardsLower.legacy.js 11 kB 0 B
dist/OnwardsUpper.js 11.3 kB 0 B
dist/OnwardsUpper.legacy.js 11.6 kB 0 B
dist/ophan.js 6.82 kB 0 B
dist/ophan.legacy.js 6.81 kB 0 B
dist/react.js 119 kB 0 B
dist/react.legacy.js 122 kB 0 B
dist/readerRevenueDevUtils.js 762 B 0 B
dist/readerRevenueDevUtils.legacy.js 828 B 0 B
dist/sentry.js 20.4 kB 0 B
dist/sentry.legacy.js 20 kB 0 B
dist/shimport.js 3.21 kB 0 B
dist/shimport.legacy.js 3.21 kB 0 B
dist/SignInGateMain.js 2.1 kB 0 B
dist/SignInGateMain.legacy.js 2.17 kB 0 B
dist/SignInGatePatientia.js 1.6 kB 0 B
dist/SignInGatePatientia.legacy.js 1.62 kB 0 B

compressed-size-action

Which is needed now that this workflow is being triggered by a pull
request event, not a push.
@gtrufitt
Copy link
Contributor

Very cool! I am excited to see this, and defo you should shout about it on the Dotcom room once merged because this is a huge devEx win. I don't think there's a day goes by that I don't want this 😆

I am not going to +1 as that's not my expertise, but probably @jfsoul @shtukas @nicl could look at the script as a sense check (though not risky I don't think!)

- name: Use Node.js 10.15.3
uses: actions/setup-node@v1
with:
node-version: 10.15.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't suppose there's any way to use the .nvmrc file to synchronise this with the version we have there?

Copy link
Contributor Author

@jorgeazevedo jorgeazevedo Aug 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point! It would be beneficial for all our actions. Unfortunately setup-node doesn't support it, though it looks like they're actively interested in it. Alternatively we can use nvm directly thought it does seem a little hacky. I'll pop a ticket in trello to investigate

@jorgeazevedo jorgeazevedo merged commit 6be2a26 into master Aug 21, 2020
@jorgeazevedo jorgeazevedo deleted the ja-pr-deploys branch August 21, 2020 11:06
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.

4 participants