forrtproject / forrtproject.github.io

FORRT Website
https://forrt.org
Other
28 stars 16 forks source link

Hugo Deployment Updates + Fix Caching #111

Closed DAKiersz closed 2 weeks ago

DAKiersz commented 1 month ago

Current Workflow (Update)

The current workflow does checkout master branch of the source code, as well as a Tenzing_temp.

Initially thought to be a case of testing in production on every PR commit, the GitHub deploy workflow instead does not actually build (nor test/deploy) the changes in the PR. This means that while the website correctly releases from the master branch (which in development is considered the 'production-ready' branch) it does also mean that a PR is not tested until its merged in. Wrong changes (not build or tested in CI) are as a result reverted every time something breaks.

An example of that can be seen in #116. This PR successfully builds Hugo test & deploy / deploy (pull_request) checks out the master branch via the BRANCH_TO_CHECKOUT environment variable and conducts a build, as well as deploy via the Deploy website on push step. This tasks triggered a GitHub deployment https://github.com/forrtproject/forrtproject.github.io/commit/af3582f46a212ab0dd4e7c25f1b74d315b474ee2 based on the last change to master af3582f

This does still mean that every time there is a PR change, a deployment happens against the master branch. This is not desirable as a release should be done to changes against the master branch only (of this repo).

Our PR solves this by checking out the actual PR branch and building changes. A deployment will only happen on push to master in our repository, or on a daily schedule, and on the master branch.

Caching

With regards to caching, if we take a sample workflow run:(https://github.com/forrtproject/forrtproject.github.io/actions/runs/9217018231/job/25358318973 or https://github.com/forrtproject/forrtproject.github.io/actions/runs/9200568470/job/25307343908) we can see that cache task is executed with a message Cache restored successfully. The subsequent task does collect some packages, but not all.

There was also a mistake in the cache task, targeting a file that did not exist (specially requirements-doc.txt). We rectify this here.

Testing - Cache

No cache found: https://github.com/forrtproject/forrtproject.github.io/actions/runs/9302870663/job/25603959671 Complete cache restored and used in requirements.txt restoration: (https://github.com/forrtproject/forrtproject.github.io/actions/runs/9303101314/job/25604666829)

Overall Changes