Skip to content

Commit

Permalink
Merge pull request #5 from hypothesis/cache-the-tox-dir-for-pypackages
Browse files Browse the repository at this point in the history
Move to `cache-the-tox-dir-for-pypackages`
  • Loading branch information
seanh authored Jul 11, 2022
2 parents e4dce91 + 3210589 commit 0cf8360
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
1 change: 1 addition & 0 deletions .cookiecutter/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"template": "https://github.com/hypothesis/cookiecutters",
"directory": "pypackage",
"checkout": "cache-the-tox-dir-for-pypackages",
"ignore": [],
"extra_context": {
"name": "cookiecutter-pypackage-test",
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: CI
on:
push:
workflow_dispatch:
inputs:
rm_tox_dir:
description: 'Delete and recreate cached .tox dir'
type: boolean
required: true
default: false
schedule:
- cron: '0 1 * * *'
jobs:
Expand All @@ -13,7 +19,14 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Cache the .tox dir
uses: actions/cache@v3
with:
path: .tox
key: format-${{ runner.os }}-tox-${{ hashFiles('tox.ini') }}-${{ hashFiles('setup.cfg') }}
- run: python -m pip install tox
- if: github.event.schedule || inputs.rm_tox_dir || endsWith(github.head_ref, '-rm-tox-dir')
run: rm -rf .tox/checkformatting
- run: tox -e checkformatting
Lint:
runs-on: ubuntu-latest
Expand All @@ -23,7 +36,14 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Cache the .tox dir
uses: actions/cache@v3
with:
path: .tox
key: lint-${{ runner.os }}-tox-${{ hashFiles('tox.ini') }}-${{ hashFiles('setup.cfg') }}
- run: python -m pip install tox
- if: github.event.schedule || inputs.rm_tox_dir || endsWith(github.head_ref, '-rm-tox-dir')
run: rm -rf .tox/lint
- run: tox -e lint
Tests:
runs-on: ubuntu-latest
Expand All @@ -37,7 +57,14 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache the .tox dir
uses: actions/cache@v3
with:
path: .tox
key: tests-${{ runner.os }}-${{ matrix.python-version }}-tox-${{ hashFiles('tox.ini') }}-${{ hashFiles('setup.cfg') }}
- run: python -m pip install tox
- if: github.event.schedule || inputs.rm_tox_dir || endsWith(github.head_ref, '-rm-tox-dir')
run: rm -rf .tox/tests
- run: tox -e tests
- name: Upload coverage file
uses: actions/upload-artifact@v3
Expand All @@ -53,11 +80,18 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Cache the .tox dir
uses: actions/cache@v3
with:
path: .tox
key: coverage-${{ runner.os }}-tox-${{ hashFiles('tox.ini') }}-${{ hashFiles('setup.cfg') }}
- name: Download coverage files
uses: actions/download-artifact@v3
with:
name: coverage
- run: python -m pip install tox
- if: github.event.schedule || inputs.rm_tox_dir || endsWith(github.head_ref, '-rm-tox-dir')
run: rm -rf .tox/coverage
- run: tox -e coverage
Functests:
runs-on: ubuntu-latest
Expand All @@ -71,5 +105,12 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache the .tox dir
uses: actions/cache@v3
with:
path: .tox
key: functests-${{ runner.os }}-${{ matrix.python-version }}-tox-${{ hashFiles('tox.ini') }}-${{ hashFiles('setup.cfg') }}
- run: python -m pip install tox
- if: github.event.schedule || inputs.rm_tox_dir || endsWith(github.head_ref, '-rm-tox-dir')
run: rm -rf .tox/functests
- run: tox -e functests
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ envlist = tests
minversion = 3.25.0
requires =
tox-envfile
tox-faster
tox-faster>=0.0.4
tox-run-command
tox-recreate
isolated_build = true
Expand Down

0 comments on commit 0cf8360

Please sign in to comment.