|
| 1 | +--- |
| 2 | +name: CI |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + - dev |
| 9 | + pull_request: |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +env: |
| 13 | + UV_CACHE_DIR: /tmp/.uv-cache |
| 14 | + PROJECT_PATH: "src/memory_profiler" |
| 15 | + |
| 16 | +jobs: |
| 17 | + code-quality: |
| 18 | + name: Check code quality |
| 19 | + runs-on: ubuntu-latest |
| 20 | + |
| 21 | + steps: |
| 22 | + # https://github.com/actions/checkout |
| 23 | + - name: ⤵️ Checkout repository |
| 24 | + uses: actions/checkout@v4 |
| 25 | + |
| 26 | + # https://github.com/astral-sh/setup-uv |
| 27 | + - name: 🏗 Install uv and Python |
| 28 | + uses: astral-sh/setup-uv@v6 |
| 29 | + with: |
| 30 | + enable-cache: true |
| 31 | + cache-dependency-glob: "uv.lock" |
| 32 | + cache-local-path: ${{ env.UV_CACHE_DIR }} |
| 33 | + python-version: "3.13" |
| 34 | + |
| 35 | + - name: 🏗 Install the project |
| 36 | + run: uv sync --locked --dev |
| 37 | + |
| 38 | + - name: Run mypy |
| 39 | + run: uv run --frozen mypy ${{ env.PROJECT_PATH }}/ |
| 40 | + - name: Pylint review |
| 41 | + run: uv run --frozen pylint ${{ env.PROJECT_PATH }}/ |
| 42 | + - name: Ruff check |
| 43 | + run: uv run --frozen ruff check ${{ env.PROJECT_PATH }}/ |
| 44 | + |
| 45 | + tests: |
| 46 | + name: Run tests |
| 47 | + runs-on: ubuntu-latest |
| 48 | + |
| 49 | + strategy: |
| 50 | + matrix: |
| 51 | + python-version: |
| 52 | + - "3.10" |
| 53 | + - "3.11" |
| 54 | + - "3.12" |
| 55 | + - "3.13" |
| 56 | + |
| 57 | + steps: |
| 58 | + # https://github.com/actions/checkout |
| 59 | + - name: ⤵️ Checkout repository |
| 60 | + uses: actions/checkout@v4 |
| 61 | + |
| 62 | + # https://github.com/astral-sh/setup-uv |
| 63 | + - name: 🏗 Install uv and Python ${{ matrix.python-version }} |
| 64 | + uses: astral-sh/setup-uv@v6 |
| 65 | + with: |
| 66 | + enable-cache: true |
| 67 | + cache-dependency-glob: "uv.lock" |
| 68 | + cache-local-path: ${{ env.UV_CACHE_DIR }} |
| 69 | + python-version: ${{ matrix.python-version }} |
| 70 | + |
| 71 | + - name: 🏗 Install the project |
| 72 | + run: uv sync --locked --dev |
| 73 | + |
| 74 | + - name: Run pytest |
| 75 | + run: uv run --frozen pytest tests/ --cov=./ --cov-report=xml --junitxml=pytest-report.xml |
| 76 | + |
| 77 | + # https://github.com/actions/upload-artifact |
| 78 | + - name: Upload test report |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: pytest-report-${{ matrix.python-version }} |
| 82 | + path: pytest-report.xml |
| 83 | + |
| 84 | + # https://github.com/actions/upload-artifact |
| 85 | + - name: Upload coverage results |
| 86 | + uses: actions/upload-artifact@v4 |
| 87 | + with: |
| 88 | + name: coverage-results-${{ matrix.python-version }} |
| 89 | + path: coverage.xml |
| 90 | + |
| 91 | + # # https://github.com/codecov/codecov-action |
| 92 | + # - name: Upload coverage to Codecov |
| 93 | + # uses: codecov/codecov-action@v5 |
| 94 | + # with: |
| 95 | + # token: ${{ secrets.CODECOV_TOKEN }} |
| 96 | + # fail_ci_if_error: true |
0 commit comments