From d08c1c40b0030b0ca001a50855b990bc59b04e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Sat, 12 Oct 2024 11:13:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=20playwright.yaml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/{ci.yaml => ci.yaml.off} | 0 .github/workflows/playwright.yaml | 30 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) rename .github/workflows/{ci.yaml => ci.yaml.off} (100%) create mode 100644 .github/workflows/playwright.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml.off similarity index 100% rename from .github/workflows/ci.yaml rename to .github/workflows/ci.yaml.off diff --git a/.github/workflows/playwright.yaml b/.github/workflows/playwright.yaml new file mode 100644 index 0000000..be942ef --- /dev/null +++ b/.github/workflows/playwright.yaml @@ -0,0 +1,30 @@ +name: Playwright + +on: + push: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: yanhao98/composite-actions/setup-node-environment@main + - run: pnpm run build-only + - name: 部署到 Surge + id: surge_deploy + # pnpm exec surge token / pnpx surge token + # https://github.com/Tencent/tdesign-vue-next/pull/1604#issuecomment-1236244550 + # https://github.com/Tencent/tdesign-vue-next/blob/03036a19adccf4657d7792e3a61a6c6a7d902e3e/.github/workflows/preview-publish.yml + # https://github.com/Tencent/tdesign/blob/0c0c9b63897c05d10c58e1a1e36feda2cb99eca7/.github/workflows/preview.yml#L40 + run: | + export DEPLOY_DOMAIN=https://${{ github.sha }}.surge.sh + cp dist/index.html dist/200.html + 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 + - name: Install Playwright Browsers + run: pnpm exec playwright install --with-deps + - name: Run Playwright tests + run: pnpm exec playwright test + env: + BASE_URL: ${{ steps.surge_deploy.outputs.url }}