2019-10-18 14:39:22 +00:00
|
|
|
---
|
|
|
|
name: build
|
|
|
|
|
2020-01-24 22:10:49 +00:00
|
|
|
on: [
|
|
|
|
push,
|
|
|
|
pull_request
|
|
|
|
]
|
2019-10-18 14:39:22 +00:00
|
|
|
|
2020-03-04 13:41:59 +00:00
|
|
|
env:
|
|
|
|
PIP_CACHE_DIR: ~/.cache/pip
|
|
|
|
PRE_COMMIT_CACHE_DIR: ~/.cache/pre-commit
|
|
|
|
|
2019-10-18 14:39:22 +00:00
|
|
|
jobs:
|
2020-04-06 23:02:31 +00:00
|
|
|
lint:
|
2019-10-18 14:39:22 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2020-02-11 15:41:17 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-python@v1
|
2019-10-18 14:39:22 +00:00
|
|
|
with:
|
2020-02-11 15:41:17 +00:00
|
|
|
python-version: 3.8
|
2020-03-03 21:49:53 +00:00
|
|
|
- name: Store installed Python version
|
|
|
|
run: |
|
|
|
|
echo "::set-env name=PY_VERSION::"\
|
|
|
|
"$(python -c "import platform;print(platform.python_version())")"
|
2019-11-05 19:27:20 +00:00
|
|
|
- name: Cache pip test requirements
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
2020-03-04 13:41:59 +00:00
|
|
|
path: ${{ env.PIP_CACHE_DIR }}
|
2020-03-03 21:49:53 +00:00
|
|
|
key: "${{ runner.os }}-pip-test-py${{ env.PY_VERSION }}-\
|
2019-11-05 19:27:20 +00:00
|
|
|
${{ hashFiles('**/requirements-test.txt') }}"
|
|
|
|
restore-keys: |
|
2020-03-03 21:49:53 +00:00
|
|
|
${{ runner.os }}-pip-test-py${{ env.PY_VERSION }}-
|
2019-11-05 19:27:20 +00:00
|
|
|
${{ runner.os }}-pip-test-
|
|
|
|
${{ runner.os }}-pip-
|
2020-02-12 05:14:11 +00:00
|
|
|
- name: Cache pre-commit hooks
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
2020-03-04 13:41:59 +00:00
|
|
|
path: ${{ env.PRE_COMMIT_CACHE_DIR }}
|
2020-03-03 21:49:53 +00:00
|
|
|
key: "${{ runner.os }}-pre-commit-py${{ env.PY_VERSION }}-\
|
2020-02-12 05:14:11 +00:00
|
|
|
${{ hashFiles('**/.pre-commit-config.yaml') }}"
|
2019-10-18 14:39:22 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
2020-02-18 23:04:06 +00:00
|
|
|
pip install --upgrade --requirement requirements-test.txt
|
2020-04-06 23:02:31 +00:00
|
|
|
- name: Set up pre-commit hook environments
|
2020-04-06 17:47:18 +00:00
|
|
|
run: pre-commit install-hooks
|
2019-10-18 14:39:22 +00:00
|
|
|
- name: Run pre-commit on all files
|
|
|
|
run: pre-commit run --all-files
|