Skip to content

Commit

Permalink
Add cron job for testing regenerate fixtures (#3614)
Browse files Browse the repository at this point in the history
  • Loading branch information
danield9tqh authored Mar 8, 2023
1 parent e8153f6 commit 56a12a1
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 31 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/ci-regenerate-fixtures.yml
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

![Node CI](https://github.com/iron-fish/ironfish/actions/workflows/ci.yml/badge.svg)
![Rust CI](https://github.com/iron-fish/ironfish/actions/workflows/rust_ci.yml/badge.svg)
![Node CI Regenerate Fixtures](https://github.com/iron-fish/ironfish/actions/workflows/ci-regenerate-fixtures.yml/badge.svg)
[![codecov](https://codecov.io/gh/iron-fish/ironfish/branch/master/graph/badge.svg?token=fOjPFN18xZ)](https://codecov.io/gh/iron-fish/ironfish)

Iron Fish is a Layer 1 blockchain that provides the strongest privacy guarantees on every single transaction. Leveraging zero-knowledge proofs (zk-SNARKs), and the highest industry standards for encryption.
Expand Down
32 changes: 32 additions & 0 deletions tools/delete-fixtures.js
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()
27 changes: 0 additions & 27 deletions tools/reset-network-fixtures.sh

This file was deleted.

4 changes: 0 additions & 4 deletions tools/reset-network-genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ set -euo pipefail
cd "$(dirname "$0")"

(
cd ..
echo "Deleting snapshots"
find . -name "__snapshots__" | xargs rm -rf

echo "Deleting fixtures"
find . -name "__fixtures__" | xargs rm -rf
)
Expand Down

0 comments on commit 56a12a1

Please sign in to comment.