Update ci.yaml to use pnpm instead of pnpx for Vercel commands
All checks were successful
CI / build-and-deploy (push) Successful in 4m33s
All checks were successful
CI / build-and-deploy (push) Successful in 4m33s
This commit is contained in:
58
.github/workflows/ci.yaml
vendored
58
.github/workflows/ci.yaml
vendored
@ -13,32 +13,29 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
|
# timeout-minutes: 60
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: 拉取代码
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
- name: 修改 .npmrc
|
||||||
- run: |
|
run: |
|
||||||
sed -i '/use-node-version/d' .npmrc;
|
sed -i '/use-node-version/d' .npmrc;
|
||||||
sed -i '/node-mirror/d' .npmrc;
|
sed -i '/node-mirror/d' .npmrc;
|
||||||
|
- name: 安装 pnpm
|
||||||
- uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
name: Install pnpm
|
|
||||||
with:
|
with:
|
||||||
version: 9
|
version: 9
|
||||||
run_install: false
|
run_install: false
|
||||||
|
- name: 安装 Node.js
|
||||||
- name: Install Node.js
|
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: lts/*
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
|
- name: 安装依赖
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
- name: 静态代码分析
|
||||||
- name: Lint
|
|
||||||
run: pnpm lint
|
run: pnpm lint
|
||||||
|
|
||||||
# - name: Build
|
# - name: Build
|
||||||
@ -47,10 +44,7 @@ jobs:
|
|||||||
# VITE_BUILD_COMMIT: ${{ github.sha }}
|
# VITE_BUILD_COMMIT: ${{ github.sha }}
|
||||||
|
|
||||||
# https://github.com/vercel/examples/tree/main/ci-cd/github-actions
|
# https://github.com/vercel/examples/tree/main/ci-cd/github-actions
|
||||||
# cname-china.vercel-dns.com
|
# cname-cn.vercel.com cname-china.vercel-dns.com
|
||||||
# cname-cn.vercel.com
|
|
||||||
# - name: Install Vercel CLI
|
|
||||||
# run: npm install --global vercel@canary
|
|
||||||
- name: Pull Vercel Environment Information
|
- name: Pull Vercel Environment Information
|
||||||
run: pnpm exec vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
|
run: pnpm exec vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
|
||||||
- name: Build Project Artifacts
|
- name: Build Project Artifacts
|
||||||
@ -60,31 +54,23 @@ jobs:
|
|||||||
- name: Deploy Project Artifacts to Vercel
|
- name: Deploy Project Artifacts to Vercel
|
||||||
run: pnpm exec vercel deploy --prebuilt --target=production --token=${{ secrets.VERCEL_TOKEN }}
|
run: pnpm exec vercel deploy --prebuilt --target=production --token=${{ secrets.VERCEL_TOKEN }}
|
||||||
|
|
||||||
# https://github.com/Tencent/tdesign-vue-next/pull/1604#issuecomment-1236244550
|
|
||||||
- name: Surge
|
- name: Surge
|
||||||
|
id: surge_deploy
|
||||||
# pnpm exec surge token / pnpx surge token
|
# pnpm exec surge token / pnpx surge token
|
||||||
|
# https://github.com/Tencent/tdesign-vue-next/pull/1604#issuecomment-1236244550
|
||||||
|
# https://github.com/Tencent/tdesign/blob/0c0c9b63897c05d10c58e1a1e36feda2cb99eca7/.github/workflows/preview.yml#L40
|
||||||
run: |
|
run: |
|
||||||
|
repository=${{github.repository}}
|
||||||
|
project_name=${repository#*/}
|
||||||
|
export DEPLOY_DOMAIN=https://preview-pr${{ github.run_number }}-vue-ts-example.surge.sh
|
||||||
cp dist/index.html dist/200.html
|
cp dist/index.html dist/200.html
|
||||||
pnpm exec surge dist https://vue-ts-example.surge.sh --token ${{ secrets.SURGE_TOKEN }}
|
pnpm exec surge --project ./dist --domain $DEPLOY_DOMAIN --token ${{ secrets.SURGE_TOKEN }}
|
||||||
|
echo the preview URL is $DEPLOY_DOMAIN
|
||||||
|
echo "url=$DEPLOY_DOMAIN" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# test:
|
|
||||||
# needs: build-and-deploy
|
|
||||||
# timeout-minutes: 60
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
# steps:
|
|
||||||
# - uses: actions/checkout@v4
|
|
||||||
# - uses: actions/setup-node@v4
|
|
||||||
# with:
|
|
||||||
# node-version: lts/*
|
|
||||||
# - name: Install dependencies
|
|
||||||
# run: npm install -g pnpm && pnpm install
|
|
||||||
- name: Install Playwright Browsers
|
- name: Install Playwright Browsers
|
||||||
run: pnpm exec playwright install --with-deps
|
run: pnpm exec playwright install --with-deps
|
||||||
- name: Run Playwright tests
|
- name: Run Playwright tests
|
||||||
run: pnpm exec playwright test
|
run: pnpm exec playwright test
|
||||||
# - uses: actions/upload-artifact@v4
|
env:
|
||||||
# if: ${{ !cancelled() }}
|
BASE_URL: ${{ steps.surge_deploy.outputs.url }}
|
||||||
# with:
|
|
||||||
# name: playwright-report
|
|
||||||
# path: playwright-report/
|
|
||||||
# retention-days: 30
|
|
||||||
|
2
.npmrc
2
.npmrc
@ -3,7 +3,7 @@ registry=https://registry.npmjs.org/
|
|||||||
registry=https://r-npm.oo1.dev
|
registry=https://r-npm.oo1.dev
|
||||||
|
|
||||||
# https://pnpm.io/zh/npmrc#node-mirrorltreleasedir
|
# https://pnpm.io/zh/npmrc#node-mirrorltreleasedir
|
||||||
use-node-version=20.17.0
|
#use-node-version=20.17.0
|
||||||
node-mirror:release=https://npmmirror.com/mirrors/node/
|
node-mirror:release=https://npmmirror.com/mirrors/node/
|
||||||
node-mirror:rc=https://npmmirror.com/mirrors/node-rc/
|
node-mirror:rc=https://npmmirror.com/mirrors/node-rc/
|
||||||
node-mirror:nightly=https://npmmirror.com/mirrors/node-nightly/
|
node-mirror:nightly=https://npmmirror.com/mirrors/node-nightly/
|
||||||
|
@ -12,7 +12,7 @@ import { defineConfig, devices } from '@playwright/test';
|
|||||||
* See https://playwright.dev/docs/test-configuration.
|
* See https://playwright.dev/docs/test-configuration.
|
||||||
*/
|
*/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
testDir: './tests',
|
testDir: './tests/e2e',
|
||||||
/* Run tests in files in parallel */
|
/* Run tests in files in parallel */
|
||||||
fullyParallel: true,
|
fullyParallel: true,
|
||||||
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||||
@ -26,7 +26,7 @@ export default defineConfig({
|
|||||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||||
use: {
|
use: {
|
||||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||||
baseURL: process.env.BASE_URL || 'https://vue-ts-example.oo1.dev',
|
baseURL: process.env.BASE_URL || 'https://vue-ts-example.surge.sh',
|
||||||
|
|
||||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||||
trace: 'on-first-retry',
|
trace: 'on-first-retry',
|
||||||
|
@ -2,5 +2,6 @@ import { test, expect } from '@playwright/test';
|
|||||||
|
|
||||||
test('test', async ({ page }) => {
|
test('test', async ({ page }) => {
|
||||||
await page.goto('/');
|
await page.goto('/');
|
||||||
|
console.log(page.url());
|
||||||
await expect(page.getByRole('link', { name: '中文-页面.page.vue' })).toBeVisible();
|
await expect(page.getByRole('link', { name: '中文-页面.page.vue' })).toBeVisible();
|
||||||
});
|
});
|
Reference in New Issue
Block a user