diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml new file mode 100644 index 0000000..9efebdd --- /dev/null +++ b/.github/workflows/test-and-release.yml @@ -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: '' diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index d265d63..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,98 +0,0 @@ -# https://www.appveyor.com/blog/2018/04/25/specialized-build-matrix-configuration-in-appveyor/ -# https://www.appveyor.com/docs/job-workflows/ -# https://www.appveyor.com/docs/how-to/git-push/ -environment: - matrix: - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - PYTHON: "C:\\Python310-x64" - - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: macos - PYTHON: "3.9" - - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - PYTHON: "3.11" - - - 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_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - PYTHON: "3.6" - - - 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: +ZVhECKV0ESBrvUGXVd9wpt9xhMMHeIXSJalghKMKGCrxqvvg7/yMm9kPO+xH1T310zzMpnDUxknR1Q05mjAX5MU70MiHiWAB2fBjNwrMSTQZP4kCpKtznAIM/iCwVczbNolbB3tsUn4OS3rQjXyz7lUdYnaeM7sqF1IZNj55/spCPsAJUmi5DYj8M+6zkaPdCZEswlH7lARJG1g+l4/tbyiBssuyDdmY0AQxJVXDGBXKeHU8frHrWayEI5holjF+oFwx2b6Fz1zZ7uznrGpDQ== - -stack: python %PYTHON% -build: off -skip_tags: true - -for: - # TEST PIPELINE - - matrix: - only: - - job_group: tests - install: - # MS Windows config. - - cmd: 'SET PATH=%PYTHON%;%PATH%' - - cmd: 'SET PATH=%PYTHON%\\Scripts;%PATH%' - - cmd: 'echo %PATH%' - # Shared config. - - python -m pip install --upgrade pip setuptools nox typed_ast - - python --version - test_script: - # GNU/Linux test. - - sh: nox --non-interactive --error-on-missing-interpreters --session test test_eol pristine lint --python $PYTHON - # skip macOS docs build - - sh: 'if [ "$APPVEYOR_BUILD_WORKER_IMAGE" != "macos" ]; then nox --non-interactive --session docs; fi' - # MS Windows test. - - cmd: nox --forcecolor --non-interactive --error-on-missing-interpreters --session test test_eol pristine lint - # Shared test for all platforms. - - git clone https://github.com/OpenCyphal/public_regulated_data_types .dsdl-test - - python -c "import pydsdl; pydsdl.read_namespace('.dsdl-test/uavcan', [])" - - # DEPLOYMENT PIPELINE - - matrix: - only: - - job_name: deploy - branches: - only: - - master - install: - - 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 "devnull@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 $(python3 -c "import pydsdl; print(pydsdl.__version__)")' - - 'python setup.py sdist bdist_wheel' - - 'python -m twine upload dist/*' - - 'git push --tags' diff --git a/noxfile.py b/noxfile.py index 04ab3d5..6939d8e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -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", ".") diff --git a/pydsdl/__init__.py b/pydsdl/__init__.py index 5662cf1..d07f1f2 100644 --- a/pydsdl/__init__.py +++ b/pydsdl/__init__.py @@ -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" diff --git a/pydsdl/_namespace.py b/pydsdl/_namespace.py index 82bb84e..8e9501e 100644 --- a/pydsdl/_namespace.py +++ b/pydsdl/_namespace.py @@ -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: