ci #208
Workflow file for this run
This file contains hidden or 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: 'Test & Release' | |
| on: [ push, pull_request ] | |
| concurrency: | |
| group: ${{ github.workflow_sha }} | |
| cancel-in-progress: true | |
| 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: | |
| os: [ ubuntu-latest, win-pcap ] | |
| python: [ '3.10', '3.11' ] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - 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 | |
| ip link show | |
| - name: Configure environment -- Windows | |
| if: ${{ runner.os == 'Windows' }} | |
| run: | | |
| # Collect diagnostics | |
| systeminfo | |
| route print | |
| ipconfig /all | |
| - name: Configure environment | |
| run: | | |
| python --version | |
| python -m pip install --upgrade pip setuptools nox | |
| - name: Run Nox | |
| run: | | |
| nox --non-interactive --error-on-missing-interpreters --session test pristine --python ${{ matrix.python }} | |
| nox --non-interactive --no-error-on-missing-interpreters --session demo check_style docs | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| FORCE_COLOR: 1 | |
| - name: Save logs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: PyCyphal-${{ matrix.os }}-python-${{ matrix.python }} | |
| path: .nox/*/*/*.log | |
| retention-days: 7 | |
| 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 | |
| - 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.2 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| custom_tag: ${{ env.pycyphal_version }} | |
| tag_prefix: '' |