ci #278
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci | |
| on: | |
| pull_request: | |
| paths: | |
| - .github/workflows/pytest.yaml | |
| - genesis_ros/** | |
| - tests/** | |
| - pyproject.toml | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| schedule: | |
| - cron: 0 0 * * * | |
| release: | |
| types: [published] | |
| jobs: | |
| pytest: | |
| name: pytest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| uv-version: ["0.6.14"] | |
| os: [ubuntu-22.04] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Install OpenCV/libegl related libraries | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ffmpeg libsm6 libxext6 libegl-dev xvfb mesa-utils | |
| Xvfb :99 -screen 0 1024x768x24 & | |
| export DISPLAY=:99 | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| # Install a specific version of uv. | |
| version: "0.6.14" | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: "Setup genesis_ros" | |
| run: uv sync --dev | |
| - name: Run pytest | |
| run: uv run pytest -s | |
| pytest_with_ros2: | |
| name: pytest with ROS 2 environment | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| uv-version: ["0.6.14"] | |
| ros2_distro: [humble] | |
| env: | |
| ROS_DISTRO: ${{ matrix.ros2_distro }} | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: ros-tooling/setup-ros@v0.7 | |
| with: | |
| required-ros-distributions: ${{ matrix.ros2_distro }} | |
| - name: Install OpenCV/libegl/git related libraries | |
| run: | | |
| echo "deb [trusted=yes] https://download.eclipse.org/zenoh/debian-repo/ /" | sudo tee -a /etc/apt/sources.list > /dev/null | |
| sudo apt-get update | |
| sudo apt-get install -y ffmpeg libsm6 libxext6 libegl-dev xvfb mesa-utils zenoh-bridge-ros2dds zenoh | |
| Xvfb :99 -screen 0 1024x768x24 & | |
| export DISPLAY=:99 | |
| - name: make workspace | |
| run: mkdir -p /opt/ros_ws/src | |
| - name: Clone op3_packages | |
| run: | | |
| git clone https://github.com/team-re-boot/ROBOTIS-OP3-Common.git op3_packages | |
| working-directory: /opt/ros_ws/src/ | |
| - name: resolve rosdep | |
| run: | | |
| rosdep update --include-eol-distros | |
| rosdep install -iy --from-paths /opt/ros_ws/src/op3_packages/op3_description --rosdistro ${{ matrix.ros2_distro }} | |
| - name: colcon build | |
| run: | | |
| source /opt/ros/${{ matrix.ros2_distro }}/setup.bash | |
| colcon build --packages-select op3_description | |
| working-directory: /opt/ros_ws | |
| shell: bash | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| # Install a specific version of uv. | |
| version: "0.6.14" | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: "Setup genesis_ros" | |
| run: uv sync --dev | |
| - name: Run pytest | |
| run: | | |
| source /opt/ros/${{ matrix.ros2_distro }}/setup.bash | |
| source /opt/ros_ws/install/local_setup.bash | |
| uv run pytest -s | |
| shell: bash | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./_htmlcov/coverage.xml | |
| flags: pytest # optional | |
| name: codecov-umbrella # optional | |
| fail_ci_if_error: false # optional (default = false) | |
| verbose: true # optional (default = false) | |
| token: ${{ secrets.CODECOV_TOKEN }} |