From 3538f713b093c082e1498ba032551cf3f20532e0 Mon Sep 17 00:00:00 2001 From: Ans Date: Fri, 25 Oct 2024 12:22:24 -0400 Subject: [PATCH] Test out GH actions config adjustments --- .../actions/shared-action-setup/action.yml | 19 ++++++++++ .github/workflows/cypress.yml | 18 ++-------- .github/workflows/lighthouse.yml | 36 +++---------------- .github/workflows/pages.yml | 20 +++++------ .github/workflows/tests-unit.yml | 9 ++--- 5 files changed, 38 insertions(+), 64 deletions(-) create mode 100644 .github/actions/shared-action-setup/action.yml diff --git a/.github/actions/shared-action-setup/action.yml b/.github/actions/shared-action-setup/action.yml new file mode 100644 index 0000000000..bb6413544b --- /dev/null +++ b/.github/actions/shared-action-setup/action.yml @@ -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 diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 0fd5ab073f..224360f349 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -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 diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml index 4ec7ba533f..2dc5c69af2 100644 --- a/.github/workflows/lighthouse.yml +++ b/.github/workflows/lighthouse.yml @@ -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. diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 5bef05f07f..aca682d9d5 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -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 }} diff --git a/.github/workflows/tests-unit.yml b/.github/workflows/tests-unit.yml index 04402e2de1..624667077f 100644 --- a/.github/workflows/tests-unit.yml +++ b/.github/workflows/tests-unit.yml @@ -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