| @@ -78,65 +78,11 @@ jobs: | |||||
| - name: Run Linting and Tests | - name: Run Linting and Tests | ||||
| ## Run Linting and testing only on Mac for release workflows. | ## Run Linting and testing only on Mac for release workflows. | ||||
| if: runner.os == 'Linux' || github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/')) | if: runner.os == 'Linux' || github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/')) | ||||
| run: | | |||||
| chmod +x ../../.github/workflows/node_hub_test.sh | |||||
| ../../.github/workflows/node_hub_test.sh | |||||
| - name: Publish Projects | |||||
| if: github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/')) | |||||
| env: | env: | ||||
| GITHUB_EVENT_NAME: ${{ github.event_name }} | |||||
| MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_PASS }} | MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_PASS }} | ||||
| UV_PUBLISH_TOKEN: ${{ secrets.PYPI_PASS }} | UV_PUBLISH_TOKEN: ${{ secrets.PYPI_PASS }} | ||||
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||||
| run: | | run: | | ||||
| dir=$(pwd) | |||||
| base_dir=$(basename "$dir") | |||||
| ignored_folders=("dora-parler") | |||||
| if [[ " ${ignored_folders[@]} " =~ " ${base_dir} " ]]; then | |||||
| echo "Skipping $base_dir as there is a hf model fetching issue..." | |||||
| else | |||||
| if [[ -f "Cargo.toml" && -f "pyproject.toml" ]]; then | |||||
| echo "Publishing $dir using maturin..." | |||||
| if [[ "${{ runner.os }}" == "Linux" ]]; then | |||||
| pip install "maturin[zig]" | |||||
| ## The CI/CD is sequential to limit the number of workers used. | |||||
| # x86_64-unknown-linux-gnu | |||||
| maturin publish --skip-existing --zig | |||||
| # aarch64-unknown-linux-gnu | |||||
| rustup target add aarch64-unknown-linux-gnu | |||||
| maturin publish --target aarch64-unknown-linux-gnu --zig --skip-existing | |||||
| # armv7-unknown-linux-musleabihf | |||||
| rustup target add armv7-unknown-linux-musleabihf | |||||
| maturin publish --target armv7-unknown-linux-musleabihf --zig --skip-existing | |||||
| else | |||||
| pip install maturin | |||||
| maturin publish --skip-existing | |||||
| fi | |||||
| else | |||||
| if [[ "${{ runner.os }}" == "Linux" ]]; then | |||||
| if [ -f "pyproject.toml" ]; then | |||||
| echo "Publishing $dir using UV..." | |||||
| uv build | |||||
| uv publish --check-url https://pypi.org/simple | |||||
| fi | |||||
| if [ -f "Cargo.toml" ]; then | |||||
| echo "Publishing $dir using Cargo..." | |||||
| package_name=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].name') | |||||
| version=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].version') | |||||
| if cargo search "$package_name" | grep -q "^$package_name = \"$version\""; then | |||||
| echo "Package '$package_name' version '$version' already exists on crates.io. Skipping publish." | |||||
| else | |||||
| echo "Publishing package '$package_name' version '$version'..." | |||||
| cargo publish | |||||
| fi | |||||
| fi | |||||
| fi | |||||
| fi | |||||
| fi | |||||
| chmod +x ../../.github/workflows/node_hub_test.sh | |||||
| ../../.github/workflows/node_hub_test.sh | |||||
| @@ -2,7 +2,10 @@ | |||||
| set -euo | set -euo | ||||
| # List of ignored modules | # List of ignored modules | ||||
| ignored_folders=("dora-internvl" "dora-parler" "dora-keyboard" "dora-microphone" "terminal-input") | |||||
| ignored_folders=("dora-parler") | |||||
| # Skip test | |||||
| skip_test_folders=("dora-internvl" "dora-parler" "dora-keyboard" "dora-microphone" "terminal-input") | |||||
| # Get current working directory | # Get current working directory | ||||
| dir=$(pwd) | dir=$(pwd) | ||||
| @@ -23,15 +26,27 @@ else | |||||
| cargo test | cargo test | ||||
| pip install "maturin[zig]" | pip install "maturin[zig]" | ||||
| maturin build --zig | |||||
| maturin build --zig --release | |||||
| # If GITHUB_EVENT_NAME is release or workflow_dispatch, publish the wheel | |||||
| if [ "$GITHUB_EVENT_NAME" == "release" ] || [ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]; then | |||||
| maturin publish --skip-existing --zig | |||||
| fi | |||||
| # aarch64-unknown-linux-gnu | # aarch64-unknown-linux-gnu | ||||
| rustup target add aarch64-unknown-linux-gnu | rustup target add aarch64-unknown-linux-gnu | ||||
| maturin build --target aarch64-unknown-linux-gnu --zig | maturin build --target aarch64-unknown-linux-gnu --zig | ||||
| # If GITHUB_EVENT_NAME is release or workflow_dispatch, publish the wheel | |||||
| if [ "$GITHUB_EVENT_NAME" == "release" ] || [ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]; then | |||||
| maturin publish --target aarch64-unknown-linux-gnu --skip-existing --zig | |||||
| fi | |||||
| # armv7-unknown-linux-musleabihf | # armv7-unknown-linux-musleabihf | ||||
| rustup target add armv7-unknown-linux-musleabihf | rustup target add armv7-unknown-linux-musleabihf | ||||
| maturin build --target armv7-unknown-linux-musleabihf --zig | maturin build --target armv7-unknown-linux-musleabihf --zig | ||||
| # If GITHUB_EVENT_NAME is release or workflow_dispatch, publish the wheel | |||||
| if [ "$GITHUB_EVENT_NAME" == "release" ] || [ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]; then | |||||
| maturin publish --target armv7-unknown-linux-musleabihf --skip-existing --zig | |||||
| fi | |||||
| else | else | ||||
| if [ -f "$dir/Cargo.toml" ]; then | if [ -f "$dir/Cargo.toml" ]; then | ||||
| echo "Running build and tests for Rust project in $dir..." | echo "Running build and tests for Rust project in $dir..." | ||||
| @@ -39,6 +54,10 @@ else | |||||
| cargo clippy | cargo clippy | ||||
| cargo build | cargo build | ||||
| cargo test | cargo test | ||||
| if [ "$GITHUB_EVENT_NAME" == "release" ] || [ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]; then | |||||
| cargo publish | |||||
| fi | |||||
| else | else | ||||
| if [ -f "$dir/pyproject.toml" ]; then | if [ -f "$dir/pyproject.toml" ]; then | ||||
| echo "CI: Installing in $dir..." | echo "CI: Installing in $dir..." | ||||
| @@ -47,7 +66,15 @@ else | |||||
| echo "CI: Running Linting in $dir..." | echo "CI: Running Linting in $dir..." | ||||
| uv run ruff check . | uv run ruff check . | ||||
| echo "CI: Running Pytest in $dir..." | echo "CI: Running Pytest in $dir..." | ||||
| uv run pytest | |||||
| # Skip test for some folders | |||||
| if [[ " ${skip_test_folders[@]} " =~ " ${base_dir} " ]]; then | |||||
| echo "Skipping tests for $base_dir..." | |||||
| else | |||||
| uv run pytest | |||||
| fi | |||||
| if [ "$GITHUB_EVENT_NAME" == "release" ] || [ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]; then | |||||
| uv publish --check-url https://pypi.org/simple | |||||
| fi | |||||
| fi | fi | ||||
| fi | fi | ||||
| fi | fi | ||||
| @@ -3,7 +3,7 @@ name = "dora-ros2-bridge" | |||||
| version.workspace = true | version.workspace = true | ||||
| edition.workspace = true | edition.workspace = true | ||||
| license.workspace = true | license.workspace = true | ||||
| description = "Message generation for ROS2 bridge" | |||||
| description = "ROS2 bridge for dora-rs" | |||||
| links = "dora-ros2-bridge" | links = "dora-ros2-bridge" | ||||
| # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||||