diff --git a/.github/workflows/visual-regression-tests.yml b/.github/workflows/visual-regression-tests.yml index 1d1b326289..d64a82e1fb 100644 --- a/.github/workflows/visual-regression-tests.yml +++ b/.github/workflows/visual-regression-tests.yml @@ -1,5 +1,3 @@ -name: "Visual regression test" - on: push: branches: @@ -7,38 +5,36 @@ on: - 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/setup-node@v2.1.2" + - 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/cache@v2.1.3" + 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/exec-action@v0.3.1" + 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/exec-action@v0.3.1 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 }}