From 7831a6fbb950f7322048c714e4aa041419ec6be2 Mon Sep 17 00:00:00 2001 From: Hritik Vijay Date: Thu, 20 May 2021 21:01:54 +0530 Subject: [PATCH 1/9] cache it --- .github/workflows/main.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 321fe875b..61bbcc6c8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,13 +15,13 @@ 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: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- - name: Install dependencies run: | From 16671b4c2ce506e81c6c2b42731a764e16ce0063 Mon Sep 17 00:00:00 2001 From: Hritik Vijay Date: Thu, 20 May 2021 21:06:23 +0530 Subject: [PATCH 2/9] time data test --- haha | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haha b/haha index f71f46d67..7f66bf401 100644 --- a/haha +++ b/haha @@ -1 +1 @@ -1625 +30495 From 6ef1714c688c2495115ec50545bb1a0d2f23e8e1 Mon Sep 17 00:00:00 2001 From: Hritik Vijay Date: Thu, 20 May 2021 21:09:59 +0530 Subject: [PATCH 3/9] time data test --- haha | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haha b/haha index 7f66bf401..d2e492cd9 100644 --- a/haha +++ b/haha @@ -1 +1 @@ -30495 +32152 From 00d3f502cfde1934cc680288a7bd54ea590b7e6b Mon Sep 17 00:00:00 2001 From: Hritik Vijay Date: Thu, 20 May 2021 21:19:45 +0530 Subject: [PATCH 4/9] Cache venv --- .github/workflows/main.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 61bbcc6c8..0038b3226 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,15 +18,19 @@ jobs: - name: Restore cache uses: actions/cache@v2 with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + path: .venv + key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements.txt') }} restore-keys: | - ${{ runner.os }}-pip- + ${{ 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 + + - name: Initialize venv + run: python -m venv .venv && \ + . .venv/bin/activate && \ pip install -r requirements.txt - name: Setup database @@ -40,11 +44,8 @@ jobs: --host=localhost --port=5432 vulnerablecode - name: Run tests - run: python -m pytest -v -m "not webtest" + run: . .venv/bin/activate && \ + 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 From 936f0a7040f988691b38942db17d88fab51c39dc Mon Sep 17 00:00:00 2001 From: Hritik Vijay Date: Thu, 20 May 2021 21:56:39 +0530 Subject: [PATCH 5/9] Source it --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0038b3226..6d10a2995 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,7 +30,7 @@ jobs: - name: Initialize venv run: python -m venv .venv && \ - . .venv/bin/activate && \ + source .venv/bin/activate && \ pip install -r requirements.txt - name: Setup database @@ -44,7 +44,7 @@ jobs: --host=localhost --port=5432 vulnerablecode - name: Run tests - run: . .venv/bin/activate && \ + run: source .venv/bin/activate && \ python -m pytest -v -m "not webtest" env: DJANGO_DEV: 1 From f49565961d927e96b302fbab747907114dc61153 Mon Sep 17 00:00:00 2001 From: Hritik Vijay Date: Thu, 20 May 2021 22:04:51 +0530 Subject: [PATCH 6/9] let's try some publically built actions --- .github/workflows/main.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6d10a2995..9966ac59f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,10 +28,16 @@ jobs: sudo apt install python3-dev postgresql libpq-dev build-essential libxml2-dev libxslt1-dev postgresql ncat python -m pip install --upgrade pip - - name: Initialize venv - run: python -m venv .venv && \ - source .venv/bin/activate && \ - 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: @@ -44,8 +50,7 @@ jobs: --host=localhost --port=5432 vulnerablecode - name: Run tests - run: source .venv/bin/activate && \ - python -m pytest -v -m "not webtest" + run: python -m pytest -v -m "not webtest" env: DJANGO_DEV: 1 GH_TOKEN: 1 From 2edc35058cb29267318a08205b2ed0c9af18a7f9 Mon Sep 17 00:00:00 2001 From: Hritik Vijay Date: Thu, 20 May 2021 22:07:50 +0530 Subject: [PATCH 7/9] time data test --- haha | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haha b/haha index d2e492cd9..a698a56b5 100644 --- a/haha +++ b/haha @@ -1 +1 @@ -32152 +27366 From f3c0ea0a9b98622e537c5490ae8bbbd0fec82a3d Mon Sep 17 00:00:00 2001 From: Hritik Vijay Date: Thu, 20 May 2021 22:09:22 +0530 Subject: [PATCH 8/9] time data test --- haha | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haha b/haha index a698a56b5..4614177a9 100644 --- a/haha +++ b/haha @@ -1 +1 @@ -27366 +8858 From 0f5984a22eb2b8cbc2f100d9c6d6369955abb410 Mon Sep 17 00:00:00 2001 From: Hritik Vijay Date: Thu, 20 May 2021 22:10:20 +0530 Subject: [PATCH 9/9] time data test --- haha | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haha b/haha index 4614177a9..3df0b7dc9 100644 --- a/haha +++ b/haha @@ -1 +1 @@ -8858 +14662