From 684aec777f09141dcf12651feaec8cbbb17f5844 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 1 Nov 2024 17:02:33 -0700 Subject: [PATCH] regexp-generator: Include these generated tests in make.py This is necessary so that updates to the tests without corresponding updates to the generator script will be flagged in CI runs. --- .github/workflows/checks.yml | 5 +++++ make.py | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 817ab13ad8..861d58b7dc 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -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 diff --git a/make.py b/make.py index 2f5cf91d2a..9905d745c4 100755 --- a/make.py +++ b/make.py @@ -8,8 +8,10 @@ import os, shutil, subprocess, sys 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) @@ -36,17 +38,27 @@ def target(*deps): 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']()