diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..1bea73d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,90 @@ +name: Test + +on: + pull_request: + push: + branches: + - master +env: + CACHE_AFFIX: pnpm-packages + CI: true + PNPM_CACHE_FOLDER: .pnpm-store + PNPM_VERSION: 8 + +jobs: + test: + name: Testing + runs-on: ubuntu-latest + steps: + - name: checkout code repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: install pnpm package manager + uses: pnpm/action-setup@v2 + with: + version: ${{ env.PNPM_VERSION }} + + - name: setup node.js + uses: actions/setup-node@v3 + with: + node-version-file: .nvmrc + + - name: setup pnpm config + run: pnpm config set store-dir $PNPM_CACHE_FOLDER + + - name: restore cache for packages if applicable + uses: actions/cache@v3 + id: packages-cache + with: + path: "${{ env.PNPM_CACHE_FOLDER }}" + key: ${{ runner.os }}-${{ env.CACHE_AFFIX }}-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-${{ env.CACHE_AFFIX }}- + + - name: install dependencies + run: pnpm install --frozen-lockfile + + - name: Testing + run: | + pnpm lint + pnpm t + smoke: + name: Smoke Testing + runs-on: ubuntu-latest + steps: + - name: checkout code repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: install pnpm package manager + uses: pnpm/action-setup@v2 + with: + version: ${{ env.PNPM_VERSION }} + + - name: setup node.js + uses: actions/setup-node@v3 + with: + node-version-file: .nvmrc + + - name: setup pnpm config + run: pnpm config set store-dir $PNPM_CACHE_FOLDER + + - name: restore cache for packages if applicable + uses: actions/cache@v3 + id: packages-cache + with: + path: "${{ env.PNPM_CACHE_FOLDER }}" + key: ${{ runner.os }}-${{ env.CACHE_AFFIX }}-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-${{ env.CACHE_AFFIX }}- + + - name: install dependencies + run: | + pnpm install --frozen-lockfile + npx playwright install + + - name: Testing + run: pnpm --filter "@solana/*ui" run ci:test-smoke diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..f1ec987 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v21.6 diff --git a/packages/ui/package.json b/packages/ui/package.json index 619a00c..6c16cea 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -11,13 +11,13 @@ "build-storybook": "storybook build", "ci:sb": "pnpm run storybook --no-open --quiet --no-version-updates", "ci:sb-kill": "kill -2 $(lsof -t -i:6006)", - "ci:test-sb": "wait-on tcp:6006 && pnpm run test-sb && pnpm run ci:sb-kill", + "ci:sb-test": "wait-on tcp:6006 && pnpm run test-sb && pnpm run ci:sb-kill", + "ci:test-smoke": "concurrently --raw \"pnpm run ci:sb\" \"pnpm run ci:sb-test\" --kill-others-on-fail", "lint": "prettier ./src/** ./**/*config.[jt]s --check", "lint-fix": "pnpm run lint --w", "storybook": "storybook dev -p 6006", "test": "tsc --noEmit", - "test-sb": "test-storybook --browsers chromium, firefox", - "test-smoke": "concurrently --raw \"pnpm run ci:sb\" \"pnpm run ci:test-sb\" --kill-others-on-fail" + "test-sb": "test-storybook --browsers chromium, firefox" }, "browserslist": "defaults, not ie <= 11", "dependencies": {