diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 37b99367f..000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,114 +0,0 @@ -environment: - matrix: - - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - PYTHON: 'C:\Python310-x64' # YAML treats '\\' and "\\" differently. - - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - PYTHON: '3.10' - - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - PYTHON: '3.9' - - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - PYTHON: '3.8' - - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - PYTHON: '3.7' - - - job_name: deploy - job_depends_on: tests - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - PYTHON: '3.10' - - GIT_TOKEN: - secure: +jQhxLpePj6hdDryfET/XpLo7VL9fhDXVHlwLOPp/nRDYe97TJAfd0XCTuPz1qkT - TWINE_USERNAME: __token__ - TWINE_PASSWORD: - secure: +ZVhECKV0ESBrvUGXVd9wnMU9JR2gXSrDCIE1G7ZrW1DuWWzPDmIVMh4LtZafGQEddc0yR7X5q947f+nmPNLg/XSMwd4CKM8xRN+47RgaIpUMD5QIJzIxgk678w+hb4ZmS9J8aAodu0kMn7cz53iFeliGCYwGY37D/JRTs9i6P8Q+xf06KFHiNcLLqoqMLlLcWrLx7hBPlFwVpv2NiEtSmNSM/Z6iizcbYh08wcUK0w= - SONARCLOUD_TOKEN: - secure: WhIOqdzyx8VkpAsNjwy4O+OiAQ4FzUu8d1sFcQ7xz8DlFABiNajhPv0lhc1Dpz7G - COVERALLS_REPO_TOKEN: - secure: m5OF/cgvFDa+BwWDJVJ/xcMoqkQoyNIhWU1+Ckc8Vr0r6L/V3S8FUTO7fFgMeLQC - -stack: python %PYTHON% -build: off -skip_tags: true - -for: - - # WINDOWS TEST - matrix: - only: - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - install: - - 'systeminfo' - # Configure Npcap. This is for testing the packet capture functionality in the Cyphal/UDP transport. - - '.test_deps\npcap-0.96.exe /loopback_support=yes /winpcap_mode=yes /S' - # Installation of the NDIS filter driver from Npcap may have disrupted network connectivity, as explained in - # https://github.com/nmap/npcap/issues/215. Also, a restart appears to be necessary to enable the NPF service. - # Therefore, we restart the VM as suggested in https://github.com/appveyor/ci/issues/3491. - - 'shutdown /r /f /t 5' - - 'timeout 30' # Boot-up delay. This should be sufficient for the VM to get ready. Increase if not. - - 'route print & ipconfig /all' - # Due to the reboot, all volatile configuration like environment variables is lost here. We need to set it up now. - - 'set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%' - - 'echo %PATH%' - - 'git submodule update --init --recursive' - - 'python -m pip install --upgrade pip setuptools nox' - test_script: - # FIXME on Windows we only test against the OLDEST and the NEWEST version of Python because we run out of time. - # FIXME restructure the workflow or migrate to GitHub Actions. - - 'nox --forcecolor --non-interactive --error-on-missing-interpreters --pythons 3.7 3.10 --session test pristine' - - - # GNU/LINUX TEST - matrix: - only: - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - install: - - 'export extras_pkg="linux-*-extra-$(uname -r)"' - # Graphviz is needed for the docs, ncat is needed for testing the Cyphal/serial transport. - - 'sudo apt-get install -y $extras_pkg graphviz ncat' - - 'git submodule update --init --recursive' - - 'python -m pip install --upgrade pip setuptools nox' - # Sonar scanner unconditionally fails on PR builds with a NullPointerException, so don't run it there. - - '[[ -z "$APPVEYOR_PULL_REQUEST_HEAD_COMMIT" ]] || unset SONARCLOUD_TOKEN' - test_script: - - 'nox --non-interactive --error-on-missing-interpreters --session test pristine --python $PYTHON' - - 'nox --non-interactive --session demo check_style docs' - on_finish: - - 'ip link show' # Diagnostics aid - - - # DEPLOYMENT - matrix: - only: - - job_name: deploy - branches: - only: - - master - install: - - git submodule update --init --recursive - - python -m pip install --upgrade pip setuptools wheel twine - deploy_script: - # Ensure we deploy only from master, not from PR builds. - - '[[ "$APPVEYOR_REPO_BRANCH" == "master" ]] && [[ -z "$APPVEYOR_PULL_REQUEST_HEAD_COMMIT" ]] || exit' - # Configure git credentials. - - echo "https://${GIT_TOKEN}:x-oauth-basic@github.com" > ~/.git-credentials - - git config --global credential.helper store - - git config --global user.email "hedgehoginthefog@opencyphal.org" - - git config --global user.name "Release Automation" - # Tag and publish this release. Push the tag after the release is out in case it could not be published. - - | - git tag "$(PYTHONPATH=pycyphal python -c 'from _version import __version__; print(__version__)')" - python setup.py sdist bdist_wheel - python -m twine upload dist/* - git push --tags - -artifacts: - - path: '.nox/*/*/*.log' diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml new file mode 100644 index 000000000..2b30e38e6 --- /dev/null +++ b/.github/workflows/test-and-release.yml @@ -0,0 +1,100 @@ +name: 'Test and Release PyCyphal' +on: push + +# Ensures that only one workflow is running at a time +concurrency: + group: ${{ github.workflow_sha }} + cancel-in-progress: true + +jobs: + pycyphal-test: + name: Test PyCyphal + strategy: + fail-fast: false + matrix: + os: [ ubuntu-20.04, windows-2019-npcap ] + python: [ '3.7', '3.8', '3.9', '3.10' ] + runs-on: ${{ matrix.os }} + steps: + - name: Check out + uses: actions/checkout@v3 + + - name: Install Python3 + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: Log Python version + run: python --version + + - name: Install dependencies + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + sudo apt-get --ignore-missing update || true + sudo apt-get install -y linux-*-extra-$(uname -r) graphviz ncat + fi + git submodule update --init --recursive + python -m pip install --upgrade pip setuptools nox + shell: bash + + - name: Collect Linux diagnostic data + if: ${{ runner.os == 'Linux' }} + run: ip link show + + - name: Collect Windows diagnostic data + if: ${{ runner.os == 'Windows' }} + run: | + systeminfo + route print + ipconfig /all + + - name: Run build and test + run: | + nox --non-interactive --error-on-missing-interpreters --session test pristine --python ${{ matrix.python }} + nox --non-interactive --session demo check_style docs + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + shell: bash + + - name: Save logs + uses: actions/upload-artifact@v3 + with: + name: PyCyphal-${{ matrix.os }}-python-${{ matrix.python }} + path: .nox/*/*/*.log + retention-days: 7 + + pycyphal-release: + name: Release PyCyphal + runs-on: ubuntu-latest + if: contains(github.event.head_commit.message, '#release') || contains(github.ref, '/master') + needs: pycyphal-test + steps: + - name: Check out + uses: actions/checkout@v3 + + - name: Create distribution wheel + run: | + git submodule update --init --recursive + python -m pip install --upgrade pip setuptools wheel twine + python setup.py sdist bdist_wheel + + - name: Get release version + run: | + cd pycyphal + echo "pycyphal_version=$(python -c 'from _version import __version__; print(__version__)')" >> $GITHUB_ENV + + - name: Upload distribution + run: | + python -m twine upload dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_PYCYPHAL }} + + - name: Push version tag + uses: mathieudutour/github-tag-action@v6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + custom_tag: ${{ env.pycyphal_version }} + tag_prefix: '' + diff --git a/noxfile.py b/noxfile.py index 6c8dd8883..883a97bc9 100644 --- a/noxfile.py +++ b/noxfile.py @@ -133,14 +133,14 @@ def test(session): session.run("pylint", *map(str, src_dirs), env={"PYTHONPATH": str(compiled_dir)}) # Publish coverage statistics. This also has to be run from the test session to access the coverage files. - if sys.platform.startswith("linux") and is_latest_python(session) and session.env.get("COVERALLS_REPO_TOKEN"): + if sys.platform.startswith("linux") and is_latest_python(session) and session.env.get("GITHUB_TOKEN"): session.install("coveralls") session.run("coveralls") else: session.log("Coveralls skipped") # Submit analysis to SonarCloud. This also has to be run from the test session to access the coverage files. - sonarcloud_token = session.env.get("SONARCLOUD_TOKEN") + sonarcloud_token = session.env.get("SONAR_TOKEN") if sys.platform.startswith("linux") and is_latest_python(session) and sonarcloud_token: session.run("coverage", "xml", "-i", "-o", str(ROOT_DIR / ".coverage.xml")) diff --git a/pycyphal/_version.py b/pycyphal/_version.py index ed6661eef..be5724a8f 100644 --- a/pycyphal/_version.py +++ b/pycyphal/_version.py @@ -1 +1 @@ -__version__ = "1.15.2" +__version__ = "1.15.3" diff --git a/setup.cfg b/setup.cfg index 828573602..0e616160e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -243,4 +243,4 @@ overgeneral-exceptions=BaseException [doc8] ignore-path = docs/api,./.nox,./pycyphal.egg-info max-line-length = 120 -ignore = D000 +ignore = D000,D002,D004