Skip to content

Commit

Permalink
Added GH Actions workflow to replaced AppVeyor script (#98)
Browse files Browse the repository at this point in the history
This PR addresses issue #87 to move the AppVeyor script to GH Actions.

Co-authored-by: Pavel Kirienko <pavel.kirienko@gmail.com>
  • Loading branch information
clyde-johnston and pavel-kirienko committed Aug 19, 2023
1 parent f564e42 commit 6a6828b
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 101 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: 'Test and Release PyDSDL'
on: push

# 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
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
python: [ '3.7', '3.8', '3.9', '3.10', '3.11' ]
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@v3

- name: Check out public_regulated_data_types
uses: actions/checkout@v3
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 test_eol 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 test_eol pristine lint
elif [ "$RUNNER_OS" == "macOS" ]; then
nox --non-interactive --error-on-missing-interpreters --session test test_eol pristine lint --python ${{ matrix.python }}
else
echo "${{ runner.os }} not supported"
exit 1
fi
python -c "import pydsdl; pydsdl.read_namespace('.dsdl-test/uavcan', [])"
shell: bash

pydsdl-release:
name: Release PyDSDL
if: 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@v3

- 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/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ env.pydsdl_version }}
tag_prefix: ''
98 changes: 0 additions & 98 deletions appveyor.yml

This file was deleted.

2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test(session):
session.log(f"OPEN IN WEB BROWSER: file://{report_file}")


@nox.session(python=["3.6", "3.7"])
@nox.session(python=["3.7"])
def test_eol(session):
"""This is a minimal test session for those old Pythons that have EOLed."""
session.install("-e", ".")
Expand Down
2 changes: 1 addition & 1 deletion pydsdl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys as _sys
from pathlib import Path as _Path

__version__ = "1.20.0"
__version__ = "1.20.1"
__version_info__ = tuple(map(int, __version__.split(".")[:3]))
__license__ = "MIT"
__author__ = "OpenCyphal"
Expand Down
2 changes: 1 addition & 1 deletion pydsdl/_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def _unittest_common_usage_errors() -> None:
_ensure_no_common_usage_errors(dir_dsdl, [di / "baz"], reports.append)
(rep,) = reports
reports.clear()
assert str(dir_dsdl_uavcan).lower() in rep.lower()
assert str(dir_dsdl_uavcan.resolve()).lower() in rep.lower()


def _unittest_nested_roots() -> None:
Expand Down

0 comments on commit 6a6828b

Please sign in to comment.