Skip to content

Commit

Permalink
[test] Replace argos-cli with @argos-ci/core (#34178)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaldudak committed Sep 7, 2022
1 parent 50e2b94 commit 94ae268
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 453 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -69,6 +69,7 @@
"validate-declarations": "babel-node --extensions \".ts\" scripts/validateTypescriptDeclarations.ts"
},
"devDependencies": {
"@argos-ci/core": "^0.4.0",
"@babel/cli": "^7.18.10",
"@babel/core": "^7.18.13",
"@babel/node": "^7.18.10",
Expand Down Expand Up @@ -105,7 +106,6 @@
"@types/yargs": "^17.0.11",
"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.32.0",
"argos-cli": "^0.4.0",
"babel-loader": "^8.2.5",
"babel-plugin-istanbul": "^6.1.1",
"babel-plugin-macros": "^3.1.0",
Expand Down
40 changes: 16 additions & 24 deletions scripts/pushArgos.js
@@ -1,18 +1,8 @@
const util = require('util');
/* eslint-disable no-console */
const glob = require('fast-glob');
const fse = require('fs-extra');
const lodashChunk = require('lodash/chunk');
const childProcess = require('child_process');

const execFileNode = util.promisify(childProcess.execFile);

function execFile(command, args) {
return execFileNode(command, args, {
cwd: process.cwd(),
env: process.env,
encoding: 'utf-8',
});
}
const argos = require('@argos-ci/core');

const screenshotsBase = 'test/regressions/screenshots/chrome';
const screenshotsTmp = 'test/regressions/screenshots/argos';
Expand All @@ -37,18 +27,20 @@ async function run() {

for (let i = 0; i < chunks.length; i += 1) {
// eslint-disable-next-line no-await-in-loop
const argosResults = await execFile('argos', [
'upload',
`${screenshotsTmp}/${i}`,
'--token',
process.env.ARGOS_TOKEN,
'--batchCount',
chunks.length,
'--external-build-id',
process.env.CIRCLE_BUILD_NUM,
]);
// eslint-disable-next-line no-console -- pipe stdout
console.log(argosResults.stdout);
const result = await argos.upload({
root: `${screenshotsTmp}/${i}`,
commit: process.env.CIRCLE_SHA1,
branch: process.env.CIRCLE_BRANCH,
token: process.env.ARGOS_TOKEN,
parallel: {
total: chunks.length,
nonce: process.env.CIRCLE_BUILD_NUM,
},
});

console.log(
`Batch of ${chunks[i].length} screenshots uploaded. Build URL: ${result.build.url}`,
);
}
}

Expand Down

0 comments on commit 94ae268

Please sign in to comment.