diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dd30726..12d32d2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,14 +12,16 @@ concurrency: cancel-in-progress: true jobs: - cache-and-install: + build-and-deploy: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - - run: sed -i '/use-node-version/d' .npmrc + - run: | + sed -i '/use-node-version/d' .npmrc; + sed -i '/node-mirror/d' .npmrc; - uses: pnpm/action-setup@v4 name: Install pnpm @@ -64,3 +66,25 @@ jobs: run: | cp dist/index.html dist/200.html pnpx surge dist https://vue-ts-example.surge.sh --token ${{ secrets.SURGE_TOKEN }} + + 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 + run: pnpm exec playwright install --with-deps + - name: Run Playwright tests + run: pnpm exec playwright test + # - uses: actions/upload-artifact@v4 + # if: ${{ !cancelled() }} + # with: + # name: playwright-report + # path: playwright-report/ + # retention-days: 30 diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml.off similarity index 82% rename from .github/workflows/playwright.yml rename to .github/workflows/playwright.yml.off index 54087a1..47a9eca 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml.off @@ -1,9 +1,9 @@ name: Playwright Tests on: - workflow_run: - workflows: ['CI'] # 这里的名称应该是你的 `ci.yaml` 中定义的工作流名称 - types: - - completed + push: + branches: [main, master] + pull_request: + branches: [main, master] jobs: test: timeout-minutes: 60