diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000000..174d31e4f2 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,25 @@ +name: CI + +on: + push: + branches: + - master + workflow_call: + workflow_dispatch: + +permissions: {} + +jobs: + ensure_codegen_up_to_date: + name: Ensure codegen is up to date + uses: ./.github/workflows/ensure_codegen_up_to_date.yml + + run_build_checks: + name: Run build checks + needs: ensure_codegen_up_to_date + uses: ./.github/workflows/run_build_checks.yml + + run_unit_tests: + name: Run unit tests + needs: ensure_codegen_up_to_date + uses: ./.github/workflows/run_unit_tests.yml diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml new file mode 100644 index 0000000000..56d027a895 --- /dev/null +++ b/.github/workflows/PR.yml @@ -0,0 +1,19 @@ +name: PR + +on: + pull_request: + branches: + - master + workflow_call: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +permissions: {} + +jobs: + run_ci: + name: Run CI + uses: ./.github/workflows/CI.yml diff --git a/.github/workflows/PUBLIC_CODECOV_TOKEN_README.md b/.github/workflows/PUBLIC_CODECOV_TOKEN_README.md index f4a5fd211d..445e794720 100644 --- a/.github/workflows/PUBLIC_CODECOV_TOKEN_README.md +++ b/.github/workflows/PUBLIC_CODECOV_TOKEN_README.md @@ -5,7 +5,7 @@ of a coverage upload when using tokenless uploads. The underlying issue is rate- There are 2 possible fixes: 1. Pass the token, when uploading -2. Implement a retry on upload failure (we do this for travis-ci) +2. Implement a retry on upload failure # OKAY, BUT WHY AREN'T WE STORING THIS TOKEN IN A SECRET? According to GitHub: "With the exception of GITHUB_TOKEN, secrets are not passed to the runner when a workflow is triggered from a forked repository." diff --git a/.github/workflows/ensure_codegen_up_to_date.yml b/.github/workflows/ensure_codegen_up_to_date.yml new file mode 100644 index 0000000000..dd9898a43f --- /dev/null +++ b/.github/workflows/ensure_codegen_up_to_date.yml @@ -0,0 +1,30 @@ +name: Ensure codegen is up to date + +on: + workflow_call: + +permissions: {} + +jobs: + ensure_codegen_up_to_date: + name: Ensure codegen is up to date + runs-on: ubuntu-latest + steps: + - name: Check out repo + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + submodules: recursive + - name: Set up Python + uses: ni/python-actions/setup-python@aa64e60612cb078b0c2ada666becbd70d4817d55 # v0.7.1 + id: setup-python + with: + python-version: '3.12' + - name: Install tox + run: python -m pip install --upgrade tox + - name: Cache tox environments + uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2 + with: + path: .tox + key: nimi-python-codegen-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('tox.ini') }} + - name: Ensure codegen is up to date + run: python tools/ensure_codegen_up_to_date.py diff --git a/.github/workflows/run_build_checks.yml b/.github/workflows/run_build_checks.yml new file mode 100644 index 0000000000..cc953cb4f1 --- /dev/null +++ b/.github/workflows/run_build_checks.yml @@ -0,0 +1,39 @@ +name: Run build checks + +on: + workflow_call: + +permissions: {} + +jobs: + run_build_checks: + name: Run build and package checks + runs-on: ubuntu-latest + steps: + - name: Check out repo + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + submodules: recursive + - name: Set up Python + uses: ni/python-actions/setup-python@aa64e60612cb078b0c2ada666becbd70d4817d55 # v0.7.1 + id: setup-python + with: + python-version: '3.12' + - name: Install tox + run: python -m pip install --upgrade tox + - name: Cache tox environments + uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2 + with: + path: .tox + key: nimi-python-build-checks-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('tox.ini') }} + - name: Build installers + run: tox -c tox.ini -e py312-installers + - name: Run build and package checks + run: tox -c tox.ini -e py312-build_test,py312-flake8,py312-docs,py312-pkg + - name: Upload codegen unit-test coverage + uses: codecov/codecov-action@v3 + with: + # See ../PUBLIC_CODECOV_TOKEN_README.md + token: 4c58f03d-b74c-489a-889a-ab0a77b7809f + flags: codegenunittests + files: ./codegen.xml diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml new file mode 100644 index 0000000000..d2deccf594 --- /dev/null +++ b/.github/workflows/run_unit_tests.yml @@ -0,0 +1,95 @@ +name: Run unit tests + +on: + workflow_call: + +permissions: {} + +jobs: + run_unit_tests: + name: Run unit tests (${{ matrix.os }}, Python ${{ matrix.python-version }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + python-version: '3.10' + tox-version: '310' + - os: ubuntu-latest + python-version: '3.11' + tox-version: '311' + - os: ubuntu-latest + python-version: '3.12' + tox-version: '312' + - os: ubuntu-latest + python-version: '3.13' + tox-version: '313' + - os: ubuntu-latest + python-version: '3.14' + tox-version: '314' + steps: + - name: Check out repo + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + submodules: recursive + - name: Set up Python + uses: ni/python-actions/setup-python@aa64e60612cb078b0c2ada666becbd70d4817d55 # v0.7.1 + id: setup-python + with: + python-version: ${{ matrix.python-version }} + - name: Install tox + run: python -m pip install --upgrade tox + - name: Cache tox environments + uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2 + with: + path: .tox + key: nimi-python-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('tox.ini') }} + - name: Build installers + run: tox -c tox.ini -e py${{ matrix.tox-version }}-installers + - name: Run unit tests + run: >- + mkdir -p test_results && tox -c tox.ini -e py${{ matrix.tox-version }}-test -- + --junitxml=test_results/unit-tests-${{ runner.os }}-py${{ matrix.python-version }}.xml + - name: Upload nifake unit-test coverage + uses: codecov/codecov-action@v3 + with: + token: 4c58f03d-b74c-489a-889a-ab0a77b7809f + flags: nifakeunittests + files: ./nifakeunittest.xml + - name: Upload nidcpower unit-test coverage + uses: codecov/codecov-action@v3 + with: + token: 4c58f03d-b74c-489a-889a-ab0a77b7809f + flags: nidcpowerunittests + files: ./nidcpowerunittest.xml + - name: Upload nidigital unit-test coverage + uses: codecov/codecov-action@v3 + with: + token: 4c58f03d-b74c-489a-889a-ab0a77b7809f + flags: nidigitalunittests + files: ./nidigitalunittest.xml + - name: Upload nimodinst unit-test coverage + uses: codecov/codecov-action@v3 + with: + token: 4c58f03d-b74c-489a-889a-ab0a77b7809f + flags: nimodinstunittests + files: ./nimodinstunittest.xml + - name: Upload niscope unit-test coverage + uses: codecov/codecov-action@v3 + with: + token: 4c58f03d-b74c-489a-889a-ab0a77b7809f + flags: niscopeunittests + files: ./niscopeunittest.xml + - name: Upload nitclk unit-test coverage + uses: codecov/codecov-action@v3 + with: + token: 4c58f03d-b74c-489a-889a-ab0a77b7809f + flags: nitclkunittests + files: ./nitclkunittest.xml + - name: Upload test results + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + with: + name: test_results_unit_${{ runner.os }}_py${{ matrix.python-version }} + path: test_results/*.xml + if: always() diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0586ba643e..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,50 +0,0 @@ -group: travis_latest -language: python -dist: focal -git: - submodules: false -matrix: - include: - # Historically, we've run tests on the latest supported version of Python first. - # For now, we're running Python 3.12 first, because it's the version currently used for codegen. - # This is where additional tests are run so we give it more time. - # When the version used for codegen changes, the version that runs first should change to match. - - python: "3.12" - - python: "3.10" - - python: "3.11" - - python: "3.13" - - python: "3.14" - -install: - - git submodule update --init --recursive --progress - - travis_retry sudo apt-get -y install python3-pip - - travis_retry pip install --upgrade pip - # tox 4.0 broke plugin compatibility - # TODO(ni-jfitzger): When tox-travis has a release compatible with tox>=4.0, remove the tox version specifier (Tracked on GitHub by #1876) - - travis_retry pip install --upgrade tox==3.* tox-travis - -before_script: - # Python 3.13 is only supported by grpcio-tools >= 1.67.0, a later version than what we use in the tox.ini - # Python 3.14 is only supported by grpcio-tools >= 1.75.1, a later version than what we use in the tox.ini - - if [[ "$TRAVIS_PYTHON_VERSION" != "3.13" && "$TRAVIS_PYTHON_VERSION" != "3.14" ]]; then python tools/ensure_codegen_up_to_date.py; fi - -script: - - tox -c tox-travis.ini - -after_success: - # Install and verify codecov tool - - travis_retry curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import - - travis_retry curl -Os https://uploader.codecov.io/latest/linux/codecov # download codecov tool - - travis_retry curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM - - travis_retry curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig - - travis_retry gpgv codecov.SHA256SUM.sig codecov.SHA256SUM - - travis_retry shasum -a 256 -c codecov.SHA256SUM - - travis_retry chmod +x codecov - # upload coverage - - travis_retry ./codecov --flags codegenunittests --file codegen.xml - - travis_retry ./codecov --flags nifakeunittests --file nifakeunittest.xml - - travis_retry ./codecov --flags nidcpowerunittests --file nidcpowerunittest.xml - - travis_retry ./codecov --flags nidigitalunittests --file nidigitalunittest.xml - - travis_retry ./codecov --flags nimodinstunittests --file nimodinstunittest.xml - - travis_retry ./codecov --flags niscopeunittests --file niscopeunittest.xml - - travis_retry ./codecov --flags nitclkunittests --file nitclkunittest.xml diff --git a/README.rst b/README.rst index fc3c1b87b5..5665a7d67f 100644 --- a/README.rst +++ b/README.rst @@ -12,9 +12,9 @@ Info NI Modular Instrument driver APIs for Python. Author NI =========== ============================================================================================================================ -.. |BuildStatus| image:: https://api.travis-ci.com/ni/nimi-python.svg +.. |BuildStatus| image:: https://github.com/ni/nimi-python/actions/workflows/CI.yml/badge.svg?branch=master :alt: Build Status - master branch - :target: https://travis-ci.org/ni/nimi-python + :target: https://github.com/ni/nimi-python/actions/workflows/CI.yml .. |MITLicense| image:: https://img.shields.io/badge/License-MIT-yellow.svg :alt: MIT License diff --git a/build/Makefile b/build/Makefile index 7306b2bb71..0ff8e645a0 100644 --- a/build/Makefile +++ b/build/Makefile @@ -69,7 +69,7 @@ installers: $(foreach d,$(ALL_DRIVERS), $(d)_installers) SUPPRESS_ERROR_OUTPUT ?= 2> /dev/null -# We need to ensure generated exists for Travis CI builds +# Keep the generated directory available for CI builds clean: start @echo 'Cleaning...' -$(_hide_cmds)rm -Rf $(GENERATED_DIR)/ $(SUPPRESS_ERROR_OUTPUT) ||: diff --git a/docs/_static/status_project.inc b/docs/_static/status_project.inc index 5f60d7c359..5beaf06946 100644 --- a/docs/_static/status_project.inc +++ b/docs/_static/status_project.inc @@ -12,9 +12,9 @@ Info NI Modular Instrument driver APIs for Python. Author NI =========== ============================================================================================================================ -.. |BuildStatus| image:: https://api.travis-ci.com/ni/nimi-python.svg +.. |BuildStatus| image:: https://github.com/ni/nimi-python/actions/workflows/CI.yml/badge.svg?branch=master :alt: Build Status - master branch - :target: https://travis-ci.org/ni/nimi-python + :target: https://github.com/ni/nimi-python/actions/workflows/CI.yml .. |MITLicense| image:: https://img.shields.io/badge/License-MIT-yellow.svg :alt: MIT License diff --git a/generated/nidcpower/README.rst b/generated/nidcpower/README.rst index 896ea83972..2ca8885321 100644 --- a/generated/nidcpower/README.rst +++ b/generated/nidcpower/README.rst @@ -12,9 +12,9 @@ Info NI Modular Instrument driver APIs for Python. Author NI =========== ============================================================================================================================ -.. |BuildStatus| image:: https://api.travis-ci.com/ni/nimi-python.svg +.. |BuildStatus| image:: https://github.com/ni/nimi-python/actions/workflows/CI.yml/badge.svg?branch=master :alt: Build Status - master branch - :target: https://travis-ci.org/ni/nimi-python + :target: https://github.com/ni/nimi-python/actions/workflows/CI.yml .. |MITLicense| image:: https://img.shields.io/badge/License-MIT-yellow.svg :alt: MIT License diff --git a/generated/nidigital/README.rst b/generated/nidigital/README.rst index 9ff6163efb..394fdf5fe5 100644 --- a/generated/nidigital/README.rst +++ b/generated/nidigital/README.rst @@ -12,9 +12,9 @@ Info NI Modular Instrument driver APIs for Python. Author NI =========== ============================================================================================================================ -.. |BuildStatus| image:: https://api.travis-ci.com/ni/nimi-python.svg +.. |BuildStatus| image:: https://github.com/ni/nimi-python/actions/workflows/CI.yml/badge.svg?branch=master :alt: Build Status - master branch - :target: https://travis-ci.org/ni/nimi-python + :target: https://github.com/ni/nimi-python/actions/workflows/CI.yml .. |MITLicense| image:: https://img.shields.io/badge/License-MIT-yellow.svg :alt: MIT License diff --git a/generated/nidmm/README.rst b/generated/nidmm/README.rst index cc8a612d0f..6c3f357535 100644 --- a/generated/nidmm/README.rst +++ b/generated/nidmm/README.rst @@ -12,9 +12,9 @@ Info NI Modular Instrument driver APIs for Python. Author NI =========== ============================================================================================================================ -.. |BuildStatus| image:: https://api.travis-ci.com/ni/nimi-python.svg +.. |BuildStatus| image:: https://github.com/ni/nimi-python/actions/workflows/CI.yml/badge.svg?branch=master :alt: Build Status - master branch - :target: https://travis-ci.org/ni/nimi-python + :target: https://github.com/ni/nimi-python/actions/workflows/CI.yml .. |MITLicense| image:: https://img.shields.io/badge/License-MIT-yellow.svg :alt: MIT License diff --git a/generated/nifgen/README.rst b/generated/nifgen/README.rst index 17c6fe1fb8..348ebb9485 100644 --- a/generated/nifgen/README.rst +++ b/generated/nifgen/README.rst @@ -12,9 +12,9 @@ Info NI Modular Instrument driver APIs for Python. Author NI =========== ============================================================================================================================ -.. |BuildStatus| image:: https://api.travis-ci.com/ni/nimi-python.svg +.. |BuildStatus| image:: https://github.com/ni/nimi-python/actions/workflows/CI.yml/badge.svg?branch=master :alt: Build Status - master branch - :target: https://travis-ci.org/ni/nimi-python + :target: https://github.com/ni/nimi-python/actions/workflows/CI.yml .. |MITLicense| image:: https://img.shields.io/badge/License-MIT-yellow.svg :alt: MIT License diff --git a/generated/nimodinst/README.rst b/generated/nimodinst/README.rst index ee0fdff0c3..62bfca4cfb 100644 --- a/generated/nimodinst/README.rst +++ b/generated/nimodinst/README.rst @@ -12,9 +12,9 @@ Info NI Modular Instrument driver APIs for Python. Author NI =========== ============================================================================================================================ -.. |BuildStatus| image:: https://api.travis-ci.com/ni/nimi-python.svg +.. |BuildStatus| image:: https://github.com/ni/nimi-python/actions/workflows/CI.yml/badge.svg?branch=master :alt: Build Status - master branch - :target: https://travis-ci.org/ni/nimi-python + :target: https://github.com/ni/nimi-python/actions/workflows/CI.yml .. |MITLicense| image:: https://img.shields.io/badge/License-MIT-yellow.svg :alt: MIT License diff --git a/generated/nirfsa/README.rst b/generated/nirfsa/README.rst index 454d1e22b5..07d4bf114e 100644 --- a/generated/nirfsa/README.rst +++ b/generated/nirfsa/README.rst @@ -12,9 +12,9 @@ Info NI Modular Instrument driver APIs for Python. Author NI =========== ============================================================================================================================ -.. |BuildStatus| image:: https://api.travis-ci.com/ni/nimi-python.svg +.. |BuildStatus| image:: https://github.com/ni/nimi-python/actions/workflows/CI.yml/badge.svg?branch=master :alt: Build Status - master branch - :target: https://travis-ci.org/ni/nimi-python + :target: https://github.com/ni/nimi-python/actions/workflows/CI.yml .. |MITLicense| image:: https://img.shields.io/badge/License-MIT-yellow.svg :alt: MIT License diff --git a/generated/nirfsg/README.rst b/generated/nirfsg/README.rst index 335c411203..65a725a11d 100644 --- a/generated/nirfsg/README.rst +++ b/generated/nirfsg/README.rst @@ -12,9 +12,9 @@ Info NI Modular Instrument driver APIs for Python. Author NI =========== ============================================================================================================================ -.. |BuildStatus| image:: https://api.travis-ci.com/ni/nimi-python.svg +.. |BuildStatus| image:: https://github.com/ni/nimi-python/actions/workflows/CI.yml/badge.svg?branch=master :alt: Build Status - master branch - :target: https://travis-ci.org/ni/nimi-python + :target: https://github.com/ni/nimi-python/actions/workflows/CI.yml .. |MITLicense| image:: https://img.shields.io/badge/License-MIT-yellow.svg :alt: MIT License diff --git a/generated/niscope/README.rst b/generated/niscope/README.rst index 4f23d6e16b..ee35cea500 100644 --- a/generated/niscope/README.rst +++ b/generated/niscope/README.rst @@ -12,9 +12,9 @@ Info NI Modular Instrument driver APIs for Python. Author NI =========== ============================================================================================================================ -.. |BuildStatus| image:: https://api.travis-ci.com/ni/nimi-python.svg +.. |BuildStatus| image:: https://github.com/ni/nimi-python/actions/workflows/CI.yml/badge.svg?branch=master :alt: Build Status - master branch - :target: https://travis-ci.org/ni/nimi-python + :target: https://github.com/ni/nimi-python/actions/workflows/CI.yml .. |MITLicense| image:: https://img.shields.io/badge/License-MIT-yellow.svg :alt: MIT License diff --git a/generated/nise/README.rst b/generated/nise/README.rst index 17276b87f7..29b1cd226e 100644 --- a/generated/nise/README.rst +++ b/generated/nise/README.rst @@ -12,9 +12,9 @@ Info NI Modular Instrument driver APIs for Python. Author NI =========== ============================================================================================================================ -.. |BuildStatus| image:: https://api.travis-ci.com/ni/nimi-python.svg +.. |BuildStatus| image:: https://github.com/ni/nimi-python/actions/workflows/CI.yml/badge.svg?branch=master :alt: Build Status - master branch - :target: https://travis-ci.org/ni/nimi-python + :target: https://github.com/ni/nimi-python/actions/workflows/CI.yml .. |MITLicense| image:: https://img.shields.io/badge/License-MIT-yellow.svg :alt: MIT License diff --git a/generated/niswitch/README.rst b/generated/niswitch/README.rst index ca2a3f0535..3d7e020f7d 100644 --- a/generated/niswitch/README.rst +++ b/generated/niswitch/README.rst @@ -12,9 +12,9 @@ Info NI Modular Instrument driver APIs for Python. Author NI =========== ============================================================================================================================ -.. |BuildStatus| image:: https://api.travis-ci.com/ni/nimi-python.svg +.. |BuildStatus| image:: https://github.com/ni/nimi-python/actions/workflows/CI.yml/badge.svg?branch=master :alt: Build Status - master branch - :target: https://travis-ci.org/ni/nimi-python + :target: https://github.com/ni/nimi-python/actions/workflows/CI.yml .. |MITLicense| image:: https://img.shields.io/badge/License-MIT-yellow.svg :alt: MIT License diff --git a/generated/nitclk/README.rst b/generated/nitclk/README.rst index 960de3b140..34cd71914f 100644 --- a/generated/nitclk/README.rst +++ b/generated/nitclk/README.rst @@ -12,9 +12,9 @@ Info NI Modular Instrument driver APIs for Python. Author NI =========== ============================================================================================================================ -.. |BuildStatus| image:: https://api.travis-ci.com/ni/nimi-python.svg +.. |BuildStatus| image:: https://github.com/ni/nimi-python/actions/workflows/CI.yml/badge.svg?branch=master :alt: Build Status - master branch - :target: https://travis-ci.org/ni/nimi-python + :target: https://github.com/ni/nimi-python/actions/workflows/CI.yml .. |MITLicense| image:: https://img.shields.io/badge/License-MIT-yellow.svg :alt: MIT License diff --git a/tox-travis.ini b/tox-travis.ini deleted file mode 100644 index c87f353af6..0000000000 --- a/tox-travis.ini +++ /dev/null @@ -1,207 +0,0 @@ -# Tox (http://tox.testrun.org/) is a tool for running tests -# in multiple virtualenvs. This configuration file will run the -# test suite on all supported python versions. To use it, "pip install tox" -# and then run "tox" from this directory. -[tox] -# tox.ini and tox-travis.ini are copies of the same content with different envlist commented out -# tox-travis.ini will have pyXX-clean and all pyXX-installers in the default envlist, while the developer tox.ini -# does not have clean and only has one pyXX-installers -# Historically we've used the latest Python for environments that we only list one Python for. For now, we're using Python 3.12 -# to avoid updating our pb2 files, which could possibly cause incompatibilities with other NI Python packages. -# When other NI Python packages bump the version that they use for generating pb2 files, we can bump this Python version to match. -# We may also bump it sooner, if we agree with team members who own other NI Python packages that it's okay to do so. -# At the latest, we'll bump it when we drop support for Python 3.12. -# Uncomment this line for tox.ini -# envlist = py312-build_test,py312-codegen,py312-installers,py{310,311,312,313,314}-test,py312-flake8,py312-docs,py312-pkg -# Uncomment this line for tox-travis.ini -envlist = py312-clean,py312-build_test,py312-codegen,py{310,311,312,313,314}-installers,py{310,311,312,313,314}-test,py312-flake8,py312-docs,py312-pkg -skip_missing_interpreters=True -ignore_basepython_conflict=True -skipsdist = true -toxworkdir = .tox/{env:BITNESS:64} - -[testenv] -description = - test: Run tests - build_test: Test the build scripts - clean: Clean code generated files - codegen: Run code generation step - installers: Build the installers (wheels and sdists) - flake8: Run static analysis - docs: Generate documentation - pkg: Verify the package - -changedir = - build_test: . - test: . - codegen: . - installers: . - clean: . - docs: docs - flake8: . - pkg: . - -commands = - build_test: python --version - build_test: python -c "import platform; print(platform.architecture())" - build_test: python -m pip install --disable-pip-version-check --upgrade pip - build_test: python -m pip list - # doctest validation of code docstrings - build_test: coverage run --rcfile=tools/coverage_unit_tests.rc --source build.helper -m pytest --pyargs build.helper - # actual unit tests - build_test: coverage run --append --rcfile=tools/coverage_unit_tests.rc --source build.helper -m pytest build/unit_tests {posargs} -s - # Display the report on console - build_test: coverage report - # Create the report to upload - build_test: coverage xml -o codegen.xml - # Save the report - build_test: coverage html --directory=generated/htmlcov/unit_tests/codegen - build_test: flake8 --config=./tox.ini --per-file-ignores=build/unit_tests/*.py:F403,F405 build/ - test: python --version - test: python -c "import platform; print(platform.architecture())" - test: python -m pip install --disable-pip-version-check --upgrade pip - test: python tools/install_local_wheel.py --driver nitclk - test: coverage run --rcfile=tools/coverage_unit_tests.rc --source nifake -m pytest generated/nifake/nifake {posargs} -s - test: coverage report - test: coverage xml -o nifakeunittest.xml - test: coverage html --directory=generated/htmlcov/unit_tests/nifake - test: coverage run --rcfile=tools/coverage_unit_tests.rc --source nidcpower -m pytest generated/nidcpower/nidcpower {posargs} -s - test: coverage report - test: coverage xml -o nidcpowerunittest.xml - test: coverage html --directory=generated/htmlcov/unit_tests/nidcpower - test: coverage run --rcfile=tools/coverage_unit_tests.rc --source nidigital -m pytest generated/nidigital/nidigital {posargs} -s - test: coverage report - test: coverage xml -o nidigitalunittest.xml - test: coverage html --directory=generated/htmlcov/unit_tests/nidigital - test: coverage run --rcfile=tools/coverage_unit_tests.rc --source nimodinst -m pytest generated/nimodinst/nimodinst {posargs} -s - test: coverage report - test: coverage xml -o nimodinstunittest.xml - test: coverage html --directory=generated/htmlcov/unit_tests/nimodinst - test: coverage run --rcfile=tools/coverage_unit_tests.rc --source niscope -m pytest generated/niscope/niscope {posargs} -s - test: coverage report - test: coverage xml -o niscopeunittest.xml - test: coverage html --directory=generated/htmlcov/unit_tests/niscope - test: coverage run --rcfile=tools/coverage_unit_tests.rc --source nirfsa -m pytest generated/nirfsa/nirfsa {posargs} -s - test: coverage report - test: coverage xml -o nirfsaunittest.xml - test: coverage html --directory=generated/htmlcov/unit_tests/nirfsa - test: coverage run --rcfile=tools/coverage_unit_tests.rc --source nitclk -m pytest generated/nitclk/nitclk {posargs} -s - test: coverage report - test: coverage xml -o nitclkunittest.xml - test: coverage html --directory=generated/htmlcov/unit_tests/nitclk - clean: python --version - clean: python -c "import platform; print(platform.architecture())" - clean: make clean {posargs} - codegen: python --version - codegen: python -c "import platform; print(platform.architecture())" - codegen: python -m pip install --disable-pip-version-check --upgrade pip - codegen: make {posargs} - installers: python --version - installers: python -c "import platform; print(platform.architecture())" - installers: python -m pip install --disable-pip-version-check --upgrade pip - installers: make installers {posargs} - flake8: python --version - flake8: python -c "import platform; print(platform.architecture())" - flake8: python -m pip install --disable-pip-version-check --upgrade pip - flake8: flake8 --config=./tox.ini generated/ - flake8: flake8 --config=./tox.ini tools/ - flake8: flake8 --config=./tox.ini src/nidcpower/system_tests/ src/nidcpower/examples/ - flake8: flake8 --config=./tox.ini src/nidigital/system_tests/ src/nidigital/examples/ - flake8: flake8 --config=./tox.ini src/nidmm/system_tests/ src/nidmm/examples/ - flake8: flake8 --config=./tox.ini src/nifgen/system_tests/ src/nifgen/examples/ - flake8: flake8 --config=./tox.ini src/nimodinst/system_tests/ src/nimodinst/examples/ - flake8: flake8 --config=./tox.ini src/nirfsa/system_tests/ src/nirfsa/examples/ - flake8: flake8 --config=./tox.ini src/nirfsg/system_tests/ src/nirfsg/examples/ - flake8: flake8 --config=./tox.ini src/niscope/system_tests/ src/niscope/examples/ - flake8: flake8 --config=./tox.ini src/nise/system_tests/ src/nise/examples/ - flake8: flake8 --config=./tox.ini src/niswitch/system_tests/ src/niswitch/examples/ - flake8: flake8 --config=./tox.ini src/nitclk/system_tests/ src/nitclk/examples/ - docs: python --version - docs: python -c "import platform; print(platform.architecture())" - docs: sphinx-build -b html -d {envtmpdir}/doctrees ./nidcpower ../generated/docs/nidcpower/html {posargs} - docs: sphinx-build -b html -d {envtmpdir}/doctrees ./nidigital ../generated/docs/nidigital/html {posargs} - docs: sphinx-build -b html -d {envtmpdir}/doctrees ./nidmm ../generated/docs/nidmm/html {posargs} - docs: sphinx-build -b html -d {envtmpdir}/doctrees ./nifgen ../generated/docs/nifgen/html {posargs} - docs: sphinx-build -b html -d {envtmpdir}/doctrees ./nimodinst ../generated/docs/nimodinst/html {posargs} - docs: sphinx-build -b html -d {envtmpdir}/doctrees ./nirfsa ../generated/docs/nirfsa/html {posargs} - docs: sphinx-build -b html -d {envtmpdir}/doctrees ./nirfsg ../generated/docs/nirfsg/html {posargs} - docs: sphinx-build -b html -d {envtmpdir}/doctrees ./niscope ../generated/docs/niscope/html {posargs} - docs: sphinx-build -b html -d {envtmpdir}/doctrees ./nise ../generated/docs/nise/html {posargs} - docs: sphinx-build -b html -d {envtmpdir}/doctrees ./niswitch ../generated/docs/niswitch/html {posargs} - docs: sphinx-build -b html -d {envtmpdir}/doctrees ./nitclk ../generated/docs/nitclk/html {posargs} - pkg: python --version - pkg: python -c "import platform; print(platform.architecture())" - pkg: python -m twine --version - pkg: python -m twine check generated/nifake/dist/* - pkg: python -m twine check generated/nidcpower/dist/* - pkg: python -m twine check generated/nidigital/dist/* - pkg: python -m twine check generated/nidmm/dist/* - pkg: python -m twine check generated/nifgen/dist/* - pkg: python -m twine check generated/nirfsa/dist/* - pkg: python -m twine check generated/nirfsg/dist/* - pkg: python -m twine check generated/niscope/dist/* - pkg: python -m twine check generated/nise/dist/* - pkg: python -m twine check generated/niswitch/dist/* - # pkg: check-manifest --ignore tox.ini,tests*,.github,.github/*,CONTRIBUTING.rst,docs,docs/* - -deps = - test: pytest - test: pytest-timeout - test: coverage - test: mako - test: numpy - test: hightime - test: grpcio == 1.75.1 # Compatible with Python 3.14; should be backwards compatible with grpcio-tools 1.59.0 - test: protobuf == 5.27.2 # Compatible with Python 3.14; should be backwards compatible with grpcio-tools 1.59.0 - test: ni.grpcdevice.v1.proto >= 1.0.0 # Provides session_pb2 package at runtime since we no longer generate it per-driver - build_test: pytest - build_test: coverage - build_test: mako - build_test: hacking - build_test: pep8-naming - codegen: mako - codegen: packaging - codegen: setuptools < 82 # grpcio-tools 1.59.0 needs pkg_resources which was removed in setuptools v82 - codegen: grpcio-tools == 1.59.0 # First version to support Python 3.12 - installers: build - flake8: hacking - flake8: pep8-naming - docs: sphinx - docs: sphinx-rtd-theme - pkg: check-manifest - pkg: docutils - pkg: pygments - pkg: twine - -depends = - codegen: py312-clean - installers: py312-codegen - flake8: py312-codegen - docs: py312-codegen - test: py312-installers - pkg: py312-installers - -allowlist_externals = - build_test: mv - test: mv - codegen: make - installers: make - clean: make - -[flake8] -show_source = true -# We recommend setting your editor's visual guide to 79 but allow overflow to -# 160 for readability in certain cases due to generated code -# max_line_length = 160 -exclude = build,docs,.tox,__pycache__,processed_metadata,.eggs,*_pb2*.py,third_party -# H903: Windows style line endings not allowed in code -# E501: Line length -# W391: Blank line at end of file -ignore = H903,E501,W391 - -[pytest] -addopts = --verbose --doctest-modules --ignore=setup.py -norecursedirs = system_tests examples .* build dist CVS _darcs {arch} *.egg venv -junit_suite_name = nimi-python -python_files = *.py -junit_family = xunit1 \ No newline at end of file diff --git a/tox.ini b/tox.ini index bc62eac58c..41333b29e9 100644 --- a/tox.ini +++ b/tox.ini @@ -3,18 +3,14 @@ # test suite on all supported python versions. To use it, "pip install tox" # and then run "tox" from this directory. [tox] -# tox.ini and tox-travis.ini are copies of the same content with different envlist commented out -# tox-travis.ini will have pyXX-clean and all pyXX-installers in the default envlist, while the developer tox.ini -# does not have clean and only has one pyXX-installers +# This configuration is used by both developers and GitHub Actions. +# The GitHub Actions workflow selects the test environment for each Python version. # Historically we've used the latest Python for environments that we only list one Python for. For now, we're using Python 3.12 # to avoid updating our pb2 files, which could possibly cause incompatibilities with other NI Python packages. # When other NI Python packages bump the version that they use for generating pb2 files, we can bump this Python version to match. # We may also bump it sooner, if we agree with team members who own other NI Python packages that it's okay to do so. # At the latest, we'll bump it when we drop support for Python 3.12. -# Uncomment this line for tox.ini envlist = py312-build_test,py312-codegen,py312-installers,py{310,311,312,313,314}-test,py312-flake8,py312-docs,py312-pkg -# Uncomment this line for tox-travis.ini -# envlist = py312-clean,py312-build_test,py312-codegen,py{310,311,312,313,314}-installers,py{310,311,312,313,314}-test,py312-flake8,py312-docs,py312-pkg skip_missing_interpreters=True ignore_basepython_conflict=True skipsdist = true