CI #217
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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: "Disable conda" | |
# Conda is installed by default on GitHub Actions and interferes with pyenv | |
# Sadly, pyenv-virtualenv doesn't work with conda anymore | |
# https://github.com/pyenv/pyenv-virtualenv/issues/270 | |
# We crudely remove it by deleting the binary - this is sufficient to stop | |
# pyenv-virtualenv from trying to use it | |
run: | | |
sudo rm /usr/bin/conda | |
- name: "Install pyenv" | |
uses: "gabrielfalcao/pyenv-action@v16" | |
- name: "Configure pyenv-virtualenv" | |
run: | | |
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 | |
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv | |
- name: "Install test dependencies" | |
run: | | |
python -m pip install --user --upgrade pip | |
python -m pip install --user .[test] | |
- name: "Run Pytest" | |
run: | | |
export VENV_MANAGEMENT_INTERACTIVE_SHELL=yes | |
python -m pytest tests | |
test-with-pyenv-noninteractive: | |
name: "Pytest with pyenv virtualenv non-interactive" | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: "Checkout repo" | |
uses: actions/checkout@v2 | |
- name: "Disable conda" | |
# Conda is installed by default on GitHub Actions and interferes with pyenv | |
# Sadly, pyenv-virtualenv doesn't work with conda anymore | |
# https://github.com/pyenv/pyenv-virtualenv/issues/270 | |
# We crudely remove it by deleting the binary - this is sufficient to stop | |
# pyenv-virtualenv from trying to use it | |
run: | | |
sudo rm /usr/bin/conda | |
- name: "Install pyenv" | |
uses: "gabrielfalcao/pyenv-action@v16" | |
- name: "Configure pyenv-virtualenv" | |
run: | | |
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.venvwraprc | |
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.venvwraprc | |
echo 'eval "$(pyenv init -)"' >> ~/.venvwraprc | |
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv | |
- name: "Install test dependencies" | |
run: | | |
python -m pip install --user --upgrade pip | |
python -m pip install --user .[test] | |
- name: "Run Pytest" | |
run: | | |
export VENV_MANAGEMENT_SETUP_FILEPATH=${HOME}/.venvwraprc | |
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-pyenv-interactive | |
- test-with-pyenv-noninteractive | |
- 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 }} |