tweak shell tests #55
Workflow file for this run
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: main | |
on: [push] | |
env: | |
PYTHON_VERSION: "3.11" | |
POETRY_VERSION: "1.7.1" | |
POETRY_URL: https://install.python-poetry.org | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
id: setup_python | |
# Poetry cache depends on OS, Python version and Poetry version. | |
- name: Cache Poetry cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pypoetry | |
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }} | |
# virtualenv cache should depends on OS, Python version and `poetry.lock` (and optionally workflow files). | |
- name: Cache Packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.local | |
key: poetry-local-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }} | |
- name: Cache pre-commit | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pre-commit/ | |
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Install Poetry ${{ env.POETRY_VERSION }} | |
run: | | |
curl -sSL ${{ env.POETRY_URL }} | python - --version ${{ env.POETRY_VERSION }} | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Install Dependencies | |
run: poetry install | |
- name: Run pre-commit | |
run: poetry run pre-commit run -av | |
pytest: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
id: setup_python | |
# Poetry cache depends on OS, Python version and Poetry version. | |
- name: Cache Poetry cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pypoetry | |
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }} | |
# virtualenv cache should depends on OS, Python version and `poetry.lock` (and optionally workflow files). | |
- name: Cache Packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.local | |
key: poetry-local-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }} | |
- name: Install Poetry ${{ env.POETRY_VERSION }} | |
run: | | |
curl -sSL ${{ env.POETRY_URL }} | python - --version ${{ env.POETRY_VERSION }} | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Install Dependencies | |
run: poetry install | |
- name: Run tests | |
run: | | |
poetry run python -m pytest -sxv | |
- name: Generate coverage | |
run: poetry run pytest -vv --cov=directory_cleaner --cov-report=lcov | |
- name: Report Coveralls (Linux) | |
run: curl -sL https://coveralls.io/coveralls-linux.tar.gz | tar -xz && ./coveralls | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} |