GHA: Use same commands the CLI does to create venv (#5206)
Use the same commands the CLI does to create venv for Python projects, and add a test.
This commit is contained in:
parent
60fcc1951b
commit
493136d2f0
5
dist/actions/entrypoint.sh
vendored
5
dist/actions/entrypoint.sh
vendored
|
@ -124,9 +124,8 @@ if [ -e requirements.txt ]; then
|
|||
pip3 install -r requirements.txt
|
||||
else
|
||||
python3 -m venv $PULUMI_VENV
|
||||
source $PULUMI_VENV/bin/activate
|
||||
pip3 install -r requirements.txt
|
||||
deactivate
|
||||
$PULUMI_VENV/bin/python -m pip install --upgrade pip setuptools wheel
|
||||
$PULUMI_VENV/bin/python -m pip install -r requirements.txt
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -112,6 +112,10 @@ func TestPulumiActionsImage(t *testing.T) {
|
|||
t.Run("python", func(t *testing.T) {
|
||||
testRuntimeWorksInContainer(t, "python", pulumiContainerToTest)
|
||||
})
|
||||
|
||||
t.Run("python_venv", func(t *testing.T) {
|
||||
testRuntimeWorksInContainer(t, "python_venv", pulumiContainerToTest)
|
||||
})
|
||||
}
|
||||
|
||||
// testRuntimeWorksInContainer runs a test that attempts to run a Pulumi program in the given
|
||||
|
|
2
tests/containers/python_venv/.gitignore
vendored
Normal file
2
tests/containers/python_venv/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*.pyc
|
||||
venv/
|
6
tests/containers/python_venv/Pulumi.yaml
Normal file
6
tests/containers/python_venv/Pulumi.yaml
Normal file
|
@ -0,0 +1,6 @@
|
|||
name: trivial-python
|
||||
description: A trivial Pulumi program for Python that has virtualenv set
|
||||
runtime:
|
||||
name: python
|
||||
options:
|
||||
virtualenv: venv
|
4
tests/containers/python_venv/__main__.py
Normal file
4
tests/containers/python_venv/__main__.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
import pulumi
|
||||
|
||||
config = pulumi.Config()
|
||||
print("Hello from %s" % (config.require("runtime")))
|
1
tests/containers/python_venv/requirements.txt
Normal file
1
tests/containers/python_venv/requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
pulumi>=1.0.0
|
Loading…
Reference in a new issue