|
1 | | -name: GH |
| 1 | +name: Checklist |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | pull_request: |
5 | | - branches: '*' |
| 5 | + branches: [master] |
6 | 6 | push: |
7 | | - branches: 'master' |
8 | | - tags: '*' |
| 7 | + branches: [master] |
9 | 8 |
|
10 | 9 | jobs: |
11 | | - CI: |
| 10 | + linting: |
12 | 11 | runs-on: ubuntu-latest |
13 | 12 | strategy: |
14 | | - max-parallel: 8 |
| 13 | + fail-fast: true |
15 | 14 | matrix: |
16 | | - python-version: [3.5, 3.6, 3.7, 3.8, 3.9, 3.10] |
| 15 | + python-version: ["3.9", "3.10", "3.11"] |
17 | 16 | steps: |
18 | | - - uses: actions/checkout@v2 |
19 | | - |
20 | | - - name: Set up Python ${{ matrix.python-version }} |
21 | | - uses: actions/setup-python@v2 |
22 | | - with: |
23 | | - python-version: ${{ matrix.python-version }} |
24 | | - |
25 | | - - name: Pip cache |
26 | | - uses: actions/cache@v2 |
27 | | - with: |
28 | | - path: ~/.cache/pip |
29 | | - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements/*.txt') }} |
30 | | - restore-keys: | |
31 | | - ${{ runner.os }}-pip- |
32 | | - - name: Install dependencies |
33 | | - run: pip install -e ".[test]" |
34 | | - |
35 | | - - name: Lint |
36 | | - run: | |
37 | | - isort --recursive --diff validators tests && isort --recursive --check-only validators tests |
38 | | - flake8 validators tests |
39 | | -
|
40 | | - - name: Test |
41 | | - run: py.test --doctest-glob="*.rst" --doctest-modules --ignore=setup.py |
| 17 | + #---------------------------------------------- |
| 18 | + # check-out repo and set-up python |
| 19 | + #---------------------------------------------- |
| 20 | + - uses: actions/checkout@v3 |
| 21 | + - name: Set up Python ${{ matrix.python-version }} |
| 22 | + id: setup-python |
| 23 | + uses: actions/setup-python@v4 |
| 24 | + with: |
| 25 | + python-version: ${{ matrix.python-version }} |
| 26 | + #---------------------------------------------- |
| 27 | + # install & configure poetry |
| 28 | + #---------------------------------------------- |
| 29 | + - name: Install Poetry |
| 30 | + uses: snok/install-poetry@v1 |
| 31 | + with: |
| 32 | + version: 1.3.2 |
| 33 | + virtualenvs-create: true |
| 34 | + virtualenvs-in-project: false |
| 35 | + virtualenvs-path: ~/.cache/pypoetry/virtualenvs |
| 36 | + installer-parallel: true |
| 37 | + #---------------------------------------------- |
| 38 | + # load cached venv if cache exists |
| 39 | + #---------------------------------------------- |
| 40 | + - name: Load cached venv |
| 41 | + id: cached-poetry-dependencies |
| 42 | + uses: actions/cache@v3 |
| 43 | + with: |
| 44 | + path: ~/.cache/pypoetry/virtualenvs/validators-*-py*/ |
| 45 | + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} |
| 46 | + #---------------------------------------------- |
| 47 | + # install dependencies if cache does not exist |
| 48 | + #---------------------------------------------- |
| 49 | + - name: Install dependencies |
| 50 | + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' |
| 51 | + run: poetry install --no-interaction --no-root |
| 52 | + #---------------------------------------------- |
| 53 | + # run test suite |
| 54 | + #---------------------------------------------- |
| 55 | + - name: Test |
| 56 | + run: | |
| 57 | + source ~/.cache/pypoetry/virtualenvs/validators-*-py*/bin/activate |
| 58 | + pytest tests/ |
0 commit comments