Update version to 1.4.0 #48
Workflow file for this run
This file contains 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: CI | |
on: | |
push: | |
branches: [ "**" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install build coverage gcovr flake8 pylint diff-cover | |
- name: Lint with pylint the code of the package | |
run: | | |
pylint --max-line-length=120 --disable=E0401,E0611,W0621,W0622 "*.py" "pyitt/*.py" | |
- name: Lint with pylint the code of tests and samples | |
run: | | |
pylint --max-line-length=120 --disable=E0401,E0611,C0114,C0115,C0116,R0801,R0903,R0904,R0913 "tests/*/*.py" "samples/*.py" | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --per-file-ignores="__init__.py:F401" --max-complexity=10 --max-line-length=120 --statistics --exclude ittapi | |
- name: Build package | |
run: | | |
python -m build | |
- name: Run unit tests | |
run: | | |
coverage run -m unittest discover -s tests/unit -t . | |
- name: Generate HTML code coverage report for python code | |
run: | | |
coverage html --directory=htmlcov-python | |
- name: Generate XML code coverage report for python code | |
run: | | |
coverage xml | |
- name: Generate Diff Coverage report for Python code (compare with main) | |
if: ${{ github.event_name == 'pull_request' || github.ref != 'refs/heads/main'}} | |
run: | | |
diff-cover coverage.xml --html-report diff-coverage-python.html | |
- name: Generate Diff Coverage report for Python code (compare with previous commit) | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
run: | | |
diff-cover coverage.xml --compare-branch ${{ github.event.before }} --html-report diff-coverage-python.html | |
- name: Build package with code coverage for native part and install it for integration testing | |
env: | |
PYITT_NATIVE_BUILD_WITH_CODE_COVERAGE: 1 | |
run: | | |
python -m pip install . | |
- name: Run integration tests | |
working-directory: ./tests | |
run: | | |
python -m unittest discover -s integration -t . | |
- name: Generate HTML code coverage report for native code | |
run: | | |
mkdir htmlcov-native | |
gcovr --exclude ittapi/ --html-details htmlcov-native/coverage.html --html-theme github.green | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: htmlcov-linux-${{ matrix.python-version }} | |
path: | | |
htmlcov-native/ | |
htmlcov-python/ | |
diff-coverage-python.html | |
retention-days: 1 | |
build-windows: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Insatll MSVC | |
uses: microsoft/setup-msbuild@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install build coverage flake8 pylint diff-cover | |
- name: Lint with pylint the code of the package | |
run: | | |
pylint --max-line-length=120 --disable=E0401,E0611,W0621,W0622 "*.py" "pyitt/*.py" | |
- name: Lint with pylint the code of tests and samples | |
run: | | |
pylint --max-line-length=120 --disable=E0401,E0611,C0114,C0115,C0116,R0801,R0903,R0904,R0913 "tests/*/*.py" "samples/*.py" | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --per-file-ignores="__init__.py:F401" --max-complexity=10 --max-line-length=120 --statistics --exclude ittapi | |
- name: Build package | |
run: | | |
python -m build | |
- name: Run unit tests | |
run: | | |
coverage run -m unittest discover -s tests/unit -t . | |
- name: Generate code coverage report for python code | |
run: | | |
coverage html --directory=htmlcov-python | |
- name: Generate XML code coverage report for python code | |
run: | | |
coverage xml | |
- name: Generate Diff Coverage report for Python code (compare with main) | |
if: ${{ github.event_name == 'pull_request' || github.ref != 'refs/heads/main' }} | |
run: | | |
diff-cover coverage.xml --html-report diff-coverage-python.html | |
- name: Generate Diff Coverage report for Python code (compare with previous commit) | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
run: | | |
diff-cover coverage.xml --compare-branch ${{ github.event.before }} --html-report diff-coverage-python.html | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: htmlcov-windows-${{ matrix.python-version }} | |
path: | | |
htmlcov-python/ | |
diff-coverage-python.html | |
retention-days: 1 |