Skip to content

Commit

Permalink
Ci/e2e test runner (LIT-Protocol#276)
Browse files Browse the repository at this point in the history
* add e2e runners

* update run cmds

* add build step

* remove branch context on runners

* add step depdency

* add post build script run to build script

* add linking step

* add pathing to shell scipt exec

* fix bash script runner

* remove file type from link script

* remove hashing and relink

* fmt

* add more e2e groups

* add support for multiple groups

* change group run flags
  • Loading branch information
Bean authored Dec 17, 2023
1 parent 8eb5ca1 commit 107c8a2
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 6 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,27 @@ jobs:
run: yarn install
- name: Lint
run: yarn prettier:check
e2e-connection:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
NETWORK: cayenne
MINT_NEW: true
DEBUG: true
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install project dependencies
run: yarn install
- name: Build packages
id: build
run: yarn build
- name: Run End to End Tests
if: steps.build.outputs.exit_code == 0
run: yarn test:e2e:node --group=connection --group=lit-actions --group=pkp-auth-method --group=pkp-ethers
24 changes: 18 additions & 6 deletions e2e-nodejs/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,29 @@ async function main() {
const mode = process.argv.includes('--parallel') ? 'parallel' : 'async';
const args = process.argv.slice(2);
const filesArg = args.find((arg) => arg.startsWith('--filter'));
const groupArg = args.find((arg) => arg.startsWith('--group'));
const groupArgs = args.filter((arg) => arg.startsWith('--group'));

let filesValue = filesArg ? filesArg.split('=')[1] : null;
let groupValue = groupArg ? groupArg.split('=')[1] : null;

let groupValues = groupArgs
? groupArgs.map((group) => group.split('=')[1])
: [];

filesValue = filesValue ? filesValue.split(',') : null;

let files = getFilesFromDir(DIR).filter((file) => {
return filesValue ? filesValue.some((value) => file.includes(value)) : true;
});

if (groupValue) {
files = files.filter((file) => file.includes(`group-${groupValue}`));
if (groupValues.length > 0) {
let filteredFiles = [];
for (const groupValue of groupValues) {
console.log('group ', groupValue);
filteredFiles = filteredFiles.concat(
files.filter((file) => file.includes(`group-${groupValue}`))
);
}
files = filteredFiles;
}

if (files.length <= 0) {
Expand All @@ -94,8 +106,8 @@ async function main() {
'\n --------------------------------------------------------------------------------'
);

if (groupValue) {
console.log(`\n🚀 Running tests in group: ${groupValue}`);
if (groupValues) {
console.log(`\n🚀 Running tests in group: ${groupValues}`);
}
let currentGroup = null;
let errorCounter = 0;
Expand Down
3 changes: 3 additions & 0 deletions tools/scripts/tools.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ async function buildFunc() {

await childRunCommand(`yarn nx run ${TARGET}:_buildTsc`);
spawnListener(`yarn nx run ${TARGET}:_buildWeb`);
await childRunCommand(
`yarn tools --postBuildIndividual --target ${TARGET}`
);
await childRunCommand(`yarn postBuild:mapDistFolderNameToPackageJson`);
await childRunCommand(`yarn postBuild:mapDepsToDist`);
await childRunCommand(`yarn gen:html`);
Expand Down

0 comments on commit 107c8a2

Please sign in to comment.