From 5dd902a6cc4d7733f5dc705d60f9ece3f5f5061c Mon Sep 17 00:00:00 2001 From: Tyler Krys Date: Tue, 28 May 2024 15:00:10 -0700 Subject: [PATCH 1/3] Add GitHub Actions workflow file for running React components test suite --- .../test_react_component_library.yaml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/test_react_component_library.yaml diff --git a/.github/workflows/test_react_component_library.yaml b/.github/workflows/test_react_component_library.yaml new file mode 100644 index 00000000..69cea9db --- /dev/null +++ b/.github/workflows/test_react_component_library.yaml @@ -0,0 +1,32 @@ +name: Run test suite for React component library + +on: + pull_request: + paths: + - packages/react-components/** + workflow_dispatch: + +# Cancel any currently running builds to save GitHub Actions hours. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + react-components-test: + name: Test suite run + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Install dependencies + run: npm install + + - name: Run test suite with npm script + run: npm run test:ci From 9a23edb59780bb8e533dd71526dc623376526917 Mon Sep 17 00:00:00 2001 From: Tyler Krys Date: Tue, 28 May 2024 15:08:39 -0700 Subject: [PATCH 2/3] Drop 'v' from version in .nvmrc for GitHub Action variable usage --- packages/react-components/.nvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-components/.nvmrc b/packages/react-components/.nvmrc index 9a2a0e21..209e3ef4 100644 --- a/packages/react-components/.nvmrc +++ b/packages/react-components/.nvmrc @@ -1 +1 @@ -v20 +20 From 60cda50354e46910496b41e9f45e9fef8b764382 Mon Sep 17 00:00:00 2001 From: Tyler Krys Date: Tue, 28 May 2024 15:10:13 -0700 Subject: [PATCH 3/3] Use .nvmrc version of Node.js instead of hard-coded version --- .github/workflows/test_react_component_library.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_react_component_library.yaml b/.github/workflows/test_react_component_library.yaml index 69cea9db..a09ad07d 100644 --- a/.github/workflows/test_react_component_library.yaml +++ b/.github/workflows/test_react_component_library.yaml @@ -20,10 +20,14 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Read .nvmrc + run: echo "::set-output name=NVMRC::$(cat .nvmrc)" + id: nvm + - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version: "20" + node-version: "${{ steps.nvm.outputs.NVMRC }}" - name: Install dependencies run: npm install