mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 09:26:06 +08:00
ci: remove argos usage (#46185)
This commit is contained in:
parent
6d963b7949
commit
acf056ce72
@ -1,33 +0,0 @@
|
||||
# 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: cimg/node:21.2-browsers
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install node_modules
|
||||
command: yarn
|
||||
- run:
|
||||
name: Build dist file
|
||||
command: npm run dist:esbuild
|
||||
- run:
|
||||
name: Run image screenshot tests
|
||||
command: npm run test-image
|
||||
- run:
|
||||
name: Upload screenshots to Argos CI
|
||||
command: npm run argos
|
||||
# The resource_class feature allows configuring CPU and RAM resources for each job. Different resource classes are available for different executors. https://circleci.com/docs/2.0/configuration-reference/#resourceclass
|
||||
resource_class: large
|
||||
|
||||
# Invoke jobs via workflows
|
||||
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
|
||||
workflows:
|
||||
test-argos-ci-workflow:
|
||||
jobs:
|
||||
- test-argos-ci
|
@ -1,71 +0,0 @@
|
||||
# Due to some special reasons, some accounts are blocked by circleCI
|
||||
# and cannot trigger argos jobs through circleCI.
|
||||
# These accounts can be configured in the whitelist list
|
||||
# and do not need to rely on circleCI to directly trigger argos in the PR workflow
|
||||
|
||||
name: Trigger Argos with white-listed users
|
||||
|
||||
on: [push]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
trigger_argos_with_whitelist_users:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Read white listed users
|
||||
id: read_users
|
||||
run: |
|
||||
whitelist_file="argos-white-listed-users"
|
||||
if [[ -f $whitelist_file ]]; then
|
||||
users=$(cat $whitelist_file)
|
||||
echo "whitelisted_users=$users" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Check if user is whitelisted
|
||||
id: check_user
|
||||
run: |
|
||||
whitelisted_users="${{ steps.read_users.outputs.whitelisted_users }}"
|
||||
current_user="${{ github.actor }}"
|
||||
if grep -Fxq "$current_user" <<< "$whitelisted_users"; then
|
||||
echo "User is whitelisted"
|
||||
echo "whitelisted=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "User is not whitelisted"
|
||||
echo "whitelisted=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: cache package-lock.json
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: package-temp-dir
|
||||
key: lock-${{ github.sha }}
|
||||
|
||||
- name: create package-lock.json
|
||||
run: npm i --package-lock-only --ignore-scripts
|
||||
|
||||
- name: install
|
||||
run: npm install
|
||||
|
||||
- name: Build dist file
|
||||
id: build
|
||||
if: ${{ steps.check_user.outputs.whitelisted == 'true' }}
|
||||
run: npm run dist:esbuild
|
||||
|
||||
- name: Run image screenshot tests
|
||||
id: screenshot
|
||||
if: ${{ steps.check_user.outputs.whitelisted == 'true' }}
|
||||
run: npm run test-image
|
||||
|
||||
- name: Upload screenshots to Argos CI
|
||||
id: upload
|
||||
if: ${{ steps.check_user.outputs.whitelisted == 'true' }}
|
||||
env:
|
||||
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
|
||||
ARGOS_PARALLEL_NONCE: ${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
|
||||
run: npm run argos
|
@ -12,7 +12,7 @@
|
||||
|
||||
[![CI status][github-action-image]][github-action-url] [![codecov][codecov-image]][codecov-url] [![NPM version][npm-image]][npm-url] [![NPM downloads][download-image]][download-url]
|
||||
|
||||
[![][bundlephobia-image]][bundlephobia-url] [![][bundlesize-js-image]][unpkg-js-url] [![FOSSA Status][fossa-image]][fossa-url] [![Covered by Argos Visual Testing][argos-ci-image]][argos-ci-url]
|
||||
[![][bundlephobia-image]][bundlephobia-url] [![][bundlesize-js-image]][unpkg-js-url] [![FOSSA Status][fossa-image]][fossa-url]
|
||||
|
||||
[![Follow Twitter][twitter-image]][twitter-url] [![Renovate status][renovate-image]][renovate-dashboard-url] [![][issues-helper-image]][issues-helper-url] [![dumi][dumi-image]][dumi-url] [![Issues need help][help-wanted-image]][help-wanted-url]
|
||||
|
||||
@ -40,8 +40,6 @@
|
||||
[renovate-dashboard-url]: https://github.com/ant-design/ant-design/issues/32498
|
||||
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
|
||||
[dumi-url]: https://github.com/umijs/dumi
|
||||
[argos-ci-image]: https://argos-ci.com/badge.svg
|
||||
[argos-ci-url]: https://app.argos-ci.com/ant-design/ant-design/reference
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -12,7 +12,7 @@ An enterprise-class UI design language and React UI library.
|
||||
|
||||
[![CI status][github-action-image]][github-action-url] [![codecov][codecov-image]][codecov-url] [![NPM version][npm-image]][npm-url] [![NPM downloads][download-image]][download-url]
|
||||
|
||||
[![][bundlephobia-image]][bundlephobia-url] [![][bundlesize-js-image]][unpkg-js-url] [![FOSSA Status][fossa-image]][fossa-url] [![Covered by Argos Visual Testing][argos-ci-image]][argos-ci-url]
|
||||
[![][bundlephobia-image]][bundlephobia-url] [![][bundlesize-js-image]][unpkg-js-url] [![FOSSA Status][fossa-image]][fossa-url]
|
||||
|
||||
[![Follow Twitter][twitter-image]][twitter-url] [![Renovate status][renovate-image]][renovate-dashboard-url] [![][issues-helper-image]][issues-helper-url] [![dumi][dumi-image]][dumi-url] [![Issues need help][help-wanted-image]][help-wanted-url]
|
||||
|
||||
@ -40,8 +40,6 @@ An enterprise-class UI design language and React UI library.
|
||||
[renovate-dashboard-url]: https://github.com/ant-design/ant-design/issues/32498
|
||||
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
|
||||
[dumi-url]: https://github.com/umijs/dumi
|
||||
[argos-ci-image]: https://argos-ci.com/badge.svg
|
||||
[argos-ci-url]: https://app.argos-ci.com/ant-design/ant-design/reference
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
kiner-tang
|
@ -44,7 +44,6 @@
|
||||
],
|
||||
"scripts": {
|
||||
"api-collection": "antd-tools run api-collection",
|
||||
"argos": "tsx scripts/argos-upload.ts",
|
||||
"authors": "tsx scripts/generate-authors.ts",
|
||||
"biome:format": "biome format --write .",
|
||||
"build": "npm run compile && NODE_OPTIONS='--max-old-space-size=4096' npm run dist",
|
||||
@ -166,7 +165,6 @@
|
||||
"@ant-design/happy-work-theme": "^1.0.0",
|
||||
"@ant-design/tools": "^18.0.2",
|
||||
"@antv/g6": "^4.8.13",
|
||||
"@argos-ci/core": "^1.0.0",
|
||||
"@babel/eslint-plugin": "^7.19.1",
|
||||
"@biomejs/biome": "^1.0.0",
|
||||
"@codesandbox/sandpack-react": "^2.9.0",
|
||||
|
@ -1,65 +0,0 @@
|
||||
// Thanks to material-ui ❤️
|
||||
// Create chunks for Argos: https://github.com/mui/material-ui/pull/23518
|
||||
// https://github.com/mui/material-ui/blob/af81aae3b292ed180e7652a665fad1be2b38a7b3/scripts/pushArgos.js
|
||||
import childProcess from 'child_process';
|
||||
import util from 'util';
|
||||
import argos from '@argos-ci/core';
|
||||
import glob from 'fast-glob';
|
||||
import lodashChunk from 'lodash/chunk';
|
||||
|
||||
const execFileNode = util.promisify(childProcess.execFile);
|
||||
|
||||
function execFile(command: string, args: string[]) {
|
||||
return execFileNode(command, args, {
|
||||
cwd: process.cwd(),
|
||||
env: process.env,
|
||||
encoding: 'utf-8',
|
||||
});
|
||||
}
|
||||
|
||||
const screenshotsBase = 'imageSnapshots';
|
||||
const screenshotsChunks = `imageSnapshots-chunks`;
|
||||
const BATCH_SIZE = 128;
|
||||
|
||||
async function cpToTemp(screenshot: string, target: string) {
|
||||
await execFile('mkdir', ['-p', target]);
|
||||
await execFile('cp', [screenshot, target]);
|
||||
}
|
||||
|
||||
async function run() {
|
||||
const screenshots = await glob(`${screenshotsBase}/**/*`);
|
||||
const chunks = lodashChunk<string>(screenshots, BATCH_SIZE);
|
||||
|
||||
await Promise.all(
|
||||
chunks.map((chunk, chunkIndex) =>
|
||||
Promise.all(
|
||||
chunk.map<Promise<void>>((screenshot) =>
|
||||
cpToTemp(screenshot, `${screenshotsChunks}/${chunkIndex}`),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// eslint-disable-next-line no-console -- pipe stdout
|
||||
console.log('Chunk Size:', chunks.length, '/', 'Total Snapshots:', screenshots.length);
|
||||
|
||||
for (let i = 0; i < chunks.length; i += 1) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const result = await argos.upload({
|
||||
root: `${screenshotsChunks}/${i}`,
|
||||
token: process.env.ARGOS_TOKEN,
|
||||
parallel: {
|
||||
total: chunks.length,
|
||||
nonce: process.env.ARGOS_PARALLEL_NONCE || process.env.CIRCLE_BUILD_NUM || '',
|
||||
},
|
||||
});
|
||||
// eslint-disable-next-line no-console -- pipe stdout
|
||||
console.log(i, '>', result);
|
||||
}
|
||||
}
|
||||
|
||||
run().catch((error) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
Loading…
Reference in New Issue
Block a user