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:
Justin Van Patten 2020-08-28 23:08:32 +00:00 committed by GitHub
parent 60fcc1951b
commit 493136d2f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,2 @@
*.pyc
venv/

View 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

View file

@ -0,0 +1,4 @@
import pulumi
config = pulumi.Config()
print("Hello from %s" % (config.require("runtime")))

View file

@ -0,0 +1 @@
pulumi>=1.0.0