From e1424a48ca279a56f79898ee111bb1cd76e193b2 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Mon, 24 Jun 2024 11:24:53 -0400 Subject: [PATCH] Split github actions (#51) --- .github/workflows/test-browser-exp.yaml | 78 +++++++++++++++++++++++++ .github/workflows/test-ui.yaml | 18 ------ 2 files changed, 78 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/test-browser-exp.yaml diff --git a/.github/workflows/test-browser-exp.yaml b/.github/workflows/test-browser-exp.yaml new file mode 100644 index 000000000..1aa5666e4 --- /dev/null +++ b/.github/workflows/test-browser-exp.yaml @@ -0,0 +1,78 @@ +# Setting test expectation screenshots for Playwright + +name: Update Playwright Expectations + +on: + pull_request: + types: [ labeled ] + branches: [ main, master ] + +jobs: + test: + runs-on: ubuntu-latest + if: github.event.label.name == 'New Browser Test Expectations' + steps: + - name: Checkout ComfyUI + uses: actions/checkout@v4 + with: + repository: "comfyanonymous/ComfyUI" + path: "ComfyUI" + ref: master + - name: Checkout ComfyUI_frontend + uses: actions/checkout@v4 + with: + repository: "huchenlei/ComfyUI_frontend" + path: "ComfyUI_frontend" + ref: ${{ github.head_ref }} + - uses: actions/setup-node@v3 + with: + node-version: lts/* + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install requirements + run: | + python -m pip install --upgrade pip + pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu + pip install -r requirements.txt + pip install wait-for-it + working-directory: ComfyUI + - name: Build & Install ComfyUI_frontend + run: | + npm ci + npm run build + rm -rf ../ComfyUI/web/* + mv dist/* ../ComfyUI/web/ + working-directory: ComfyUI_frontend + - name: Start ComfyUI server + run: | + python main.py --cpu & + wait-for-it --service 127.0.0.1:8188 -t 600 + working-directory: ComfyUI + - name: Install Playwright Browsers + run: npx playwright install --with-deps + working-directory: ComfyUI_frontend + - name: Run Playwright tests and update snapshots + id: playwright-tests + run: npx playwright test --update-snapshots + continue-on-error: true + working-directory: ComfyUI_frontend + - uses: actions/upload-artifact@v4 + if: always() + with: + name: playwright-report + path: ComfyUI_frontend/playwright-report/ + retention-days: 30 + - name: Debugging info + run: | + echo "Branch: ${{ github.head_ref }}" + git status + working-directory: ComfyUI_frontend + - name: Commit updated expectations + run: | + git config --global user.name 'github-actions' + git config --global user.email 'github-actions@github.com' + git add browser_tests + git commit -m "Update test expectations [skip ci]" + git push origin HEAD:${{ github.head_ref }} + working-directory: ComfyUI_frontend diff --git a/.github/workflows/test-ui.yaml b/.github/workflows/test-ui.yaml index 77fd1e699..336a51153 100644 --- a/.github/workflows/test-ui.yaml +++ b/.github/workflows/test-ui.yaml @@ -19,7 +19,6 @@ jobs: with: repository: "huchenlei/ComfyUI_frontend" path: "ComfyUI_frontend" - ref: ${{ github.head_ref }} - name: Get commit message id: commit-message run: echo "::set-output name=message::$(git log -1 --pretty=%B)" @@ -63,9 +62,7 @@ jobs: run: npx playwright install --with-deps working-directory: ComfyUI_frontend - name: Run Playwright tests - id: playwright-tests run: npx playwright test - continue-on-error: true working-directory: ComfyUI_frontend - uses: actions/upload-artifact@v4 if: always() @@ -73,18 +70,3 @@ jobs: name: playwright-report path: ComfyUI_frontend/playwright-report/ retention-days: 30 - - name: Debugging info - run: | - echo "Branch: ${{ github.head_ref }}" - git status - working-directory: ComfyUI_frontend - - name: Commit updated expectations - if: steps.playwright-tests.outcome == 'failure' && contains(github.event.pull_request.labels.*.name, 'New Browser Test Expectations') - # Pushes back to the source branch of the PR - run: | - git config --global user.name 'github-actions' - git config --global user.email 'github-actions@github.com' - git add browser_tests - git commit -m "Update test expectations [skip ci]" - git push origin HEAD:${{ github.head_ref }} - working-directory: ComfyUI_frontend