tweak github actions CI caching

This commit is contained in:
Nick Sweeting 2020-07-28 00:13:10 -04:00
parent 6073b454b0
commit 2fa8b9d359

View file

@ -3,8 +3,7 @@ on: [push]
env: env:
MAX_LINE_LENGTH: 110 MAX_LINE_LENGTH: 110
PIPENV_VENV_IN_PROJECT: 1
CACHE_PATH: .venv
jobs: jobs:
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -17,32 +16,18 @@ jobs:
python-version: 3.8 python-version: 3.8
architecture: x64 architecture: x64
- name: Install pipenv
run: |
pip install pipenv
- uses: actions/cache@v2
id: cache-archivebox
with:
path: ${{ env.CACHE_PATH }}
key: ${{ runner.os }}-3.8-pipenv-${{ hashFiles('**/Pipfile') }}
restore-keys: |
${{ runner.os }}-3.8-pipenv-
- name: Install dependencies
run: |
pipenv install --dev
- name: Lint with flake8 - name: Lint with flake8
run: | run: |
pip install flake8
# one pass for show-stopper syntax errors or undefined names # one pass for show-stopper syntax errors or undefined names
pipenv run flake8 archivebox --count --show-source --statistics flake8 archivebox --count --show-source --statistics
# one pass for small stylistic things # one pass for small stylistic things
pipenv run flake8 archivebox --count --max-line-length="$MAX_LINE_LENGTH" --statistics flake8 archivebox --count --max-line-length="$MAX_LINE_LENGTH" --statistics
- name: Lint with mypy # - name: Lint with mypy
run: | # run: |
pipenv run mypy archivebox || true # pip install mypy
# mypy archivebox || true
test: test:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -63,25 +48,22 @@ jobs:
python-version: ${{ matrix.python }} python-version: ${{ matrix.python }}
architecture: x64 architecture: x64
- name: Install pipenv - name: Cache virtualenv
run: | uses: actions/cache@v2
pip install pipenv
- uses: actions/cache@v1
id: cache-archivebox
with: with:
path: ${{ env.CACHE_PATH }} path: .venv
key: ${{ runner.os }}-${{ matrix.python }}-pipenv-${{ hashFiles('**/Pipfile') }} key: ${{ runner.os }}-${{ matrix.python }}-venv-${{ hashFiles('setup.py') }}
restore-keys: | restore-keys: |
${{ runner.os }}-${{ matrix.python }}-pipenv- ${{ runner.os }}-${{ matrix.python }}-venv-
- name: Install dependencies - name: Install dependencies
run: | run: |
pipenv install --dev python3 -m .venv
./.venv/bin/python -m pip install -e '.[dev]'
- name: Test built package with pytest - name: Test built package with pytest
run: | run: |
pipenv run pytest -s ./.venv/bin/python -m pipenv run pytest -s
docker-test: docker-test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -91,6 +73,8 @@ jobs:
with: with:
fetch-depth: 1 fetch-depth: 1
- uses: satackey/action-docker-layer-caching@v0.0.4
- name: Build image - name: Build image
run: | run: |
docker build . -t archivebox docker build . -t archivebox