diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index c880a85ae86..1c86f935185 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -8,7 +8,7 @@ on: push: branches: - 'main' - - 'develop' + - 'next' paths: - '.github/workflows/e2e.yml' - 'packages/**' @@ -86,6 +86,11 @@ jobs: ref: main path: packages/pro-plugins ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }} + - name: Fetch all branches + run: cd packages/pro-plugins && git fetch --all + - name: git checkout ${{ github.head_ref }} + run: cd packages/pro-plugins && git checkout ${{ github.head_ref }} + continue-on-error: true - name: Set variables continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true run: | @@ -194,7 +199,87 @@ jobs: - run: npx playwright install chromium --with-deps - name: Test with postgres - run: yarn e2e p-test --match 'packages/**/{plugin-workflow,plugin-workflow-*}/**/__e2e__/**/*.test.ts' + run: yarn e2e p-test --match 'packages/**/{plugin-workflow,plugin-workflow-*}/**/__e2e__/**/*.test.ts' --ignore 'packages/**/plugin-workflow-approval/**/__e2e__/**/*.test.ts' + env: + __E2E__: true + APP_ENV: production + LOGGER_LEVEL: error + DB_DIALECT: postgres + DB_HOST: postgres + DB_PORT: 5432 + DB_USER: nocobase + DB_PASSWORD: password + DB_DATABASE: nocobase + APPEND_PRESET_LOCAL_PLUGINS: ${{ steps.vars.outputs.var2 }} + + - name: Upload e2e-report + if: ${{ !cancelled() }} + uses: actions/upload-artifact@v4 + with: + name: e2e-report-${{ github.job }} # 为了防止在多个任务中存在冲突 + path: ./storage/playwright/tests-report-blob/blob-*/* + + timeout-minutes: 60 + + plugin-workflow-approval: + name: plugin-workflow-approval + needs: build + runs-on: ubuntu-latest + container: node:18 + services: + # Label used to access the service container + postgres: + # Docker Hub image + image: postgres:11 + # Provide the password for postgres + env: + POSTGRES_USER: nocobase + POSTGRES_PASSWORD: password + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - uses: actions/checkout@v4 + - name: Checkout pro-plugins + continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true + uses: actions/checkout@v4 + with: + repository: nocobase/pro-plugins + ref: main + path: packages/pro-plugins + ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }} + - name: Set variables + continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true + run: | + APPEND_PRESET_LOCAL_PLUGINS=$(find ./packages/pro-plugins/@nocobase -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | sed 's/^plugin-//' | tr '\n' ',' | sed 's/,$//') + echo "var2=$APPEND_PRESET_LOCAL_PLUGINS" >> $GITHUB_OUTPUT + id: vars + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: actions/cache@v4 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - run: yarn + + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: build-artifact + path: packages + + - run: npx playwright install chromium --with-deps + - name: Test with postgres + run: yarn e2e p-test --match 'packages/**/plugin-workflow-approval/**/__e2e__/**/*.test.ts' env: __E2E__: true APP_ENV: production @@ -302,6 +387,7 @@ jobs: needs: - core-and-plugins - plugin-workflow + - plugin-workflow-approval - plugin-data-source-main if: ${{ !cancelled() && github.event.pull_request.number }} steps: