diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 0fd5ab073..33973068b 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -11,23 +11,8 @@ jobs: # matrix: # containers: [1, 2] # Uses 2 parallel instances steps: - - name: Checkout - 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/workflows/shared-action-setup - name: Cypress run # Uses the official Cypress GitHub action https://github.com/cypress-io/github-action diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml index 4ec7ba533..d0a9af642 100644 --- a/.github/workflows/lighthouse.yml +++ b/.github/workflows/lighthouse.yml @@ -12,39 +12,8 @@ jobs: runs-on: ubuntu-latest steps: - - 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/workflows/shared-action-setup # Build the documentation site. # This is needed so we can determine the list of URLs to test. diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 5bef05f07..e32b63e27 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -9,13 +9,10 @@ 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: Shared setup + uses: ./.github/workflows/shared-action-setup + + - name: Update GitHub pages + run: ./scripts/update-gh-pages.sh + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/shared-action-setup/action.yml b/.github/workflows/shared-action-setup/action.yml new file mode 100644 index 000000000..2cd4355ba --- /dev/null +++ b/.github/workflows/shared-action-setup/action.yml @@ -0,0 +1,20 @@ +name: "Shared action - setup" +runs: + using: "composite" + steps: + - 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 diff --git a/.github/workflows/tests-unit.yml b/.github/workflows/tests-unit.yml index 04402e2de..6ce47edce 100644 --- a/.github/workflows/tests-unit.yml +++ b/.github/workflows/tests-unit.yml @@ -11,16 +11,8 @@ jobs: runs-on: ubuntu-latest steps: - - 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/workflows/shared-action-setup - name: Run unit tests run: yarn jest