Skip to content

Commit

Permalink
Test out GH actions config adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
anselmbradford committed Oct 25, 2024
1 parent 9509201 commit 3538f71
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 64 deletions.
19 changes: 19 additions & 0 deletions .github/actions/shared-action-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Shared action - setup"
runs:
using: "composite"
steps:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Set up Ruby for Jekyll
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.3

- name: Install dependencies with Yarn
shell: bash
run: |
yarn install
yarn after-install
18 changes: 3 additions & 15 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,11 @@ jobs:
# matrix:
# containers: [1, 2] # Uses 2 parallel instances
steps:
- name: Checkout
- name: Check out the repo
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Set up Ruby for Jekyll
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.3

- name: Install dependencies with Yarn
run: |
yarn install
yarn after-install
- name: Shared setup
uses: ./.github/actions/shared-action-setup

- name: Cypress run
# Uses the official Cypress GitHub action https://github.com/cypress-io/github-action
Expand Down
36 changes: 4 additions & 32 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Check out the repo
uses: actions/checkout@v4

# Install Node and configure its cache.
- uses: actions/setup-node@v4
with:
node-version: 20

# https://github.com/actions/cache/blob/master/examples.md#node---yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=.yarn/cache" >> "$GITHUB_OUTPUT"

- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Install Ruby and configure the Bundler cache.
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.3

# https://github.com/actions/cache/blob/master/examples.md#ruby---bundler
- name: Set up Bundler cache
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Shared setup
uses: ./.github/actions/shared-action-setup

# Build the documentation site.
# This is needed so we can determine the list of URLs to test.
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.3
- uses: actions/checkout@v4
- run: ./scripts/update-gh-pages.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check out the repo
uses: actions/checkout@v4

- name: Shared setup
uses: ./.github/actions/shared-action-setup

- name: Update GitHub pages
run: ./scripts/update-gh-pages.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 2 additions & 7 deletions .github/workflows/tests-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies with Yarn
run: yarn install
- name: Shared setup
uses: ./.github/actions/shared-action-setup

- name: Run unit tests
run: yarn jest

0 comments on commit 3538f71

Please sign in to comment.