|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | +jobs: |
| 8 | + validate: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v3 |
| 12 | + - uses: actions/setup-python@v4 |
| 13 | + with: |
| 14 | + python-version: "3.11" |
| 15 | + - name: Install Pre-Commit |
| 16 | + run: python -m pip install pre-commit && pre-commit install |
| 17 | + - name: Load cached Pre-Commit Dependencies |
| 18 | + id: cached-pre-commit-dependencies |
| 19 | + uses: actions/cache@v3 |
| 20 | + with: |
| 21 | + path: ~/.cache/pre-commit/ |
| 22 | + key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} |
| 23 | + - name: Execute Pre-Commit |
| 24 | + run: pre-commit run --show-diff-on-failure --color=always --all-files |
| 25 | + test: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + strategy: |
| 28 | + fail-fast: true |
| 29 | + matrix: |
| 30 | + python-version: ["3.11"] |
| 31 | + steps: |
| 32 | + - name: Check out repository |
| 33 | + uses: actions/checkout@v3 |
| 34 | + - name: Set up python ${{ matrix.python-version }} |
| 35 | + uses: actions/setup-python@v4 |
| 36 | + with: |
| 37 | + python-version: ${{ matrix.python-version }} |
| 38 | + - name: Install Poetry |
| 39 | + uses: snok/install-poetry@v1 |
| 40 | + with: |
| 41 | + virtualenvs-create: true |
| 42 | + virtualenvs-in-project: true |
| 43 | + installer-parallel: true |
| 44 | + - name: Load cached venv |
| 45 | + id: cached-poetry-dependencies |
| 46 | + uses: actions/cache@v3 |
| 47 | + with: |
| 48 | + path: .venv |
| 49 | + key: v1-venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} |
| 50 | + - name: Install dependencies |
| 51 | + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' |
| 52 | + run: poetry install --no-interaction |
| 53 | + - name: Set pythonpath |
| 54 | + run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV |
| 55 | + - name: Test with Coverage |
| 56 | + if: matrix.python-version == '3.11' |
| 57 | + run: poetry run pytest --cov=. --cov-report=xml |
| 58 | + - uses: actions/upload-artifact@v3 |
| 59 | + if: matrix.python-version == '3.11' |
| 60 | + with: |
| 61 | + name: coverage-xml |
| 62 | + path: coverage.xml |
0 commit comments