build(pyproject): open bot dir before linting #24
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: Python poetry package | |
on: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache Poetry | |
id: cache-poetry | |
uses: actions/[email protected] | |
with: | |
path: ~/.poetry | |
key: ${{ matrix.os }}-poetry | |
- name: Install latest version of Poetry | |
if: steps.cache-poetry.outputs.cache-hit != 'true' | |
run: | | |
curl -sSL https://install.python-poetry.org | python - | |
- name: Add Poetry to $PATH | |
run: | | |
echo "$HOME/.poetry/bin" >> $GITHUB_PATH | |
- name: Get Poetry version | |
run: poetry --version | |
- name: Check pyproject.toml validity | |
run: poetry check --no-interaction | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/[email protected] | |
with: | |
path: ${{github.workspace}}/.venv | |
key: ${{ matrix.os }}-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: ${{ matrix.os }}- | |
- name: Install deps | |
if: steps.cache-deps.cache-hit != 'true' | |
run: | | |
poetry config virtualenvs.in-project true | |
poetry install --no-interaction | |
- name: Lint with flake8 | |
run: | | |
cd ${GITHUB_WORKSPACE}/bot | |
# stop the build if there are Python syntax errors or undefined names | |
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Analysing the code with pylint | |
run: | | |
poetry run pylint bot | |
#- name: Test with pytest | |
#run: | | |
#poetry run pytest -v |