| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- name: PR Comments
- on:
- pull_request_target:
- branches:
- - master
- permissions:
- pull-requests: write
- jobs:
- pytest-codecov-comment:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- - name: Set up Python 3.11
- uses: actions/setup-python@v5
- with:
- python-version: 3.11
- - name: Cache pip
- uses: actions/cache@v4
- with:
- # This path is specific to Ubuntu
- path: ~/.cache/pip
- key: ${{ runner.os }}-pip-${{ hashFiles('desktop/core/generate_requirements.py') }}
- restore-keys: |
- ${{ runner.os }}-pip-
- ${{ runner.os }}-
-
- - name: Setup node 20 and cache npm
- uses: actions/setup-node@v4
- with:
- node-version: 20
- cache: 'npm'
-
- - name: Build Hue
- run: |
- sudo apt-get update
- sudo apt-get install -y build-essential asciidoc libkrb5-dev libldap2-dev libsasl2-dev libxslt-dev libsasl2-modules-gssapi-mit libsnappy-dev libgdbm-dev
- export PYTHON_VER=python3.11
- export SKIP_PYTHONDEV_CHECK=true
- export ROOT=$PWD
- make apps test_prep
- - name: Run python unit tests
- continue-on-error: true
- run: |
- ./build/env/bin/pytest
-
- - name: Add pytest and code coverage PR comment
- uses: MishaKav/pytest-coverage-comment@v1
- with:
- pytest-xml-coverage-path: ./reports/code-cov/coverage.xml
- junitxml-path: ./reports/pytest/test_report.xml
- junitxml-title: Pytest Report
- title: Python Coverage Report
- badge-title: Python Code Coverage
- report-only-changed-files: true
- xml-skip-covered: true
- remove-link-from-badge: true
- default-branch: master
-
- python-ut-files-comment:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- - name: Get changed test files
- id: changed-test-files
- uses: tj-actions/changed-files@v45
- with:
- files_yaml: |
- test:
- - '**/*_test{s,}.py' # Matches files ending with `_test.py` (e.g., `some_module_test.py`, `some_module_tests.py`)
- - '**/test{s,}_*.py' # Matches files starting with `test_` (e.g., `test_helper.py`, `tests_helper.py`)
- - '**/test{s,}.py' # Matches both `test.py` and `tests.py` (e.g., `some_folder/test.py`, `some_folder/tests.py`)
- - '**/*.test.*' # Matches files containing `.test.` anywhere in the name (e.g., `test_file.test.py`, `module.test.js`)
- - name: Check if test files were modified
- id: check-test-files
- run: |
- if [[ "${{ steps.changed-test-files.outputs.test_any_changed }}" == "true" ]]; then
- echo "comment_message=✅ Test files were modified. Ensure that the tests cover all relevant changes. ✅" >> $GITHUB_ENV
- else
- echo "comment_message=⚠️ No test files modified. Please ensure that changes are properly tested. ⚠️" >> $GITHUB_ENV
- fi
- - name: Update PR with test file change status
- uses: mshick/add-pr-comment@v2
- with:
- message: "${{ env.comment_message }}"
- allow-repeats: false
|