|
10 | 10 | jobs:
|
11 | 11 | lint-test:
|
12 | 12 | runs-on: ubuntu-latest
|
13 |
| - env: |
14 |
| - # Configure pip to cache dependencies and do a user install |
15 |
| - PIP_NO_CACHE_DIR: false |
16 |
| - PIP_USER: 1 |
17 |
| - |
18 |
| - # Make sure package manager does not use virtualenv |
19 |
| - POETRY_VIRTUALENVS_CREATE: false |
20 |
| - |
21 |
| - # Specify explicit paths for python dependencies and the pre-commit |
22 |
| - # environment so we know which directories to cache |
23 |
| - POETRY_CACHE_DIR: ${{ github.workspace }}/.cache/py-user-base |
24 |
| - PYTHONUSERBASE: ${{ github.workspace }}/.cache/py-user-base |
25 |
| - PRE_COMMIT_HOME: ${{ github.workspace }}/.cache/pre-commit-cache |
26 | 13 |
|
27 | 14 | steps:
|
28 |
| - - name: Add custom PYTHONUSERBASE to PATH |
29 |
| - run: echo '${{ env.PYTHONUSERBASE }}/bin/' >> $GITHUB_PATH |
30 |
| - |
31 | 15 | - name: Checkout repository
|
32 | 16 | uses: actions/checkout@v2
|
33 | 17 |
|
34 |
| - - name: Setup python |
35 |
| - id: python |
36 |
| - uses: actions/setup-python@v2 |
| 18 | + - name: Install Python Dependencies |
| 19 | + uses: HassanAbouelela/actions/setup-python@setup-python_v1.3.1 |
37 | 20 | with:
|
38 |
| - python-version: '3.9' |
| 21 | + dev: true |
| 22 | + python_version: '3.9' |
39 | 23 |
|
40 | 24 | # Start the database early to give it a chance to get ready before
|
41 | 25 | # we start running tests.
|
42 | 26 | - name: Run database using docker-compose
|
43 | 27 | run: docker-compose run -d -p 7777:5432 --name pydis_web postgres
|
44 | 28 |
|
45 |
| - # This step caches our Python dependencies. To make sure we |
46 |
| - # only restore a cache when the dependencies, the python version, |
47 |
| - # the runner operating system, and the dependency location haven't |
48 |
| - # changed, we create a cache key that is a composite of those states. |
49 |
| - # |
50 |
| - # Only when the context is exactly the same, we will restore the cache. |
51 |
| - - name: Python Dependency Caching |
52 |
| - uses: actions/cache@v2 |
53 |
| - id: python_cache |
54 |
| - with: |
55 |
| - path: ${{ env.PYTHONUSERBASE }} |
56 |
| - key: "python-0-${{ runner.os }}-${{ env.PYTHONUSERBASE }}-\ |
57 |
| - ${{ steps.python.outputs.python-version }}-\ |
58 |
| - ${{ hashFiles('./pyproject.toml', './poetry.lock') }}" |
59 |
| - |
60 |
| - # Install our dependencies if we did not restore a dependency cache |
61 |
| - - name: Install dependencies using poetry |
62 |
| - if: steps.python_cache.outputs.cache-hit != 'true' |
63 |
| - run: | |
64 |
| - pip install poetry |
65 |
| - poetry install |
66 |
| -
|
67 |
| - # This step caches our pre-commit environment. To make sure we |
68 |
| - # do create a new environment when our pre-commit setup changes, |
69 |
| - # we create a cache key based on relevant factors. |
70 |
| - - name: Pre-commit Environment Caching |
71 |
| - uses: actions/cache@v2 |
72 |
| - with: |
73 |
| - path: ${{ env.PRE_COMMIT_HOME }} |
74 |
| - key: "precommit-0-${{ runner.os }}-${{ env.PRE_COMMIT_HOME }}-\ |
75 |
| - ${{ steps.python.outputs.python-version }}-\ |
76 |
| - ${{ hashFiles('./.pre-commit-config.yaml') }}" |
77 |
| - |
78 | 29 | # We will not run `flake8` here, as we will use a separate flake8
|
79 |
| - # action. As pre-commit does not support user installs, we set |
80 |
| - # PIP_USER=0 to not do a user install. |
| 30 | + # action. |
81 | 31 | - name: Run pre-commit hooks
|
82 |
| - run: export PIP_USER=0; SKIP=flake8 pre-commit run --all-files |
| 32 | + run: SKIP=flake8 pre-commit run --all-files |
83 | 33 |
|
84 | 34 | # Run flake8 and have it format the linting errors in the format of
|
85 | 35 | # the GitHub Workflow command to register error annotations. This
|
|
0 commit comments