From fc6e66c7f50de930a50786948cbf8e177e088b48 Mon Sep 17 00:00:00 2001 From: Arona Jones Date: Mon, 1 Feb 2021 15:39:35 +0000 Subject: [PATCH] Cache static directory on CI, skip npm install and gulp build on hit Should speed up CI runs a lot --- .github/workflows/django.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 02ae6a0f..29e5324f 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -18,8 +18,16 @@ jobs: # BROWSER: ${{ matrix.browser }} steps: - uses: actions/checkout@v2 + - name: Cache Static Files + id: static-cache + uses: actions/cache@v2 + with: + path: 'static/' + key: ${{ hashFiles('package-lock.json') }}-${{ hashFiles('pipeline/source_assets') }} - uses: bahmutov/npm-install@v1 + if: steps.static-cache.outputs.cache-hit != 'true' - run: node node_modules/gulp/bin/gulp build + if: steps.static-cache.outputs.cache-hit != 'true' - name: Set up Python uses: actions/setup-python@v2 with: @@ -34,7 +42,8 @@ jobs: python -m pip install --upgrade pip pip install pycodestyle coveralls django_coverage_plugin pytest-cov pip install --upgrade --upgrade-strategy eager -r requirements.txt - python manage.py collectstatic --noinput + - run: python manage.py collectstatic --noinput + if: steps.static-cache.outputs.cache-hit != 'true' - name: Basic Checks run: | pycodestyle . --exclude=migrations,node_modules