generated from hemengke1997/ts-starter
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9fe26ee
commit 71d8ef2
Showing
2 changed files
with
87 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected] | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |