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

Feat/add workflow preview prs #348

Merged
merged 4 commits into from
Dec 9, 2024
Merged

Conversation

f-hollow
Copy link
Collaborator

@f-hollow f-hollow commented Dec 3, 2024

Description

This PR adds the following workflows:

  • pr-deploy-preview -- builds a site from the source files in a PR and deploys it to the subfolder /pr<PR-number>
    • Example of deployment path: this PR is to be deployed to https://preview-developer.espressif.com/pr348/
    • The workflow is triggered when a pull request is open, pushed to, or reopened (after being closed)
  • pr-remove-preview -- removes the files together with the /pr<PR-number> folder earlier deployed by pr-deploy-preview
    • The workflow is triggered when a pull request is merged or closed

These workflows can already be used but further improvements can be done:

  • ⚠️ When a PR is created from a fork, require verification by the maintainer before running the preview workflow
  • pr-deploy-preview
    • On subsequent runs, remove all previously created comments with a preview link
    • Deploy only updated files (see also Issues syncing files in Ci/optimize site deployment #336)
  • On each site page add amessage "Preview, see GitHub PR link..."
  • Publish only updated or newly added articles?
  • Some links to figures, buttons, get broken (in our case, on the main page) if baseURL has subfolders, see related threads
  • For crawlers, that possibly do not respect robots.txt, consider adding nocache, noindex to each site page
    • Consider expanding S3 bucket deploy args to --cache-control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0"

Nice to have:

  • Add a switch to turn off preview workflows if they are not needed?
  • If a user requests a non-existent PR folder (e.g., /pr-999), configure a custom error page

Apart from the covered updates, this PR also introduces separate config files for staging and production environments.

Related

Issue #43

Testing

  • Make sure the parameter --delete only removes the files in the DEST_DIR, and the bucket's root is unaffected
    • Tried redeploying to DEST_DIR, other files and folders were unaffected
  • Make sure that robots.txt tester is not going to crawl HTML pages, otherwise include noindex in <head>
    • The file robots.txt looks correct to prevent crawlers from caching the preview websites
  • Test trigger events for the workflows
    • Extensive testing has been done in this PR
  • Test if the workflows run successfully when triggered from forked repos
    • Did research and followed he best practices while creating the workflows
    • ⚠️ Final testing if workflows run smoothly from forked repos can be done immediately after this PR is merged

Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@f-hollow f-hollow force-pushed the feat/add_workflow_preview_prs branch 13 times, most recently from b04b267 to 92250cb Compare December 5, 2024 06:47
@espressif espressif deleted a comment from github-actions bot Dec 5, 2024
@f-hollow f-hollow force-pushed the feat/add_workflow_preview_prs branch from 92250cb to 6297c14 Compare December 5, 2024 06:51
@espressif espressif deleted a comment from github-actions bot Dec 5, 2024
@f-hollow f-hollow force-pushed the feat/add_workflow_preview_prs branch from 6297c14 to 21f0468 Compare December 5, 2024 06:52
@espressif espressif deleted a comment from github-actions bot Dec 5, 2024
@f-hollow f-hollow force-pushed the feat/add_workflow_preview_prs branch 10 times, most recently from 0a9d797 to ed76665 Compare December 5, 2024 07:08
@espressif espressif deleted a comment from github-actions bot Dec 5, 2024
@f-hollow f-hollow force-pushed the feat/add_workflow_preview_prs branch from 50e9313 to a223d8f Compare December 9, 2024 06:06
@espressif espressif deleted a comment from github-actions bot Dec 9, 2024
@f-hollow f-hollow closed this Dec 9, 2024
@f-hollow f-hollow reopened this Dec 9, 2024
@f-hollow f-hollow closed this Dec 9, 2024
@f-hollow f-hollow reopened this Dec 9, 2024
@f-hollow f-hollow force-pushed the feat/add_workflow_preview_prs branch 2 times, most recently from 00fe8f7 to 7e8d1c3 Compare December 9, 2024 07:29
@f-hollow f-hollow force-pushed the feat/add_workflow_preview_prs branch from 7e8d1c3 to 68cda03 Compare December 9, 2024 07:33
Copy link

github-actions bot commented Dec 9, 2024

🎉 A preview of this PR is available at: https://preview-developer.espressif.com/pr348/

@espressif espressif deleted a comment from github-actions bot Dec 9, 2024
@espressif espressif deleted a comment from github-actions bot Dec 9, 2024
@espressif espressif deleted a comment from github-actions bot Dec 9, 2024
@espressif espressif deleted a comment from github-actions bot Dec 9, 2024
@espressif espressif deleted a comment from github-actions bot Dec 9, 2024
@espressif espressif deleted a comment from github-actions bot Dec 9, 2024
@espressif espressif deleted a comment from github-actions bot Dec 9, 2024
@espressif espressif deleted a comment from github-actions bot Dec 9, 2024
Copy link
Collaborator

@georgik georgik left a comment

Choose a reason for hiding this comment

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

Impressive. LGTM

Copy link
Member

@pedrominatel pedrominatel left a comment

Choose a reason for hiding this comment

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

Thanks, @f-hollow!

@f-hollow f-hollow merged commit b0821d3 into main Dec 9, 2024
4 checks passed
@f-hollow f-hollow deleted the feat/add_workflow_preview_prs branch December 9, 2024 10:10
f-hollow added a commit that referenced this pull request Dec 10, 2024
* fix: improve comments and name for deploy workflow

* feat: clean up and improve config files

* feat: add workflow to preview prs

* feat: add workflow to remove preview files when pr closed
@f-hollow f-hollow mentioned this pull request Dec 11, 2024
6 tasks
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.

3 participants