diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 4ce4fb0..1cf0020 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -4,31 +4,51 @@ on: pull_request: branches: - main + push: + branches: + - dev + jobs: - build: + pylint: + name: pylint runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write strategy: matrix: python-version: ["3.11"] steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pylint pylint-junit - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Analysing the code with pylint - run: | - pylint $(git ls-files '*.py') --exit-zero \ - --reports=y \ - --output-format=junit-xml:pylint.xml + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + - uses: dciborow/action-pylint@0.1.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + glob_pattern: "**/*.py" + pylint_rc: .pylintrc + reporter: github-pr-review + level: warning + + # - name: Generate pylint JUnit report + # run: | + # FILES=$(git ls-files '*.py') + # if [ -n "$FILES" ]; then + # pylint $FILES --output-format=junit-xml:pylint.xml + # fi - - name: upload artifact - uses: actions/upload-artifact@v6 - with: - name: pylint-report - path: pylint.xml + # - name: Upload artifact + # uses: actions/upload-artifact@v6 + # with: + # name: pylint-report + # path: pylint.xml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c78b55f..199ba13 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,13 +1,10 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python - -name: tests +name: Tests on: push: branches: [ "main", "dev" ] pull_request: - branches: [ "main", "dev", "tests/tests-new-enpoints-and-crud" ] + branches: [ "main", "dev" ] permissions: contents: read @@ -42,11 +39,12 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.11" + cache: "pip" - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pytest pytest-cov alembic + pip install pytest-cov if [ -f orders_service/requirements-dev.txt ]; then pip install -r orders_service/requirements-dev.txt; fi - name: Wait for Postgres @@ -60,7 +58,7 @@ jobs: # env: # DATABASE_URL: postgresql://test:test@localhost:5432/test_db - - name: Integration tests with pytest + - name: Tests with pytest run: | mkdir -p logs LOGFILE="logs/pytest-$(date +'%Y-%m-%d_%H%M%S').log"