From 334175bd8475f85aa4a34fa20505a5a8ce77dc6f Mon Sep 17 00:00:00 2001 From: "M. Zulqarnain" Date: Mon, 7 Jun 2021 19:54:26 +0500 Subject: [PATCH] BOM-2591: Optimize "Ensure Tests Running" GH Action (#27864) * feat: speed up pip install * change test name --- .github/workflows/unit-tests-check.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-tests-check.yml b/.github/workflows/unit-tests-check.yml index c7516154aa..a627e0e53c 100644 --- a/.github/workflows/unit-tests-check.yml +++ b/.github/workflows/unit-tests-check.yml @@ -1,4 +1,4 @@ -name: Ensure Unit Tests Running +name: CI on: pull_request: @@ -7,11 +7,14 @@ on: jobs: run_tests: - name: Test + name: Ensure Unit Tests Running runs-on: ubuntu-20.04 strategy: matrix: python-version: ['3.8'] + include: + - os: ubuntu-20.04 + path: ~/.cache/pip steps: - uses: actions/checkout@v2 @@ -25,7 +28,22 @@ jobs: sudo apt-get update && sudo apt-get install libxmlsec1-dev sudo systemctl start mongod + - name: Get pip cache dir + id: pip-cache-dir + run: | + echo "::set-output name=dir::$(pip cache dir)" + + - name: Cache pip dependencies + id: cache-dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache-dir.outputs.dir }} + key: ${{ runner.os }}-pip-${{ hashFiles('requirements/edx/testing.txt') }} + restore-keys: ${{ runner.os }}-pip- + + - name: Install Python Dependencies + if: steps.cache-dependencies.output.cache-hit != 'true' run: | pip install setuptools wheel pip install -r requirements/edx/testing.txt