Update deploy-staging.yml #25
This file contains hidden or 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
name: Unit Tests | |
on: | |
pull_request: | |
push: | |
branches: ['**'] | |
jobs: | |
test-js-py: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: [18, 20] | |
python: ['3.10', '3.11'] | |
steps: | |
- uses: actions/checkout@v4 | |
# ───────────── JavaScript side ───────────── | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
# ⚠️ no cache line → setup-node won’t look for package-lock.json | |
# cache: 'npm' | |
- name: Install JS deps | |
run: | | |
if [ -f package-lock.json ]; then | |
echo "package-lock.json found → npm ci" | |
npm ci | |
else | |
echo "No lock-file → npm install" | |
npm install | |
fi | |
- name: Run JS unit tests (if any) | |
run: npm test -- --ci || echo "No JS tests" | |
# ───────────── Python side ───────────── | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: 'pip' | |
- name: Install Python deps & run tests | |
run: | | |
pip install -r backend/requirements.txt | |
pip install pytest | |
pytest backend || echo "No Py tests" |