Skip to content

Where is Python?

Where is Python? #147

Workflow file for this run

---
name: CI
on:
push:
tags: ["release/v*"]
branches: ["master", "pyenv-actions"]
pull_request:
branches: ["master", "pyenv-actions"]
workflow_dispatch:
jobs:
test-with-pyenv-interactive:
name: "Pytest with pyenv virtualenv interactive"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout repo"
uses: actions/checkout@v2
- name: "Install pyenv"
uses: "gabrielfalcao/pyenv-action@v16"
- name: "Show available Python versions"
run: |
echo ".bashrc follows >>>>"
cat ~/.bashrc
# We need to modify .bashrc for interactive shells. venv-management will start a new shell
# and run .bashrc when VENV_MANAGEMENT_INTERACTIVE_SHELL=yes
# For non-interactive shells we may need to modify .bash_profile too, according the the
# pyenv instructions.
echo "Modifying .bashrc"
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
echo ".bashrc follows >>>>"
cat ~/.bashrc
echo $PYENV_ROOT
eval "$(pyenv init -)"
echo $PYENV_ROOT
ls -la ~/.bash*
pyenv versions
pyenv shell system
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
source ~/.bashrc
which python
- name: "Install dependencies"
run: |
eval "$(pyenv init -)"
python -m pip install --user --upgrade pip
pwd
ls
python -m pip install --user .[test]
- name: "Run Pytest"
run: |
export VENV_MANAGEMENT_INTERACTIVE_SHELL=yes
python -m pytest tests
test-with-virtualenv-sh-interactive:
name: "Pytest with virtualenv-sh"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout repo"
uses: actions/checkout@v2
- name: "Set up Python"
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: "Install dependencies"
run: |
python -m pip install --user --upgrade pip
python -m pip install --user virtualenv
python -m pip install --user virtualenv-sh
echo '. ${HOME}/.local/bin/virtualenv-sh.bash' >> ${HOME}/.bashrc
echo 'WORKON_HOME=${HOME}/.virtualenvs' >> ${HOME}/.bashrc
pwd
ls
python -m pip install .[test]
- name: "Run Pytest"
run: |
export VENV_MANAGEMENT_INTERACTIVE_SHELL=yes
python -m pytest tests
test-with-virtualenvwrapper-interactive:
name: "Pytest with virtualenvwrapper interactive"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- name: "Set up Python"
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: "Install dependencies"
run: |
python -m pip install --user --upgrade pip
python -m pip install --user virtualenvwrapper
echo '. ${HOME}/.local/bin/virtualenvwrapper.sh' >> ${HOME}/.bashrc
echo 'WORKON_HOME=${HOME}/.virtualenvs' >> ${HOME}/.bashrc
python -m pip install .[test]
- name: "Run Pytest"
run: |
export VENV_MANAGEMENT_INTERACTIVE_SHELL=yes
python -m pytest tests
test-with-virtualenvwrapper-and-venvwraprc-noninterative:
name: "Pytest with virtualenvwrapper and .venvwraprc"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- name: "Set up Python"
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: "Install dependencies"
run: |
python -m pip install --user --upgrade pip
python -m pip install --user virtualenvwrapper
echo "echo 'About to run ~/.local/bin/virtualenvwrapper.sh'" >> ${HOME}/.venvwraprc
echo '. ${HOME}/.local/bin/virtualenvwrapper.sh' >> ${HOME}/.venvwraprc
echo 'WORKON_HOME=${HOME}/.virtualenvs' >> ${HOME}/.venvwraprc
python -m pip install .[test]
- name: "Run Pytest"
run: |
export VENV_MANAGEMENT_SETUP_FILEPATH=${HOME}/.venvwraprc
python -m pytest tests
test-with-virtualenvwrapper-and-venvwraprc-interactive:
name: "Pytest with virtualenvwrapper and .venvwraprc interactive"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- name: "Set up Python"
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: "Install dependencies"
run: |
python -m pip install --user --upgrade pip
python -m pip install --user virtualenvwrapper
echo "echo 'About to run ~/.local/bin/virtualenvwrapper.sh'" >> ${HOME}/.venvwraprc
echo '. ${HOME}/.local/bin/virtualenvwrapper.sh' >> ${HOME}/.venvwraprc
echo 'WORKON_HOME=${HOME}/.virtualenvs' >> ${HOME}/.venvwraprc
python -m pip install .[test]
- name: "Run Pytest"
run: |
export VENV_MANAGEMENT_INTERACTIVE_SHELL=yes
export VENV_MANAGEMENT_SETUP_FILEPATH=${HOME}/.venvwraprc
python -m pytest tests
package:
name: "Build Package Distributions"
needs:
- test-with-virtualenv-sh-interactive
- test-with-virtualenvwrapper-interactive
- test-with-virtualenvwrapper-and-venvwraprc-noninterative
- test-with-virtualenvwrapper-and-venvwraprc-interactive
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
with:
python-version: "3.9"
- name: "Build distribution"
run: |
python -m pip install --upgrade pip
python -m pip install build
python -m build
- name: "Check wheel contents"
run: |
python -m pip install check-wheel-contents
check-wheel-contents dist/*.whl
- name: "Check long description is renderable"
run: |
python -m pip install twine
python -m twine check dist/*
- name: Publish package
if: startsWith(github.ref, 'refs/tags/release/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}