Overhaul CI to improve resilance and efficiency

Add caching for pip and poetry downloads to reduce runtime
Add pinned pip version
Add poetry installation of local project
Remove bare pip install for local project installation
This commit is contained in:
2020-12-05 12:36:35 -05:00
parent db761d49c1
commit 52aaeba93c
2 changed files with 111 additions and 12 deletions

View File

@@ -20,24 +20,51 @@ jobs:
- version: 3.9
toxenv: py39
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python.version }}
- name: Checkout
uses: actions/checkout@v2
- name: Setup:python${{ matrix.python.version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python.version }}
- name: Install project
run: pip install .
- name: Run tests via ${{ matrix.python.toxenv }}
run: tox -e ${{ matrix.python.toxenv }}
- name: Setup:cache
uses: actions/cache@v2
with:
path: |
~/.cache/pip
~/.cache/pypoetry/cache
~/.poetry
# Including the hashed poetry.lock in the cache slug ensures that the cache
# will be invalidated, and thus all packages will be redownloaded, if the
# lockfile is updated
key: ${{ runner.os }}-${{ matrix.python.toxenv }}-${{ hashFiles('**/poetry.lock') }}
- name: Setup:env
run: .github/scripts/setup-env.sh
- name: Run:${{ matrix.python.toxenv }}
run: $HOME/ci/bin/tox -e ${{ matrix.python.toxenv }}
Check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Checkout
uses: actions/checkout@v2
- name: Setup:python3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install project
run: pip install .
- name: Run meta checks
run: tox -e static -e static-tests -e security
- name: Setup:cache
uses: actions/cache@v2
with:
path: |
~/.cache/pip
~/.cache/pypoetry/cache
~/.poetry
# Hardcoded 'py38' slug here lets this cache piggyback on the 'py38' cache
# that is generated for the tests above
key: ${{ runner.os }}-py38-${{ hashFiles('**/poetry.lock') }}
- name: Setup:env
run: .github/scripts/setup-env.sh
- name: Run:static
run: $HOME/ci/bin/tox -e static
- name: Run:static-tests
run: $HOME/ci/bin/tox -e static-tests
- name: Run:security
run: $HOME/ci/bin/tox -e security