diff --git a/.github/workflows/test-react.yaml b/.github/workflows/test-react.yaml new file mode 100644 index 0000000..db3f642 --- /dev/null +++ b/.github/workflows/test-react.yaml @@ -0,0 +1,54 @@ +--- +name: Test React components library +permissions: + contents: read + +on: + pull_request: + paths: + - src/react/** + workflow_dispatch: + +jobs: + test: + name: React tests + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./src/react + + steps: + - name: Checkout code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Read .nvmrc + run: echo "GITHUB_NVMRC_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV + + - name: Set up Node.js + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: ${{ env.GITHUB_NVMRC_VERSION }} + + - name: Install dependencies + run: npm ci + + # Errors in lint process will cause this job to fail + - name: Lint + run: npm run lint + + # Errors in Prettier format check will cause this job to fail + - name: Prettier format check + run: npm run format:check + + - name: Run test suite + run: npm run test + + # Treat failures in the Vite build as test failures. + # We don't need to keep the artifact of this build, + # we just care that it completes successfully. + - name: Run Vite build + run: npm run build-vite + + # Treat failures in the main build script as test failures + - name: Run build + run: npm run build diff --git a/src/react/.nvmrc b/src/react/.nvmrc new file mode 100644 index 0000000..a45fd52 --- /dev/null +++ b/src/react/.nvmrc @@ -0,0 +1 @@ +24