Skip to content

Commit

Permalink
Use cache for pip
Browse files Browse the repository at this point in the history
  • Loading branch information
Hritik14 committed May 20, 2021
1 parent 9114cb4 commit 135c95f
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,29 @@ jobs:
with:
python-version: 3.8

# - name: Restore cache
# uses: actions/cache@v2
# with:
# path: ~/.cache/pip
# key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
# restore-keys: |
# ${{ runner.os }}-pip-
- name: Restore cache
uses: actions/cache@v2
with:
path: .venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-venv-
- name: Install dependencies
run: |
sudo apt install python3-dev postgresql libpq-dev build-essential libxml2-dev libxslt1-dev postgresql ncat
python -m pip install --upgrade pip
pip install -r requirements.txt
- uses: syphar/restore-virtualenv@v1
id: cache-virtualenv
with:
requirement_files: requirements.txt # this is optional

- uses: syphar/restore-pip-download-cache@v1
if: steps.cache-virtualenv.outputs.cache-hit != 'true'

- run: pip install -r requirements.txt
if: steps.cache-virtualenv.outputs.cache-hit != 'true'

- name: Setup database
env:
Expand All @@ -42,9 +52,5 @@ jobs:
- name: Run tests
run: python -m pytest -v -m "not webtest"
env:
# The hostname, username used to communicate with Postgresql
POSTGRES_HOST: localhost
VC_DB_USER: vulnerablecode
POSTGRES_PORT: 5432
DJANGO_DEV: 1
GH_TOKEN: 1

0 comments on commit 135c95f

Please sign in to comment.