ansys / actions

A collection of reusable workflows
https://actions.docs.ansys.com/
MIT License
10 stars 5 forks source link

fix: doc build without python cache #543

Open SMoraisAnsys opened 3 weeks ago

SMoraisAnsys commented 3 weeks ago

Following a discussion with @RobPasMue, the implementation of the doc-build action did not correctly take into account the fact of not using caching when installing Python packages.

Note: this is particularly annoying when one works with self-hosted runners where you can easily think that you are using the latest version of a package and it's not the case.

This PR does:

Extra: to handle poetry and virtual environment, I use poetry config virtualenvs.create false. This configures poetry to not create a new virtual environment and ensure it uses the activated virtual environment. Another approach would have been to use poetry's capability to create a virtual environment in-project. However, this wouldn't work well in the case of our VM with self hosted runners. Indeed, if a virtual environment has already been created for the project under {cache-dir}/virtualenvs, using poetry config virtualenvs.in-project true will not cause poetry to create or use a local virtual environment. To fix that, a manual deletion of the virtual environment is required but it would troublesome in the long run... Thus, this option is not leveraged.

ansys-reviewer-bot[bot] commented 3 weeks ago

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

SMoraisAnsys commented 1 week ago

FYI, I tested this on a fork of pyconceptev as I think poetry handling might have been difficult.

The PR : https://github.com/SMoraisAnsys/pyconceptev/pull/1

The CI associated consists in running multiple workflows where I build the documentation twice:

The idea of those workflow is to mock how a VM would behave when it had been already used with caching.

The logs are here, know that I manually checked and it was consistent.

SMoraisAnsys commented 1 week ago

Tested on pyansys-sound and it worked, see https://github.com/ansys/pyansys-sound/pull/111

SMoraisAnsys commented 1 week ago

Tested in pyansys-geometry and working as expected, see https://github.com/ansys/pyansys-geometry/pull/1404