E2E Test PR--docs(grid): [grid] fix tree-grid-insert-delete-update demo #2607
Workflow file for this run
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
name: E2E Test PR | |
run-name: E2E Test PR--${{ github.event.pull_request.title }} | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize, edited] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
parse-components: | |
name: Parse Affected Components | |
runs-on: ubuntu-latest | |
outputs: | |
testComponents: ${{ steps.parseTitle.outputs.testComponents }} | |
testclis: ${{ steps.parsetestCli.outputs.testClis }} | |
steps: | |
- name: Parse Title | |
id: parseTitle | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const prTitle = context.payload.pull_request.title | |
const regex = /\[(.*?)\]/ | |
const matches = prTitle.match(regex) | |
if (matches && matches.length > 1 && matches[1]) { | |
let components = matches[1] | |
.split(',') | |
.map((c) => c.trim()) | |
.filter((c) => /^[a-z\-\/]+$/.test(c)) | |
.map((c) => `"\\/${c}\\/"`) | |
components = [...new Set(components)].slice(0, 3).join(' ') | |
core.setOutput('testComponents', components) | |
} else { | |
const warningString =`**[e2e-test-warn]** | |
The component to be tested is missing. | |
The title of the Pull request should look like "fix(vue-renderless): [action-menu, alert] fix xxx bug". | |
Please make sure you've read our [contributing guide](https://github.com/opentiny/tiny-vue/blob/dev/CONTRIBUTING.md) | |
` | |
core.setOutput('tip', warningString) | |
core.warning(warningString) | |
} | |
- name: generate user-tip.txt | |
if: ${{ steps.parseTitle.outputs.tip }} | |
run: | | |
cat << EOF > user-tip.txt | |
${{ steps.parseTitle.outputs.tip }} | |
EOF | |
- name: Upload User Tip | |
if: ${{ steps.parseTitle.outputs.tip }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: user-tip | |
path: user-tip.txt | |
retention-days: 1 | |
- name: Save PR number | |
if: ${{ steps.parseTitle.outputs.tip }} | |
run: echo ${{ github.event.number }} > ./pr-id.txt | |
- name: Upload PR number | |
if: ${{ steps.parseTitle.outputs.tip }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pr | |
path: ./pr-id.txt | |
- name: Parse Test Cli | |
id: parsetestCli | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const testClis = '${{ vars.PLAYWRIGHT_CLIS }}' ? '${{ vars.PLAYWRIGHT_CLIS }}'.split(',') : ['pnpm test:e2e3'] | |
core.setOutput('testclis', JSON.stringify(testClis)) | |
pr-test: | |
if: ${{ needs.parse-components.outputs.testComponents }} | |
strategy: | |
matrix: | |
testcli: ${{ fromJson(needs.parse-components.outputs.testclis) }} | |
name: PR E2E Test | |
needs: parse-components | |
runs-on: ubuntu-latest | |
env: | |
TEST_COMPONENTS: ${{ needs.parse-components.outputs.testComponents }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Cache Playwright Installation | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/ms-playwright | |
key: playwright-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
run: | | |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm i --no-frozen-lockfile | |
- name: Install Playwright browsers | |
run: pnpm install:browser --with-deps chromium | |
- name: E2E Test | |
run: ${{ matrix.testcli }} ${{ env.TEST_COMPONENTS }} --retries=1 --workers=2 |