ci: remove argos usage (#46208)

ref: https://github.com/ant-design/ant-design/pull/46185
This commit is contained in:
2023-12-01 15:30:58 +08:00 committed by GitHub
parent 916332cd80
commit 352fac8b3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 99 deletions

View File

@ -1,36 +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:16.18.1-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: 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
# 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

View File

@ -100,7 +100,6 @@
"tsc": "tsc --noEmit",
"site:test": "jest --config .jest.site.js --cache=false --force-exit",
"test-image": "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",
"install-react-17": "npm i --no-save --legacy-peer-deps react@17 react-dom@17",

View File

@ -1,62 +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
const util = require('util');
const childProcess = require('child_process');
const glob = require('fast-glob');
const lodashChunk = require('lodash/chunk');
// eslint-disable-next-line import/no-unresolved
const argos = require('@argos-ci/core');
const execFileNode = util.promisify(childProcess.execFile);
function execFile(command, args) {
return execFileNode(command, args, {
cwd: process.cwd(),
env: process.env,
encoding: 'utf-8',
});
}
const screenshotsBase = 'imageSnapshots';
const screenshotsChunks = `imageSnapshots-chunks`;
const BATCH_SIZE = 200;
async function cpToTemp(screenshot, target) {
await execFile('mkdir', ['-p', target]);
await execFile('cp', [screenshot, target]);
}
async function run() {
const screenshots = await glob(`${screenshotsBase}/**/*`);
const chunks = lodashChunk(screenshots, BATCH_SIZE);
await Promise.all(
chunks.map((chunk, chunkIndex) =>
Promise.all(
chunk.map((screenshot) => cpToTemp(screenshot, `${screenshotsChunks}/${chunkIndex}`)),
),
),
);
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(result);
}
}
run().catch((error) => {
// eslint-disable-next-line no-console
console.error(error);
process.exit(1);
});