Skip to content

Commit

Permalink
Update visual regression test action
Browse files Browse the repository at this point in the history
 - Updated to meet the GOV.UK conventions for GitHub Actions [1]
 - Updated Yarn caching of the node modules to have the folder cached, as the
   place where Yarn caches the dependencies depends on the operating system
   and version of Yarn [2]
 - Replaced GitHub's Ruby setup with `ruby/setup-ruby`, as that can read the
   `.ruby-version` instead of setting the version in the Action's config file.

[1] https://docs.publishing.service.gov.uk/manual/test-and-build-a-project-with-github-actions.html
[2] https://github.com/actions/cache/blob/8b407f7777cf8b88a75f09b87331f535315cf621/examples.md#node---yarn
  • Loading branch information
injms committed Dec 11, 2020
1 parent 1a4d37e commit 6e9ae74
Showing 1 changed file with 23 additions and 27 deletions.
50 changes: 23 additions & 27 deletions .github/workflows/visual-regression-tests.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,40 @@
name: "Visual regression test"

on:
push:
branches:
- main
- master
pull_request:
types:
- "ready_for_review"
- ready_for_review

jobs:
visual-regression-test-components:
runs-on: "ubuntu-latest"
runs-on: ubuntu-latest
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-ruby@v1"
with:
ruby-version: "2.7"
- uses: "actions/[email protected]"
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
- uses: actions/setup-node@v1
with:
node-version: "14"
- name: "Cache node modules"
uses: "actions/cache@v2.1.3"
- name: Check for cached Ruby gems
uses: actions/cache@v2
with:
path: "~/.npm"
key: "${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}"
restore-keys: "${{ runner.os }}-node-"
- name: "Cache Ruby gems"
uses: "actions/[email protected]"
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gems-
- name: Get Yarn cache directory path
id: yarn-cache-directory-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Check for cached Yarn dependencies
uses: actions/cache@v2
with:
path: "vendor/bundle"
key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}"
restore-keys: "${{ runner.os }}-gems-"
- name: "Bundle and yarn install"
run: |
bundle config path tmp/bundle
bundle install --jobs 4 --retry 3
yarn install --frozen-lockfile
- uses: "percy/[email protected]"
path: ${{ steps.yarn-cache-directory-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- run: bundle install --jobs 4 --retry 3 --path vendor/bundle
- run: yarn install --frozen-lockfile
- uses: percy/[email protected]
with:
command: "bundle exec rspec ./spec/visual_regression_tests/all_components.rb"
command: bundle exec rspec ./spec/visual_regression_tests/all_components.rb
env:
PERCY_TOKEN: "${{ secrets.PERCY_TOKEN }}"
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}

0 comments on commit 6e9ae74

Please sign in to comment.