Skip to content

Fix CAN FD bitrate switching #491

Fix CAN FD bitrate switching

Fix CAN FD bitrate switching #491

name: 'Test & Release'
on: [ push, pull_request ]
jobs:
test:
name: Test PyCyphal
# Run on push OR on 3rd-party PR.
# https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=edited#pull_request
if: (github.event_name == 'push') || github.event.pull_request.head.repo.fork
strategy:
fail-fast: false
matrix:
# We text the full matrix on GNU/Linux
os: [ ubuntu-latest ]
py: [ '3.10', '3.11', '3.12', '3.13' ]
# On Windows, we select the configurations we test manually because we only have a few runners,
# and because the infrastructure is hard to maintain using limited resources.
include:
- { os: win-pcap, py: '3.10' }
- { os: win-pcap, py: '3.12' }
runs-on: ${{ matrix.os }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
FORCE_COLOR: 1
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
- name: Configure environment -- GNU/Linux
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get --ignore-missing update || true
sudo apt-get install -y linux-*-extra-$(uname -r) graphviz ncat
# Configure socketcand
sudo apt-get install -y meson libconfig-dev libsocketcan-dev
git clone https://github.com/linux-can/socketcand.git
cd socketcand
meson setup -Dlibconfig=true --buildtype=release build
meson compile -C build
sudo meson install -C build
# Collect diagnostics
python --version
ip link show
- name: Configure environment -- Windows
if: ${{ runner.os == 'Windows' }}
run: |
# Collect diagnostics
python --version
systeminfo
route print
ipconfig /all
# Only one statement per step to ensure the error codes are not ignored by PowerShell.
- run: python -m pip install --upgrade pip setuptools nox
- run: nox --non-interactive --error-on-missing-interpreters --session test pristine --python ${{ matrix.py }}
- run: nox --non-interactive --no-error-on-missing-interpreters --session demo check_style docs
- uses: actions/upload-artifact@v4
with:
name: "${{matrix.os}}_py${{matrix.py}}"
path: ".nox/**/*.log"
include-hidden-files: true
release:
name: Release PyCyphal
runs-on: ubuntu-latest
if: >
(github.event_name == 'push') &&
(contains(github.event.head_commit.message, '#release') || contains(github.ref, '/master'))
needs: test
steps:
- name: Check out
uses: actions/checkout@v4
with:
submodules: recursive
- name: Create distribution wheel
run: |
python -m pip install --upgrade pip packaging 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.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ env.pycyphal_version }}
tag_prefix: ''