From 3359f535fe70f27b36ff16cef634155a3739ba79 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 18 Oct 2022 19:53:20 +0800 Subject: [PATCH] test: move argos-ci from github action to circleci (#38091) * Add .circleci/config.yml (#1) * Add .circleci/config.yml * Update config.yml * Update config.yml * Update config.yml * Update config.yml * Update config.yml * Update config.yml * Update config.yml * Update config.yml * Update config.yml * Update config.yml * Update package.json * Update config.yml * Update argos-upload.js * test: replace github action to circleci --- .circleci/config.yml | 38 ++++++++++++++ .github/workflows/ui-upload.yml | 69 ------------------------ .github/workflows/ui.yml | 93 --------------------------------- Dockerfile.ui-test | 6 --- docker-compose.yml | 17 ------ package.json | 3 +- scripts/argos-upload.js | 2 +- 7 files changed, 40 insertions(+), 188 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 .github/workflows/ui-upload.yml delete mode 100644 .github/workflows/ui.yml delete mode 100644 Dockerfile.ui-test delete mode 100644 docker-compose.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000000..7563965ab1 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,38 @@ +# Use the latest 2.1 version of CircleCI pipeline process engine. +# See: https://circleci.com/docs/2.0/configuration-reference +version: 2.1 + +# Define a job to be invoked later in a workflow. +# See: https://circleci.com/docs/2.0/configuration-reference/#jobs +jobs: + test-argos-ci: + docker: + - image: circleci/node:16-browsers + steps: + - checkout + - run: + name: Install node_modules + command: npm i + - run: + name: Install argos cli + command: npm i fast-glob lodash @argos-ci/core + - run: + name: Install puppeteer + command: node node_modules/puppeteer/install.js + - run: + name: Build dist file + command: npm run dist + - run: + name: Run image screenshot tests + command: npm run test-image + - run: + name: Upload screenshots to Argos CI + command: npm run argos + + +# Invoke jobs via workflows +# See: https://circleci.com/docs/2.0/configuration-reference/#workflows +workflows: + test-argos-ci-workflow: + jobs: + - test-argos-ci diff --git a/.github/workflows/ui-upload.yml b/.github/workflows/ui-upload.yml deleted file mode 100644 index 0129544f57..0000000000 --- a/.github/workflows/ui-upload.yml +++ /dev/null @@ -1,69 +0,0 @@ -# Upload 📷 UI snapshots to argos server, help visual regression testing. -name: 📷 UI Upload - -on: - workflow_run: - workflows: ["📷 UI"] - types: - - completed - -permissions: - contents: read - -jobs: - wait: - runs-on: ubuntu-latest - steps: - - name: Wait - run: sleep 60 - upload-ui: - permissions: - actions: read # for dawidd6/action-download-artifact to query and download artifacts - pull-requests: read # for dawidd6/action-download-artifact to query commit hash - name: deploy preview - runs-on: ubuntu-latest - needs: wait - if: > - github.repository == 'ant-design/ant-design' && - github.event.workflow_run.conclusion == 'success' - steps: - - name: checkout - uses: actions/checkout@v3 - - - name: Download commit artifact - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - name: commit - - - name: Save commit id - id: commit - run: echo "::set-output name=id::$( ./commit.txt - - - name: Save commit - if: github.event_name == 'push' - run: echo ${{ github.sha }} > ./commit.txt - - - name: Upload commit - if: ${{ always() }} - uses: actions/upload-artifact@v3 - with: - name: commit - path: ./commit.txt - - - name: Save branch - if: github.event_name == 'pull_request' && github.base_ref == 'master' - run: echo pull/${{ github.event.pull_request.number }}/merge > ./branch.txt - - - name: Save branch - if: github.event_name == 'push' - run: echo ${GITHUB_REF##*/} > ./branch.txt - - - name: Upload branch - if: ${{ always() }} - uses: actions/upload-artifact@v3 - with: - name: branch - path: ./branch.txt diff --git a/Dockerfile.ui-test b/Dockerfile.ui-test deleted file mode 100644 index e1b1194ea2..0000000000 --- a/Dockerfile.ui-test +++ /dev/null @@ -1,6 +0,0 @@ -FROM buildkite/puppeteer:10.0.0 -RUN mkdir /app -WORKDIR /app -COPY package.json ./ -ENV PATH="${PATH}:/app/node_modules/.bin" -COPY . . diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 5555fc9112..0000000000 --- a/docker-compose.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: '3' -services: - tests: - build: - context: . - dockerfile: Dockerfile.ui-test - volumes: - - './node_modules:/app/node_modules' - - './components:/app/components' - - './tests:/app/tests' - - './jest-stare:/app/jest-stare' - - './dist:/app/dist' - - '.jest.image.js:/app/.jest.image.js' - - './jest-puppeteer.config.js:/app/jest-puppeteer.config.js' - - './imageSnapshots:/app/imageSnapshots' - - './imageDiffSnapshots:/app/imageDiffSnapshots' - entrypoint: "npm run test-image:docker" diff --git a/package.json b/package.json index e691643900..03f4ff8834 100644 --- a/package.json +++ b/package.json @@ -98,8 +98,7 @@ "test-node": "jest --config .jest.node.js --cache=false", "tsc": "tsc --noEmit", "site:test": "jest --config .jest.site.js --cache=false --force-exit", - "test-image": "npm run dist && docker-compose run tests", - "test-image:docker": "node node_modules/puppeteer/install.js && jest --config .jest.image.js --no-cache -i", + "test-image": "npm run dist && jest --config .jest.image.js --no-cache -i -u", "argos": "node ./scripts/argos-upload.js", "version": "node ./scripts/generate-version", "install-react-16": "npm i --no-save --legacy-peer-deps react@16 react-dom@16", diff --git a/scripts/argos-upload.js b/scripts/argos-upload.js index c76d91f2bb..1d3d10b590 100644 --- a/scripts/argos-upload.js +++ b/scripts/argos-upload.js @@ -47,7 +47,7 @@ async function run() { token: process.env.ARGOS_TOKEN, parallel: { total: chunks.length, - nonce: process.env.ARGOS_PARALLEL_NONCE, + nonce: process.env.ARGOS_PARALLEL_NONCE || process.env.CIRCLE_BUILD_NUM, }, }); // eslint-disable-next-line no-console -- pipe stdout