Skip to content

Commit cb84114

Browse files
chore(ci): add unit test js/python scripts (#2408)
Description Adds CI coverage for scripts under .github/scripts in dev_module_build.yml: Run JS scripts unit tests runs .github/scripts/js tests with Node.js 24 and npm install && npm test. Run Python scripts unit tests runs .github/scripts/python tests with Python 3.12 and python -m unittest discover. Both jobs are independent and run alongside the existing lint/test jobs on the workflow's existing triggers. ---------------- Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
1 parent be1499b commit cb84114

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/dev_module_build.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,52 @@ jobs:
325325
task virtualization-controller:init
326326
task virtualization-controller:test:unit
327327
328+
test_scripts_js:
329+
runs-on: ubuntu-22.04
330+
name: Run JS unit tests
331+
env:
332+
NODE_VERSION: "24"
333+
steps:
334+
- name: Set up Node.js ${{ env.NODE_VERSION }}
335+
uses: actions/setup-node@v4
336+
with:
337+
node-version: "${{ env.NODE_VERSION }}"
338+
339+
- uses: actions/checkout@v4
340+
with:
341+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
342+
343+
- name: Install JS dependencies
344+
working-directory: .github/scripts/js
345+
run: npm install
346+
347+
- name: Run JS unit tests
348+
working-directory: .github/scripts/js
349+
run: npm test
350+
351+
test_scripts_python:
352+
runs-on: ubuntu-22.04
353+
name: Run Python unit tests
354+
env:
355+
PYTHON_VERSION: "3.12"
356+
steps:
357+
- name: Set up Python ${{ env.PYTHON_VERSION }}
358+
uses: actions/setup-python@v5
359+
with:
360+
python-version: "${{ env.PYTHON_VERSION }}"
361+
362+
- uses: actions/checkout@v4
363+
with:
364+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
365+
366+
- name: Install Python dependencies
367+
working-directory: .github/scripts/python
368+
run: pip install -r requirements.txt
369+
370+
- name: Run Python unit tests
371+
working-directory: .github/scripts/python
372+
run: python -m unittest discover -p '*_test.py' -v
373+
328374
dev_setup_build:
329375
runs-on: ${{ fromJSON(needs.set_vars.outputs.runner_type)}}
330376
name: Build and Push images

0 commit comments

Comments
 (0)