Skip to content

Commit

Permalink
add scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed May 17, 2024
1 parent 809dda2 commit 3d3bc93
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/repos
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@

This repository is used to run integration tests for oxlint ecosystem projects

## via github workflow

### scheduled
## Scheduled github workflow

Workflows are scheduled to run automatically every day

### manually
## Manual github workflow

* open [workflow](https://github.com/oxc-project/oxlint-ecosystem-ci/actions/workflows/ecosystem-ci.yml)
* click 'Run workflow' button on top right of the list
* select suite to run in dropdown
* start workflow

## how to add a new integration test
## Local

- `./clone.js` - clones all the repositories
- `./update.js` - updates (git pull) all the repositories
- `./run.js PATH_TO_OXLINT_BINARY` - run oxlint

## Add a new integration test

* Add your repository to the test-ecosystem matrix [ecosystem-ci.yml](https://github.com/oxc-project/oxlint-ecosystem-ci/blob/main/.github/workflows/ecosystem-ci.yml)
* Due to maintenance burden, a [sponsorship](https://github.com/sponsors/Boshen) will have a more likely hood of having the PR accepted.
Expand Down
18 changes: 18 additions & 0 deletions clone.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

const exec = require("child_process").exec;

const matrix = require("./matrix.json");

for (const item of matrix) {
const command = `git clone --depth=1 -b ${item.ref} git@github.com:${item.repository}.git repos/${item.path}`;

console.log(`Running ${command}`);
exec(command, function (err) {
if (err) {
console.error(err);
return;
}
console.log(`Cloned ${item.repository}`);
});
}
18 changes: 18 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

const execSync = require("child_process").execSync;

const matrix = require("./matrix.json");

const binary = process.argv[2];

if (!binary) {
console.error("USAGE: ./test.js PATH_TO_OXLINT_BINARY");
return;
}

for (const item of matrix) {
const oxlint = item.command.replace(/^.\/oxlint/, binary);
const command = `cd repos/${item.path} && ${oxlint}`;
execSync(command, { stdio: "inherit" });
}
18 changes: 18 additions & 0 deletions update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

const exec = require("child_process").exec;

const matrix = require("./matrix.json");

for (const item of matrix) {
const command = `cd repos/${item.path} && git pull`;

console.log(`Running ${command}`);
exec(command, function (err) {
if (err) {
console.error(err);
return;
}
console.log(`Updated ${item.repository}`);
});
}

0 comments on commit 3d3bc93

Please sign in to comment.