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

fix: build frontend in pypi-release workflow #5298

Merged
merged 7 commits into from
Dec 16, 2023

Conversation

psychedelicious
Copy link
Collaborator

@psychedelicious psychedelicious commented Dec 15, 2023

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Community Node Submission

Have you discussed this change with the InvokeAI team?

  • Yes
  • No, because:

Description

This was missing, resulting in the 3.5.0rc1 having no frontend.

Related Tickets & Documents

QA Instructions, Screenshots, Recordings

I've run this locally and it works (I commented out the final steps of the workflow that do PyPi stuff to ensure I didn't accidentally deploy something).

You can run the workflow locally with https://github.com/nektos/act. Suggest using the gh CLI version, its very easy to set up if you have the github CLI installed. Then you can run gh act -W .github/workflows/pypi-release.yml to run the workflow locally in a docker image.

I don't know this local action runner would actually release to PyPi - as mentioned, I commented those steps out when testing - but it does successfully do both frontend and backend builds.

Merge Plan

This needs @lstein 's approval.

[optional] Are there any post deployment tasks we need to perform?

Cut an RC2

This was missing, resulting in the 3.5.0rc1 having no frontend.
- Node 20 has  a problem with `pnpm`; set it to Node 18
- Set the working directory for the frontend commands
Copy link
Collaborator

@lstein lstein left a comment

Choose a reason for hiding this comment

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

While reviewing this PR I did a comparison with the installer zip and realized that the contents of .mypy_cache and __pycache__ directories were finding their way into the latter. So I piggybacked a small fix for this on top of the PR -- hope that's ok.

@mbarnathan mbarnathan mentioned this pull request Dec 16, 2023
1 task
This prevents an empty `dist/` from breaking the app on startup.
… to pypi

- The release workflow never runs automatically. It must be manually kicked off.
- The release workflow has an input. When running it from the GH actions UI, you will see a "Publish build on PyPi" prompt. If this value is "true", the workflow will upload the build to PyPi, releasing it. If this is anything else (e.g. "false", the default), the workflow will build but not upload to PyPi.
- The `dist/` folder (where the python package is built) is uploaded as a workflow artifact as a zip file. This can be downloaded and inspected. This allows "dry" runs of the workflow.
- The workflow job and some steps have been renamed to clarify what they do
@psychedelicious
Copy link
Collaborator Author

psychedelicious commented Dec 16, 2023

I've made two further improvements:
feat(installer): delete frontend build after creating installer

This prevents an empty dist/ from breaking the app on startup.

feat: add python dist as release artifact, as input to enable publish to pypi

  • The release workflow never runs automatically. It must be manually kicked off.
  • The release workflow has an input. When running it from the GH actions UI, you will see a "Publish build on PyPi" prompt. If this value is "true", the workflow will upload the build to PyPi, releasing it. If this is anything else (e.g. "false", the default), the workflow will build but not upload to PyPi.
  • The dist/ folder (where the python package is built) is uploaded as a workflow artifact as a zip file. This can be downloaded and inspected. This allows "dry" runs of the workflow.
  • The workflow job and some steps have been renamed to clarify what they do

Here's the prompt:
image

I tested this on my fork to test that the workflow conditional based on the input being "true" works as expected.

@lstein
Copy link
Collaborator

lstein commented Dec 16, 2023

Running the workflow locally with gh act now fails at the artifact upload step with:

[PyPI Release/build-and-release]   ❗  ::error::Unable to get the ACTIONS_RUNTIME_TOKEN env variable
[PyPI Release/build-and-release]   ❌  Failure - Main Upload build as workflow artifact
[PyPI Release/build-and-release] exitcode '1': failure

Using --artifact-server-path as suggested in several postings does not work. It looks like a local artifact server needs to be started in order to test the workflow locally.

@lstein lstein self-requested a review December 16, 2023 15:35
Copy link
Collaborator

@lstein lstein left a comment

Choose a reason for hiding this comment

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

Let's try it in production.

@lstein lstein merged commit 3b944b8 into main Dec 16, 2023
7 checks passed
@lstein lstein deleted the fix/pypi-release-frontend-build branch December 16, 2023 15:40
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.

2 participants