DiamondLightSource / python-copier-template

Diamond's opinionated copier template for pure Python projects managed by pip
Apache License 2.0
5 stars 3 forks source link

CI: Getting the dev test python version from the Dockerfile #122

Closed evalott100 closed 8 months ago

evalott100 commented 8 months ago

When we install requirements the CI is set up such that a python_version of "dev" will have the install_requirements action parse the Dockerfile for a PYTHON_VERSION:

https://github.com/DiamondLightSource/python-copier-template/blob/f566310c8b09e173081c16f47f50b7584fb1e43c/.github/actions/install_requirements/action.yml#L14-L20

In converting the pandablocks-ioc I found some issues with this, @gilesknap's Dockerfile doesn't include a $PYTHON_VERSION env assignment directly. Should we be assuming all projects will?

I think it would be far nicer to have a

inputs:
   dev_install: true # default false

than to assume the that all Dockerfiles will have a PYTHON_VERSION=?

@M-Chan @coretl

coretl commented 8 months ago

The short term fix is to use the standard copier Dockerfile in PandABlocks-ioc. Please can you see if that works?

The long term is to build a devcontainer from the Dockerfile as per: https://github.com/devcontainers/ci/blob/main/docs/github-action.md

Then run the command within that devcontainer

evalott100 commented 8 months ago

I've set up the CI such that if the python-version is "dev-container" it will wait for the dev container CI build then take the ghcr link as an input and rather than building a new venv with the same python version as the devcoontainer, it just runs the devcontainer. If the python-version is anything else then it will build the venv as normal.

evalott100 commented 8 months ago

https://github.com/PandABlocks/PandABlocks-ioc/pull/98#issuecomment-1976135308