Skip to content

Adding support for file-based reads and externalized type dependencies #10

Adding support for file-based reads and externalized type dependencies

Adding support for file-based reads and externalized type dependencies #10

name: 'Test and Release PyDSDL'
on: [ push, pull_request ]
# Ensures that only one workflow is running at a time
concurrency:
group: ${{ github.workflow_sha }}
cancel-in-progress: true
jobs:
pydsdl-test:
name: Test PyDSDL
# 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, macos-latest ]
python: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
include:
- os: windows-2019
python: '3.10'
- os: macos-latest
python: '3.9'
runs-on: ${{ matrix.os }}
steps:
- name: Check out pydsdl
uses: actions/checkout@v4
- name: Check out public_regulated_data_types
uses: actions/checkout@v4
with:
repository: OpenCyphal/public_regulated_data_types
path: .dsdl-test
- 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
fi
python -m pip install --upgrade pip setuptools nox typed_ast
shell: bash
- name: Run build and test
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
nox --non-interactive --error-on-missing-interpreters --session test pristine lint --python ${{ matrix.python }}
nox --non-interactive --session docs
elif [ "$RUNNER_OS" == "Windows" ]; then
nox --forcecolor --non-interactive --error-on-missing-interpreters --session test pristine lint
elif [ "$RUNNER_OS" == "macOS" ]; then
nox --non-interactive --error-on-missing-interpreters --session test pristine lint --python ${{ matrix.python }}
else
echo "${{ runner.os }} not supported"
exit 1
fi
shell: bash
pydsdl-release:
name: Release PyDSDL
if: >
(github.event_name == 'push') &&
(contains(github.event.head_commit.message, '#release') || contains(github.ref, '/master'))
needs: pydsdl-test
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
- name: Build distribution
run: |
python -m pip install --upgrade pip setuptools wheel twine
python setup.py sdist bdist_wheel
- name: Get release version
run: echo "pydsdl_version=$(python3 -c 'import pydsdl; print(pydsdl.__version__)')" >> $GITHUB_ENV
- name: Upload distribution
run: |
python -m twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_PYDSDL }}
- name: Push version tag
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ env.pydsdl_version }}
tag_prefix: ''