Skip to content

Commit

Permalink
use python version from config yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomarquezp committed Jan 23, 2024
1 parent 215fed3 commit e5d065b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/verify_library_generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ on:
workflow_dispatch:
name: verify_library_generation
jobs:
compute_python_version:
- name: compute python version
run: |
source library_generation/utilities.sh
python_version_from_config_yaml=$(py_util "get_python_version" "library_generation/test/resources/integration/google-cloud-java/generation_config.yaml")
echo "PYTHON_VERSION=${python_version_from_config_yaml}" >> "${GITHUB_ENV}"
integration_tests:
strategy:
matrix:
Expand All @@ -25,7 +31,7 @@ jobs:
cache: maven
- uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: ${{ github.env.PYTHON_VERSION }}
- name: install pyenv
shell: bash
run: |
Expand All @@ -42,12 +48,11 @@ jobs:
eval "$(pyenv virtualenv-init -)"
# create and activate the python virtualenv
python_version=$(cat "library_generation/configuration/python-version")
if [ $(pyenv versions | grep "${python_version}" | wc -l) -eq 0 ]; then
if [ $(pyenv versions | grep "${PYTHON_VERSION}" | wc -l) -eq 0 ]; then
pyenv install "${python_version}"
fi
if [ $(pyenv virtualenvs | grep "${python_version}" | grep "postprocessing" | wc -l) -eq 0 ];then
pyenv virtualenv "${python_version}" "postprocessing"
if [ $(pyenv virtualenvs | grep "${PYTHON_VERSION}" | grep "postprocessing" | wc -l) -eq 0 ];then
pyenv virtualenv "${PYTHON_VERSION}" "postprocessing"
fi
set +ex
- name: install python dependencies
Expand Down
8 changes: 8 additions & 0 deletions library_generation/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ def get_configuration_yaml_destination_path(generation_config_yaml):
config = GenerationConfig.from_yaml(generation_config_yaml)
return config.destination_path or ''

"""
For a given configuration yaml path, it returns the python_version
entry at the root of the yaml
"""
def get_configuration_yaml_python_version(generation_config_yaml):
config = GenerationConfig.from_yaml(generation_config_yaml)
return config.python_version


"""
Calls a function defined in library_generation/utilities.sh
Expand Down

0 comments on commit e5d065b

Please sign in to comment.