Add Action Caching

This commit is contained in:
Jonah Aragon 2021-05-01 22:59:01 -05:00
parent e334c3d825
commit 69301d6a66
No known key found for this signature in database
GPG Key ID: 6A957C9A9A9429F7
2 changed files with 171 additions and 7 deletions

View File

@ -24,6 +24,11 @@ jobs:
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '14' node-version: '14'
- name: Cache Jekyll build
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.html') }}
- name: Build website - name: Build website
uses: ./.github/actions/build uses: ./.github/actions/build
- name: Copy built site to production - name: Copy built site to production

View File

@ -1,6 +1,12 @@
name: Code tests name: Code tests
on: [push, pull_request] on:
push:
branches:
- main
pull_request:
branches:
- main
env: env:
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
@ -15,6 +21,13 @@ jobs:
- uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@v1
with: with:
bundler-cache: true bundler-cache: true
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '14' node-version: '14'
@ -30,9 +43,25 @@ jobs:
- uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@v1
with: with:
bundler-cache: true bundler-cache: true
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '14' node-version: '14'
- name: Cache Jekyll build
uses: actions/cache@v2
with:
path: |
.jekyll-cache
.sass-cache
key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }}
restore-keys: |
${{ runner.os }}-jekyll-
- name: Build website - name: Build website
uses: ./.github/actions/build uses: ./.github/actions/build
@ -46,9 +75,25 @@ jobs:
- uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@v1
with: with:
bundler-cache: true bundler-cache: true
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '14' node-version: '14'
- name: Cache Jekyll build
uses: actions/cache@v2
with:
path: |
.jekyll-cache
.sass-cache
key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }}
restore-keys: |
${{ runner.os }}-jekyll-
- name: Build website - name: Build website
uses: ./.github/actions/build uses: ./.github/actions/build
- name: Copy built site to production - name: Copy built site to production
@ -59,7 +104,7 @@ jobs:
mkdir -p ${{ github.workspace }}/src mkdir -p ${{ github.workspace }}/src
mv /tmp/src/* ${{ github.workspace }}/src/ mv /tmp/src/* ${{ github.workspace }}/src/
mv /tmp/_site ${{ github.workspace }}/ mv /tmp/_site ${{ github.workspace }}/
- name: Hyperlink link checker - name: Internal link checker
uses: untitaker/hyperlink@0.1.15 uses: untitaker/hyperlink@0.1.15
with: with:
args: _site/ --sources src/ args: _site/ --sources src/
@ -75,22 +120,47 @@ jobs:
- uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@v1
with: with:
bundler-cache: true bundler-cache: true
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '14' node-version: '14'
- name: Cache Jekyll build
uses: actions/cache@v2
with:
path: |
.jekyll-cache
.sass-cache
key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }}
restore-keys: |
${{ runner.os }}-jekyll-
- name: Build website - name: Build website
uses: ./.github/actions/build uses: ./.github/actions/build
- name: Check HTML - name: Cache HTMLProofer
id: cache-htmlproofer
uses: actions/cache@v2
with:
path: tmp/.htmlproofer
key: ${{ runner.os }}-htmlproofer-${{ hashFiles('_site/**.html') }}
restore-keys: |
${{ runner.os }}-htmlproofer-
${{ runner.os }}-htmlproofer
- name: Check All External Links (Informational)
uses: chabad360/htmlproofer@v1.1 uses: chabad360/htmlproofer@v1.1
with: with:
directory: ${{ github.workspace }}/_site directory: ${{ github.workspace }}/_site
arguments: --assume-extension --external_only --internal-domains privacyguides.org,www.privacyguides.org arguments: --assume-extension --external_only --internal-domains privacyguides.org,www.privacyguides.org --timeframe 30d
continue-on-error: true continue-on-error: true
- name: Check HTML - name: Check External Links (Only 4XX)
uses: chabad360/htmlproofer@v1.1 uses: chabad360/htmlproofer@v1.1
with: with:
directory: ${{ github.workspace }}/_site directory: ${{ github.workspace }}/_site
arguments: --assume-extension --external_only --only_4xx --internal-domains privacyguides.org,www.privacyguides.org arguments: --assume-extension --external_only --only_4xx --http-status-ignore 429 --internal-domains privacyguides.org,www.privacyguides.org --timeframe 30d
https: https:
name: "Require HTTPS Internal Images" name: "Require HTTPS Internal Images"
@ -103,12 +173,28 @@ jobs:
- uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@v1
with: with:
bundler-cache: true bundler-cache: true
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '14' node-version: '14'
- name: Cache Jekyll build
uses: actions/cache@v2
with:
path: |
.jekyll-cache
.sass-cache
key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }}
restore-keys: |
${{ runner.os }}-jekyll-
- name: Build website - name: Build website
uses: ./.github/actions/build uses: ./.github/actions/build
- name: Check HTML - name: Check Images
uses: chabad360/htmlproofer@v1.1 uses: chabad360/htmlproofer@v1.1
with: with:
directory: ${{ github.workspace }}/_site directory: ${{ github.workspace }}/_site
@ -128,6 +214,15 @@ jobs:
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '14' node-version: '14'
- name: Cache Jekyll build
uses: actions/cache@v2
with:
path: |
.jekyll-cache
.sass-cache
key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }}
restore-keys: |
${{ runner.os }}-jekyll-
- name: Build website - name: Build website
uses: ./.github/actions/build uses: ./.github/actions/build
- name: Check HTML - name: Check HTML
@ -147,9 +242,25 @@ jobs:
- uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@v1
with: with:
bundler-cache: true bundler-cache: true
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '14' node-version: '14'
- name: Cache Jekyll build
uses: actions/cache@v2
with:
path: |
.jekyll-cache
.sass-cache
key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }}
restore-keys: |
${{ runner.os }}-jekyll-
- name: Build website - name: Build website
uses: ./.github/actions/build uses: ./.github/actions/build
- name: Check HTML - name: Check HTML
@ -169,9 +280,25 @@ jobs:
- uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@v1
with: with:
bundler-cache: true bundler-cache: true
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '14' node-version: '14'
- name: Cache Jekyll build
uses: actions/cache@v2
with:
path: |
.jekyll-cache
.sass-cache
key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }}
restore-keys: |
${{ runner.os }}-jekyll-
- name: Build website - name: Build website
uses: ./.github/actions/build uses: ./.github/actions/build
- name: Check HTML - name: Check HTML
@ -191,9 +318,25 @@ jobs:
- uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@v1
with: with:
bundler-cache: true bundler-cache: true
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '14' node-version: '14'
- name: Cache Jekyll build
uses: actions/cache@v2
with:
path: |
.jekyll-cache
.sass-cache
key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }}
restore-keys: |
${{ runner.os }}-jekyll-
- name: Build website - name: Build website
uses: ./.github/actions/build uses: ./.github/actions/build
- name: Check HTML - name: Check HTML
@ -213,9 +356,25 @@ jobs:
- uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@v1
with: with:
bundler-cache: true bundler-cache: true
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '14' node-version: '14'
- name: Cache Jekyll build
uses: actions/cache@v2
with:
path: |
.jekyll-cache
.sass-cache
key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }}
restore-keys: |
${{ runner.os }}-jekyll-
- name: Build website - name: Build website
uses: ./.github/actions/build uses: ./.github/actions/build
- name: Check HTML - name: Check HTML