diff --git a/.github/workflows/Testbase.yml b/.github/workflows/Testbase.yml deleted file mode 100644 index 02fca019..00000000 --- a/.github/workflows/Testbase.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Base - -on: - workflow_call: - inputs: - python: - required: true - type: string - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Set up Python ${{ inputs.python }} - uses: actions/checkout@v4.2.2 - - name: Install dependencies - uses: actions/setup-python@v5.3.0 - with: - python-version: ${{ inputs.python }} - - name: Install package - run: | - python -m pip install --upgrade pip - pip install flake8 pytest pytest-cov pytest-xdist wheel numpy h5py - git branch - pip install -e . - - name: create local pymodaq folder and setting permissions - run: | - sudo mkdir /etc/.pymodaq - sudo chmod uo+rw /etc/.pymodaq - - name: Linting with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=docs - - name: Run tests - run: pytest --cov - - name: Upload results to Codecov - uses: codecov/codecov-action@v4.6.0 - with: - token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/Testbase_win.yml b/.github/workflows/Testbase_win.yml deleted file mode 100644 index 24e7e51a..00000000 --- a/.github/workflows/Testbase_win.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Base - -on: - workflow_call: - inputs: - python: - required: true - type: string - -jobs: - build: - runs-on: windows-latest - steps: - - name: Set up Python ${{ inputs.python }} - uses: actions/checkout@v4.2.2 - - name: Install dependencies - uses: actions/setup-python@v5.3.0 - with: - python-version: ${{ inputs.python }} - - name: Install package - run: | - python -m pip install --upgrade pip - pip install flake8 pytest pytest-cov pytest-xdist wheel numpy h5py - git branch - pip install -e . - - name: Linting with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=src/pymodaq/resources/QtDesigner_Ressources,docs - - name: Run tests - run: pytest --cov -n auto - - name: Upload results to Codecov - uses: codecov/codecov-action@v4.6.0 - with: - token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/Testp310.yml b/.github/workflows/Testp310.yml deleted file mode 100644 index 9363b908..00000000 --- a/.github/workflows/Testp310.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: '3.10' - -on: [push, pull_request] - -jobs: - call_workflow: - uses: ./.github/workflows/Testbase.yml - with: - python: '3.10' \ No newline at end of file diff --git a/.github/workflows/Testp311.yml b/.github/workflows/Testp311.yml deleted file mode 100644 index 0b31a4b0..00000000 --- a/.github/workflows/Testp311.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: '3.11' - -on: [push, pull_request] - -jobs: - call_workflow: - uses: ./.github/workflows/Testbase.yml - with: - python: '3.11' diff --git a/.github/workflows/Testp311_win.yml b/.github/workflows/Testp311_win.yml deleted file mode 100644 index f2748b40..00000000 --- a/.github/workflows/Testp311_win.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: '3.11 Windows' - -on: [push, pull_request] - -jobs: - call_workflow: - uses: ./.github/workflows/Testbase.yml - with: - python: '3.11' diff --git a/.github/workflows/Testp312.yml b/.github/workflows/Testp312.yml deleted file mode 100644 index efd2d30f..00000000 --- a/.github/workflows/Testp312.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: '3.12' - -on: [push, pull_request] - -jobs: - call_workflow: - uses: ./.github/workflows/Testbase.yml - with: - python: '3.12' diff --git a/.github/workflows/Testp38.yml b/.github/workflows/Testp38.yml deleted file mode 100644 index afcb3f25..00000000 --- a/.github/workflows/Testp38.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: '3.8' - -on: [push, pull_request] - -jobs: - call_workflow: - uses: ./.github/workflows/Testbase.yml - with: - python: '3.8' \ No newline at end of file diff --git a/.github/workflows/Testp39.yml b/.github/workflows/Testp39.yml deleted file mode 100644 index 0ce19004..00000000 --- a/.github/workflows/Testp39.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: '3.9' - -on: [push, pull_request] - -jobs: - call_workflow: - uses: ./.github/workflows/Testbase.yml - with: - python: '3.9' \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..5886b482 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,177 @@ +name: tests + +on: + workflow_call: + + pull_request: + + push: + branches: + - '*' + - '!badges' # to exclude execution if someone pushes on this branch (shouldn't happen) + +concurrency: + # github.workflow: name of the workflow + # github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + # Cancel in-progress runs when a new workflow with the same group name is triggered + cancel-in-progress: true + +jobs: + tests: + continue-on-error: true + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest", "windows-latest"] + python-version: ["3.9", "3.10", "3.11", "3.12"] + runs-on: ${{ matrix.os }} + + steps: + # Get the branch name for the badge generation + - name: Extract branch name + shell: bash + run: echo "branch=${GITHUB_REF#refs/heads/}" >> "${GITHUB_OUTPUT}" + id: extract_branch + + + - name: Checkout the repo + uses: actions/checkout@v4.2.2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5.3.0 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest pytest-cov pytest-xdist wheel numpy h5py + pip install -e . + + # Create folder and set permissions on Ubuntu + - name: Create local pymodaq folder (Ubuntu) + if: runner.os == 'Linux' + run: | + sudo mkdir -p /etc/.pymodaq + sudo chmod uo+rw /etc/.pymodaq + + - name: Linting with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=docs + - name: Tests with ${{ matrix.os }} ${{ matrix.python-version }} + id: tests + run: | + mkdir coverage + pytest --cov=pymodaq_data -n 1 + mv .coverage coverage/coverage_${{ matrix.os }}_${{ matrix.python-version }} + - name: Upload coverage artifact + uses: actions/upload-artifact@v4 + with: + name: coverage-${{ matrix.os }}-${{ matrix.python-version }} + path: coverage/coverage_${{ matrix.os }}_${{ matrix.python-version }} + + + + - name: Create destination directory + if: ${{ always() }} + run: | + mkdir -p "${{ steps.extract_branch.outputs.branch }}" + + - name: generate badge (success) + if: ${{ success() }} + uses: emibcn/badge-action@v2.0.2 + with: + label: '' + status: 'passing' + color: 'green' + path: '${{ steps.extract_branch.outputs.branch }}/tests_${{runner.os}}_${{matrix.python-version}}.svg' + - name: generate badge (fail) + if: ${{ failure() }} + uses: emibcn/badge-action@v2.0.2 + with: + label: '' + status: 'failing' + color: 'red' + path: '${{ steps.extract_branch.outputs.branch }}/tests_${{runner.os}}_${{matrix.python-version}}.svg' + + + - name: Upload badge artifact + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: tests_${{runner.os}}_${{matrix.python-version}} + path: '${{ steps.extract_branch.outputs.branch }}/tests_${{runner.os}}_${{matrix.python-version}}.svg' + if-no-files-found: error + + outputs: + branch: ${{ steps.extract_branch.outputs.branch }} + + badge-update: + runs-on: ubuntu-latest + needs: tests # Ensure this job runs after all matrix jobs complete + steps: + # switch to badges branches to commit + - uses: actions/checkout@v4 + with: + ref: badges + + - name: Download badges + uses: actions/download-artifact@v4 + + - name: Reorganize badges + run: | + rm -rf coverage* || true + rm -rf $(git ls-files ${{ needs.tests.outputs.branch }}/*) || true + git rm $(git ls-files ${{ needs.tests.outputs.branch }}/*) || true + + mkdir -p '${{ needs.tests.outputs.branch }}' + mv tests_*/*.svg '${{ needs.tests.outputs.branch }}' + - name: Commit badges + continue-on-error: true + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add ${{ needs.tests.outputs.branch }} + git commit --allow-empty -m "Add/Update badge" + + - name: Push badges + uses: ad-m/github-push-action@master + if: ${{ success() }} + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: badges + coverage-update: + runs-on: ubuntu-latest + needs: tests # Ensure this job runs after all matrix jobs complete + + steps: + - name: Checkout the repo + uses: actions/checkout@v4.2.2 + + - name: Download all coverage artifacts + uses: actions/download-artifact@v4 + with: + path: ./coverage-reports + + - name: Reorganize reports + run: | + cd coverage-reports + rm -rf tests_* + for folder in *; do + mv "${folder}"/* .; + done; + rmdir --ignore-fail-on-non-empty * || true + cd .. + # We only combine linux reports otherwise the tool complains about windows directories ... + - name: Combine coverage reports + run: | + python -m pip install coverage + coverage combine ./coverage-reports/coverage_* + coverage xml -i + + - name: Upload combined coverage report to Codecov + uses: codecov/codecov-action@v5.0.7 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml \ No newline at end of file diff --git a/README.rst b/README.rst index ffa3923a..2da44e38 100644 --- a/README.rst +++ b/README.rst @@ -9,38 +9,47 @@ PyMoDAQ Data :target: https://pymodaq.readthedocs.io/en/stable/?badge=latest :alt: Documentation Status -.. image:: https://codecov.io/gh/PyMoDAQ/pymodaq_data/branch/0.0.x/graph/badge.svg?token=IQNJRCQDM2 - :target: https://codecov.io/gh/PyMoDAQ/pymodaq_data +.. image:: https://codecov.io/gh/PyMoDAQ/pymodaq_data/graph/badge.svg?token=H32JflMEYR + :target: https://codecov.io/gh/PyMoDAQ/pymodaq_data -====== ======= ====== -Python OS Passed -====== ======= ====== -3.8 Linux |38| -3.9 Linux |39| -3.10 Linux |310| -3.11 Linux |311| -3.12 Linux |312| -3.11 Windows |311win| -====== ======= ====== ++-------------+-------------+---------------+ +| | Linux | Windows | ++=============+=============+===============+ +| Python 3.9 | |39-linux| | |39-windows| | ++-------------+-------------+---------------+ +| Python 3.10 | |310-linux| | |310-windows| | ++-------------+-------------+---------------+ +| Python 3.11 | |311-linux| | |311-windows| | ++-------------+-------------+---------------+ +| Python 3.12 | |312-linux| | |312-windows| | ++-------------+-------------+---------------+ -.. |38| image:: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/Testp38.yml/badge.svg?branch=0.0.x_dev - :target: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/Testp385.yml -.. |39| image:: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/Testp39.yml/badge.svg?branch=0.0.x_dev - :target: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/Testp39.yml -.. |310| image:: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/Testp310.yml/badge.svg?branch=0.0.x_dev - :target: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/Testp310.yml +.. |39-linux| image:: https://raw.githubusercontent.com/PyMoDAQ/pymodaq_data/badges/5.0.x_dev/tests_Linux_3.9.svg + :target: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/tests.yml -.. |311| image:: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/Testp311.yml/badge.svg?branch=0.0.x_dev - :target: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/Testp311.yml +.. |310-linux| image:: https://raw.githubusercontent.com/PyMoDAQ/pymodaq_data/badges/5.0.x_dev/tests_Linux_3.10.svg + :target: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/tests.yml -.. |312| image:: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/Testp312.yml/badge.svg?branch=0.0.x_dev - :target: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/Testp312.yml +.. |311-linux| image:: https://raw.githubusercontent.com/PyMoDAQ/pymodaq_data/badges/5.0.x_dev/tests_Linux_3.11.svg + :target: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/tests.yml -.. |311win| image:: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/Testp311_win.yml/badge.svg?branch=0.0.x_dev - :target: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/Testp311_win.yml +.. |312-linux| image:: https://raw.githubusercontent.com/PyMoDAQ/pymodaq_data/badges/5.0.x_dev/tests_Linux_3.12.svg + :target: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/tests.yml + +.. |39-windows| image:: https://raw.githubusercontent.com/PyMoDAQ/pymodaq_data/badges/5.0.x_dev/tests_Windows_3.9.svg + :target: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/tests.yml + +.. |310-windows| image:: https://raw.githubusercontent.com/PyMoDAQ/pymodaq_data/badges/5.0.x_dev/tests_Windows_3.10.svg + :target: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/tests.yml + +.. |311-windows| image:: https://raw.githubusercontent.com/PyMoDAQ/pymodaq_data/badges/5.0.x_dev/tests_Windows_3.11.svg + :target: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/tests.yml + +.. |312-windows| image:: https://raw.githubusercontent.com/PyMoDAQ/pymodaq_data/badges/5.0.x_dev/tests_Windows_3.12.svg + :target: https://github.com/PyMoDAQ/pymodaq_data/actions/workflows/tests.yml diff --git a/pyproject.toml b/pyproject.toml index 5709eb28..acb82e13 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,11 +21,10 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Human Machine Interfaces", "Topic :: Scientific/Engineering :: Visualization", "Topic :: Software Development :: Libraries :: Python Modules", @@ -60,4 +59,4 @@ include = [ ] [tool.hatch.build.hooks.vcs] -version-file = "_version.py" \ No newline at end of file +version-file = "_version.py"