Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to 0.0.2 #113

Merged
merged 3 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Run Tests

on:
push:
tags:
- 'v*'

jobs:
formatting:
name: Check Formatting
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install
run: pip install ruff
- name: Run Ruff
run: ruff check .

tests:
name: Run Unit Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [self-hosted]
python-version: [3.8]
steps:
- name: Check if PR is from owner's repository
id: check-owner
run: |
if [[ "${{ github.actor }}" == "owner_username" ]]; then
echo "::set-output name=is_owner::true"
else
echo "::set-output name=is_owner::false"
fi
- uses: actions/checkout@v3
- name: Set up Python for Self-Hosted Linux arm64
uses: iory/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Check Python Version
run: python --version
- name: Install Pytest
run: |
python -m pip install --upgrade pip setuptools wheel
pip install pytest hacking pytest-cov
- name: Install python package
run: pip install .
- name: Run Pytest
run: |
set -o pipefail
coverage erase
coverage run -m pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered tests
coverage xml
- name: Step for Owner's PR Only
if: steps.check-owner.outputs.is_owner == 'true'
run: |
echo "This step runs only for PRs from the owner's PR"
- name: Pytest coverage comment
if: steps.check-owner.outputs.is_owner == 'true'
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-xml-coverage-path: ./coverage.xml
junitxml-path: ./pytest.xml

pypi:
name: Release To PyPi
needs: [formatting, tests]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install publishing dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel build
- name: Build
run: |
python -m build
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_TOKEN }}
21 changes: 20 additions & 1 deletion rcb4/apps/write_firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,33 @@ def flash_bin_to_device(st_flash_path, bin_path):


def main():
print("Checking dependencies...")
check_dependencies()
print("Dependencies are satisfied.")

print("Locating ST-Link path...")
st_flash_path = stlink()
elf_path = kondoh7_elf()
if not st_flash_path:
print("Error: ST-Link path not found. Please check your installation of stlink.")
sys.exit(4)
print(f"ST-Link path found: {st_flash_path}")

print("Retrieving latest ELF file...")
elf_path = kondoh7_elf('latest')
if not elf_path or not Path(elf_path).is_file():
print("Error: ELF file not found. Please check the path or filename.")
sys.exit(5)
print(f"ELF file found: {elf_path}")

bin_path = Path(elf_path).with_suffix(".bin")
print(f"Converting ELF to BIN: {bin_path}")

convert_elf_to_bin(elf_path, bin_path)
print("ELF successfully converted to BIN.")

print("Flashing BIN to device...")
flash_bin_to_device(st_flash_path, bin_path)
print("BIN successfully flashed to device.")


if __name__ == "__main__":
Expand Down
9 changes: 8 additions & 1 deletion rcb4/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,18 @@
}


def get_latest_version(elf_infos):
latest_version = sorted(elf_infos.keys())[-1]
return latest_version, elf_infos[latest_version]


def get_cache_dir():
return os.environ.get("RCB4_CACHE_DIR", _default_cache_dir)


def kondoh7_elf(version="v0.6.2"):
def kondoh7_elf(version="latest"):
if version == 'latest':
version, _ = get_latest_version(elf_infos)
if version not in elf_infos:
raise RuntimeError(
f"Invalid armh7 version. Valid versions are {list(elf_infos.keys())}"
Expand Down
2 changes: 1 addition & 1 deletion ros/kxr_controller/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="2">
<name>kxr_controller</name>
<version>0.0.1</version>
<version>0.0.2</version>
<description>The kxr_controller package</description>

<maintainer email="[email protected]">Iori Yanokura</maintainer>
Expand Down
2 changes: 1 addition & 1 deletion ros/kxr_models/package.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<package format="2">
<name>kxr_models</name>
<version>1.0.0</version>
<version>0.0.2</version>
<description>
<p>URDF Description package for kxr_models</p>
<p>This package contains configuration data, 3D models and launch files for kxr robot</p>
Expand Down
2 changes: 1 addition & 1 deletion ros/kxreus/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<package format="3">

<name>kxreus</name>
<version>0.0.1</version>
<version>0.0.2</version>
<description>
roseus interface for kxr robots.
</description>
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from setuptools import find_packages
from setuptools import setup

version = "0.0.1"
version = "0.0.2"


if sys.argv[-1] == "release":
Expand Down
Loading