Skip to content

Commit 30a58d9

Browse files
committed
Add back in GitHub Actions caching
Also: - Move flake8 linting to its own workflow - Add new workflow for Sphinx documentation build
1 parent 500b13d commit 30a58d9

File tree

3 files changed

+101
-10
lines changed

3 files changed

+101
-10
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,16 @@ jobs:
3333
uses: actions/setup-python@v2 # https://github.com/actions/setup-python
3434
with:
3535
python-version: ${{ matrix.python-version }}
36-
# - name: Cache dependencies
37-
# id: cache-deps
38-
# uses: actions/cache@v2 # https://github.com/actions/cache
39-
# with:
40-
# path: ~/.cache/pip
41-
# key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
36+
- name: Cache dependencies
37+
id: cache-deps
38+
uses: actions/cache@v2 # https://github.com/actions/cache
39+
with:
40+
path: ~/.cache/pip
41+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
4242
- name: Install python prerequisites
4343
# Only install dependencies when there is a cache miss
44-
# if: steps.cache-deps.outputs.cache-hit != 'true'
44+
if: steps.cache-deps.outputs.cache-hit != 'true'
4545
run: pip install -U --user pip setuptools setuptools-scm flake8 nox
46-
- name: Lint
47-
if: matrix.os == 'ubuntu-latest' && matrix.python-version == env.PYTHON_LATEST
48-
run: python -m flake8 . --count --ignore=E252,W503 --max-complexity=26 --max-line-length=127 --show-source --statistics ;
4946
- name: Run tests and post coverage results
5047
env:
5148
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/doc.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# For documentation on GitHub Actions Workflows, see:
2+
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
3+
name: Doc
4+
5+
on:
6+
push:
7+
branches:
8+
- master
9+
- 2.0
10+
pull_request:
11+
branches:
12+
- master
13+
- 2.0
14+
15+
env:
16+
PYTHON_LATEST: 3.9
17+
18+
jobs:
19+
ci:
20+
strategy:
21+
matrix:
22+
os: [ubuntu-latest]
23+
python-version: [3.9]
24+
fail-fast: false
25+
runs-on: ${{ matrix.os }}
26+
steps:
27+
- uses: actions/checkout@v2 # https://github.com/actions/checkout
28+
with:
29+
# Only a single commit is fetched by default, for the ref/SHA that triggered the workflow.
30+
# Set fetch-depth: 0 to fetch all history for all branches and tags.
31+
fetch-depth: 0 # Needed for setuptools_scm to work correctly
32+
- name: Set up Python
33+
uses: actions/setup-python@v2 # https://github.com/actions/setup-python
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
- name: Cache dependencies
37+
id: cache-deps
38+
uses: actions/cache@v2 # https://github.com/actions/cache
39+
with:
40+
path: ~/.cache/pip
41+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
42+
- name: Install python prerequisites
43+
# Only install dependencies when there is a cache miss
44+
if: steps.cache-deps.outputs.cache-hit != 'true'
45+
run: pip install -U --user pip setuptools setuptools-scm flake8 nox
46+
- name: Sphinx documentation build
47+
run: python -m nox --non-interactive --session docs # Run nox just for documentation build

.github/workflows/lint.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# For documentation on GitHub Actions Workflows, see:
2+
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
3+
name: Lint
4+
5+
on:
6+
push:
7+
branches:
8+
- master
9+
- 2.0
10+
pull_request:
11+
branches:
12+
- master
13+
- 2.0
14+
15+
env:
16+
PYTHON_LATEST: 3.9
17+
18+
jobs:
19+
ci:
20+
strategy:
21+
matrix:
22+
os: [ubuntu-latest]
23+
python-version: [3.9]
24+
fail-fast: false
25+
runs-on: ${{ matrix.os }}
26+
steps:
27+
- uses: actions/checkout@v2 # https://github.com/actions/checkout
28+
with:
29+
# Only a single commit is fetched by default, for the ref/SHA that triggered the workflow.
30+
# Set fetch-depth: 0 to fetch all history for all branches and tags.
31+
fetch-depth: 0 # Needed for setuptools_scm to work correctly
32+
- name: Set up Python
33+
uses: actions/setup-python@v2 # https://github.com/actions/setup-python
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
- name: Cache dependencies
37+
id: cache-deps
38+
uses: actions/cache@v2 # https://github.com/actions/cache
39+
with:
40+
path: ~/.cache/pip
41+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
42+
- name: Install python prerequisites
43+
# Only install dependencies when there is a cache miss
44+
if: steps.cache-deps.outputs.cache-hit != 'true'
45+
run: pip install -U --user pip setuptools setuptools-scm flake8 nox
46+
- name: Lint
47+
run: python -m flake8 . --count --ignore=E252,W503 --max-complexity=26 --max-line-length=127 --show-source --statistics ;

0 commit comments

Comments
 (0)