diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ec2c820..ac374af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,11 @@ name: Test +env: + # install playwright binary manually (because pnpm only runs install script once) + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' + # Vitest auto retry on flaky segfault + VITEST_SEGFAULT_RETRY: 3 + on: push: branches: @@ -11,25 +17,82 @@ on: jobs: test: + timeout-minutes: 20 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18.x + - name: Checkout + uses: actions/checkout@v4 - name: Install pnpm - uses: pnpm/action-setup@v2.0.1 + uses: pnpm/action-setup@v2 + + - name: Set node version to 18 + uses: actions/setup-node@v3 with: - version: 8.7.0 + node-version: 18 + cache: pnpm - - name: Install dependencies - run: pnpm install --no-frozen-lockfile + - name: Install deps + run: pnpm install - name: Lint run: pnpm lint + # Install playwright's binary under custom directory to cache + - name: Set Playwright path (non-windows) + if: runner.os != 'Windows' + run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV + - name: Set Playwright path (windows) + if: runner.os == 'Windows' + run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV + + - name: Cache Playwright's binary + uses: actions/cache@v3 + with: + # Playwright removes unused browsers automatically + # So does not need to add playwright version to key + key: ${{ runner.os }}-playwright-bin-v1 + path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} + + - name: Install Playwright + # does not need to explicitly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved + run: pnpm playwright install chromium + + - name: Build + run: pnpm run build + - name: Test - run: pnpm test + run: pnpm run test:unit + + - name: Test serve + run: pnpm run test:serve + + - name: Test build + run: pnpm run test:build + + lint: + timeout-minutes: 10 + runs-on: ubuntu-latest + name: 'Lint: node-LTS, ubuntu-latest' + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + + - name: Set node version to LTS + uses: actions/setup-node@v3 + with: + node-version: lts/* + cache: pnpm + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Lint + run: pnpm run lint diff --git a/.gitignore b/.gitignore index 381068a..2c8a82d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,15 @@ -node_modules -dist +!**/glob-import/dir/node_modules +.DS_Store .idea -.Ds_store +*.cpuprofile +*.local +*.log +/.vscode/ +dist +dist-ssr +explorations +node_modules +playground-temp +temp +.eslintcache coverage