Skip to content

Commit

Permalink
Try @argos-ci/core
Browse files Browse the repository at this point in the history
  • Loading branch information
michaldudak committed Sep 2, 2022
1 parent c3adcc9 commit 69995a9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 529 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -69,7 +69,7 @@
"validate-declarations": "babel-node --extensions \".ts\" scripts/validateTypescriptDeclarations.ts"
},
"devDependencies": {
"@argos-ci/cli": "^0.1.2",
"@argos-ci/core": "^0.2.0",
"@babel/cli": "^7.18.10",
"@babel/core": "^7.18.13",
"@babel/node": "^7.18.10",
Expand Down
43 changes: 16 additions & 27 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,21 +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',
'--commit',
process.env.CIRCLE_SHA1,
'--branch',
process.env.CIRCLE_BRANCH,
'--parallel',
'--parallel-total',
chunks.length,
'--parallel-nonce',
process.env.CIRCLE_BUILD_NUM,
`${screenshotsTmp}/${i}`,
]);
// 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 69995a9

Please sign in to comment.