|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, develop ] |
| 6 | + pull_request: |
| 7 | + branches: [ main, develop ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + lint: |
| 11 | + name: Lint |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Set up Python |
| 17 | + uses: actions/setup-python@v5 |
| 18 | + with: |
| 19 | + python-version: "3.11" |
| 20 | + |
| 21 | + - name: Install Poetry |
| 22 | + uses: snok/install-poetry@v1 |
| 23 | + with: |
| 24 | + version: 2.3.1 |
| 25 | + virtualenvs-create: true |
| 26 | + virtualenvs-in-project: true |
| 27 | + |
| 28 | + - name: Load cached venv |
| 29 | + id: cached-poetry-dependencies |
| 30 | + uses: actions/cache@v4 |
| 31 | + with: |
| 32 | + path: .venv |
| 33 | + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} |
| 34 | + |
| 35 | + - name: Install dependencies |
| 36 | + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' |
| 37 | + run: poetry install --no-interaction --no-root |
| 38 | + |
| 39 | + - name: Install project |
| 40 | + run: poetry install --no-interaction |
| 41 | + |
| 42 | + - name: Run Ruff linter |
| 43 | + run: poetry run ruff check . |
| 44 | + |
| 45 | + - name: Run Ruff formatter check |
| 46 | + run: poetry run ruff format --check . |
| 47 | + |
| 48 | + - name: Run mypy |
| 49 | + run: poetry run mypy hier_config_api |
| 50 | + |
| 51 | + test: |
| 52 | + name: Test (Python ${{ matrix.python-version }}) |
| 53 | + runs-on: ubuntu-latest |
| 54 | + strategy: |
| 55 | + fail-fast: false |
| 56 | + matrix: |
| 57 | + python-version: ["3.10", "3.11", "3.12"] |
| 58 | + |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + |
| 62 | + - name: Set up Python ${{ matrix.python-version }} |
| 63 | + uses: actions/setup-python@v5 |
| 64 | + with: |
| 65 | + python-version: ${{ matrix.python-version }} |
| 66 | + |
| 67 | + - name: Install Poetry |
| 68 | + uses: snok/install-poetry@v1 |
| 69 | + with: |
| 70 | + version: 2.3.1 |
| 71 | + virtualenvs-create: true |
| 72 | + virtualenvs-in-project: true |
| 73 | + |
| 74 | + - name: Load cached venv |
| 75 | + id: cached-poetry-dependencies |
| 76 | + uses: actions/cache@v4 |
| 77 | + with: |
| 78 | + path: .venv |
| 79 | + key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} |
| 80 | + |
| 81 | + - name: Install dependencies |
| 82 | + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' |
| 83 | + run: poetry install --no-interaction --no-root |
| 84 | + |
| 85 | + - name: Install project |
| 86 | + run: poetry install --no-interaction |
| 87 | + |
| 88 | + - name: Run tests |
| 89 | + run: poetry run pytest --cov=hier_config_api --cov-report=xml --cov-report=term-missing |
| 90 | + |
| 91 | + - name: Upload coverage to Codecov |
| 92 | + uses: codecov/codecov-action@v4 |
| 93 | + if: matrix.python-version == '3.11' |
| 94 | + with: |
| 95 | + file: ./coverage.xml |
| 96 | + fail_ci_if_error: false |
0 commit comments