diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index 730b61d..2d16565 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -1,6 +1,16 @@ name: CI -on: [push, pull_request] +on: + push: + branches: + - main + pull_request: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: test: @@ -10,23 +20,21 @@ jobs: - uses: actions/setup-python@v5 with: python-version: '3.13' + cache: 'pip' - - name: Install deps and venv + - name: Install dependencies run: | - sudo ln -snf /usr/share/zoneinfo/Europe/Rome /etc/localtime - echo Europe/Rome | sudo tee /etc/timezone - sudo apt update && sudo apt install -y python3-pip python3-dev - python3 -m pip install virtualenv autopep8 packaging - virtualenv /tmp/ci_venv - /tmp/ci_venv/bin/pip install ".[full]" --extra-index-url https://download.pytorch.org/whl/cpu - /tmp/ci_venv/bin/pip install flake8 pylint pytest + python -m pip install --upgrade pip + pip install ".[full]" --extra-index-url https://download.pytorch.org/whl/cpu + pip install flake8 pylint pytest - name: Run flake8 run: | - /tmp/ci_venv/bin/flake8 . \ + flake8 . \ --max-line-length=300 \ --ignore=E701,W503,W504 \ --exclude=__init__.py,__pycache__,.venv,.env,build + - name: Run pylint run: | find . -type f -name '*.py' \ @@ -34,7 +42,7 @@ jobs: -not -path "*/__pycache__/*" \ -not -path "*/.ipynb_checkpoints/*" \ -not -path "*/tests/*" -not -path "*/examples/*" \ - -print0 | xargs -0 /tmp/ci_venv/bin/pylint --rcfile=.pylintrc -E + -print0 | xargs -0 pylint --rcfile=.pylintrc -E + - name: Run pytest - run: | - /tmp/ci_venv/bin/python -m pytest tests/ + run: pytest tests/