From b9e96af24299f7784b5db0197814a8f6d8957e14 Mon Sep 17 00:00:00 2001 From: Eike Foken Date: Fri, 6 Dec 2024 08:22:58 +0100 Subject: [PATCH] Add install action and run lint --- .github/actions/install/action.yml | 27 ++++++++++++++++++++++++++ .github/workflows/node.js.yml | 31 +++++++++++++++++++++--------- .nvmrc | 1 + packages/svg/src/components.tsx | 2 +- vitest.config.ts | 3 +++ 5 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 .github/actions/install/action.yml create mode 100644 .nvmrc diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml new file mode 100644 index 0000000..b2d6977 --- /dev/null +++ b/.github/actions/install/action.yml @@ -0,0 +1,27 @@ +name: 'Install' +description: 'Setup Node.js and install dependencies' + +inputs: + node-version: + description: Node.js version + +runs: + using: composite + steps: + - name: Setup Node.js + if: ${{ inputs.node-version == '' }} + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + cache: 'yarn' + + - name: Use Node.js ${{ inputs.node-version }} + if: ${{ inputs.node-version != '' }} + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version }} + cache: 'yarn' + + - name: Install dependencies + shell: bash + run: yarn install --immutable diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 7370667..7bd08d2 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -7,24 +7,38 @@ on: branches: [main] jobs: - build: + lint: runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + uses: ./.github/actions/install + + - run: yarn lint + + types: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + uses: ./.github/actions/install + + - run: yarn typecheck + + test: + runs-on: ubuntu-latest strategy: matrix: node-version: [18.x, 20.x, 22.x] - steps: - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + - name: Install dependencies + uses: ./.github/actions/install with: node-version: ${{ matrix.node-version }} - cache: 'yarn' - - - name: Install dependencies - run: yarn install --immutable - name: Get installed Playwright version run: echo "PLAYWRIGHT_VERSION=$(yarn info playwright --json | jq -r '.children.Version')" >> $GITHUB_ENV @@ -41,5 +55,4 @@ jobs: run: yarn playwright install --with-deps if: steps.playwright-cache.outputs.cache-hit != 'true' - - run: yarn lint - run: yarn test diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..2bd5a0a --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +22 diff --git a/packages/svg/src/components.tsx b/packages/svg/src/components.tsx index c26d8e2..a29643b 100644 --- a/packages/svg/src/components.tsx +++ b/packages/svg/src/components.tsx @@ -2,7 +2,7 @@ import type { ResponderEvent, StyleProp } from '@react-universal/core'; import { createElement, styled } from '@react-universal/core'; -import { type AnyObject, isArray, isNumber, isString } from '@react-universal/utils'; +import { isArray, isNumber, isString } from '@react-universal/utils'; import { forwardRef } from 'react'; import type { CircleProps, diff --git a/vitest.config.ts b/vitest.config.ts index cfcddb8..3907d43 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -4,6 +4,9 @@ export default defineConfig({ resolve: { conditions: ['source'], }, + define: { + 'process.env': process.env, + }, test: { browser: { enabled: true,