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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
---
name: Pull request build
on:
pull_request:
branches:
- dev
env:
MAIN_PY_VER: "3.13"
jobs:
lint:
runs-on: ubuntu-latest
name: Lint source files
permissions:
pull-requests: read
steps:
- name: Source checkout
uses: actions/checkout@v5
- name: Set up Python ${{ env.MAIN_PY_VER }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.MAIN_PY_VER }}
- name: Cache pip repository
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ env.MAIN_PY_VER }}
- name: Prepare python environment
run: |
pip install -r requirements.txt
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Cache poetry virtual environment
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/pyproject.toml') }}-${{ env.MAIN_PY_VER }}
- name: Lint the project
run: |
poetry lock
poetry install --no-interaction
poetry run poe lint
test:
runs-on: ubuntu-latest
needs: [lint]
strategy:
matrix:
python: ["3.12", "3.13"]
name: Test project with Python ${{ matrix.python }}
permissions:
checks: write
pull-requests: write
steps:
- name: Source checkout
uses: actions/checkout@v5
- name: Setup timezone
uses: zcong1993/setup-timezone@v2.0.0
with:
timezone: Asia/Jerusalem
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
- name: Cache pip repository
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ matrix.python }}
- name: Prepare python environment
run: |
pip install -r requirements.txt
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Cache poetry virtual environment
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/pyproject.toml') }}-${{ matrix.python }}
- name: Install project build dependencies
run: |
poetry lock
poetry install --no-interaction
- name: Test the project
run: >
if [ ${{ matrix.python }} == ${{ env.MAIN_PY_VER }} ];
then poetry run poe test_rep;
else poetry run poe test; fi
- name: Report test summary
uses: EnricoMi/publish-unit-test-result-action@v2
if: ${{ matrix.python == env.MAIN_PY_VER && always() }}
with:
test_changes_limit: 0
junit_files: ./junit.xml
report_individual_runs: true
- name: Push to CodeCov
uses: codecov/codecov-action@v5
if: ${{ matrix.python == env.MAIN_PY_VER }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
docs:
runs-on: ubuntu-latest
needs: [lint]
name: Verify documentation site
permissions:
pull-requests: read
steps:
- name: Source checkout
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.MAIN_PY_VER }}
- name: Cache pip repository
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ env.MAIN_PY_VER }}
- name: Prepare python environment
run: |
pip install -r requirements.txt
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Cache poetry virtual environment
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/pyproject.toml') }}-${{ env.MAIN_PY_VER }}
- name: Build documentation site
run: |
poetry lock
poetry install --no-interaction
poetry run poe docs_build
|