This repository was archived by the owner on Jul 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (52 loc) · 2.09 KB
/
python-package.yml
File metadata and controls
61 lines (52 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python package
on:
pull_request:
types: [opened, reopened, synchronize]
branches: ["main", "develop"]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pylint pytest pytest-depends pytz
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Analysing the code with pylint
id: pylint
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "SUMMARY<<$EOF" >> "$GITHUB_OUTPUT"
echo "# Pylint Report (Python ${{ matrix.python-version }})" >> "$GITHUB_OUTPUT"
pylint $(git ls-files '*.py') --output pylint_summary --exit-zero --msg-template '{path}:{line}:{column}: {msg_id}: ({symbol}) \n\`\`\`python\n{msg}\n\`\`\`'
cat pylint_summary >> "$GITHUB_OUTPUT"
echo "$EOF" >> "$GITHUB_OUTPUT"
cat pylint_summary >> "$GITHUB_STEP_SUMMARY"
- name: Test with pytest
env:
FACTURAPI_API_KEY: ${{ secrets.FACTURAPI_API_KEY }}
PYTHONPATH: ./src
run: |
pytest
- name: Generating lint summary comment
if: ${{ github.actor != 'dependabot[bot]' }}
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `${{steps.pylint.outputs.SUMMARY}}`
})