Skip to content

Commit

Permalink
regexp-generator: Include these generated tests in make.py
Browse files Browse the repository at this point in the history
This is necessary so that updates to the tests without corresponding
updates to the generator script will be flagged in CI runs.
  • Loading branch information
ptomato committed Nov 12, 2024
1 parent 031ed02 commit 684aec7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ jobs:
python -m pip install --upgrade pip
pip install -r tools/generation/requirements.txt
- name: Install dependencies for regexp-generator tool
run: |
cd tools/regexp-generator
npm install
- name: Build tests
run: |
./make.py clean >/dev/null
Expand Down
18 changes: 15 additions & 3 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
OUT_DIR = os.environ.get('OUT_DIR') or 'test'
SRC_DIR = os.environ.get('SRC_DIR') or 'src'

def shell(*args):
sp = subprocess.Popen(list(args), stdout=subprocess.PIPE, universal_newlines=True)

def shell(*args, **kwargs):
sp = subprocess.Popen(list(args), stdout=subprocess.PIPE,
universal_newlines=True, **kwargs)
cmd_str = ' '.join(args)

print('> ' + cmd_str)
Expand All @@ -36,17 +38,27 @@ def wrapped():
return wrapped
return other


@target()
def npm_deps():
shell('npm', 'install', cwd='./tools/regexp-generator')


@target('npm_deps')
def build():
shell(sys.executable, 'tools/generation/generator.py',
'create',
'--parents',
'--out', OUT_DIR,
SRC_DIR)
shell('npm', 'run', 'build', cwd='./tools/regexp-generator')

@target()

@target('npm_deps')
def clean():
shell(sys.executable, 'tools/generation/generator.py', 'clean', OUT_DIR)
shell('npm', 'run', 'clean', cwd='./tools/regexp-generator')


if len(sys.argv) == 1:
targets['build']()
Expand Down

0 comments on commit 684aec7

Please sign in to comment.