-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cron job for testing regenerate fixtures (#3614)
- Loading branch information
1 parent
e8153f6
commit 56a12a1
Showing
5 changed files
with
72 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Node.js CI Regenerate Fixtures | ||
|
||
on: | ||
schedule: | ||
- cron: '0 15 * * 2' # Every Tuesday 7AM PST | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: staging | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.12.1' | ||
cache: 'yarn' | ||
|
||
- name: Cache Rust | ||
uses: Swatinem/rust-cache@v2 | ||
with: | ||
shared-key: nodejs | ||
|
||
- name: Install packages | ||
run: yarn --non-interactive --frozen-lockfile | ||
|
||
- name: Delete fixture files | ||
run: node ./tools/delete-fixtures.js | ||
|
||
- name: Run tests | ||
run: JEST_TIMEOUT=1000000000 yarn test:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB | ||
|
||
- name: Run slow tests | ||
run: JEST_TIMEOUT=1000000000 yarn test:slow:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const { resolve } = require('path'); | ||
const { rm, readdir } = require('fs/promises'); | ||
|
||
// Get fully resolved paths of all sub-directories in a directory | ||
async function getDirectories(dir) { | ||
return (await readdir(dir, { withFileTypes: true })) | ||
.filter(dirent => dirent.isDirectory()) | ||
.map(dirent => resolve(dir, dirent.name)) | ||
} | ||
|
||
// Recursively get all sub-directories including the root directory | ||
async function getDirectoriesRecursivePlusRoot(dir) { | ||
const subDirs = await getDirectories(dir) | ||
|
||
const list = await Promise.all(subDirs.map((subDir) => getDirectoriesRecursivePlusRoot(subDir))) | ||
return [dir, ...list.flat()] | ||
} | ||
|
||
async function run() { | ||
const dirs = (await getDirectoriesRecursivePlusRoot(process.env.PWD)) | ||
.filter((d) => { | ||
return !d.includes('node_modules') && d.endsWith('__fixtures__') | ||
}) | ||
|
||
for(const dir of dirs) { | ||
await rm(dir, { recursive: true, force: true }); | ||
|
||
console.log(`Deleted ${dir}`); | ||
} | ||
} | ||
|
||
run() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters