From dda7c4b5dd8a11397f46322d5bd464a4439cf5a7 Mon Sep 17 00:00:00 2001 From: Michael Ripperger Date: Thu, 8 Aug 2024 00:47:09 -0400 Subject: [PATCH] CI Update (#81) * Updated CI workflow * Moved Python deps to package.xml --- .github/workflows/add_ros_apt_sources.sh | 4 -- .github/workflows/ubuntu.yml | 72 +++++++++--------------- package.xml | 6 ++ requirements.txt | 6 -- 4 files changed, 32 insertions(+), 56 deletions(-) delete mode 100755 .github/workflows/add_ros_apt_sources.sh delete mode 100644 requirements.txt diff --git a/.github/workflows/add_ros_apt_sources.sh b/.github/workflows/add_ros_apt_sources.sh deleted file mode 100755 index 30655db0..00000000 --- a/.github/workflows/add_ros_apt_sources.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/bash -curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg -echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null -apt update -qq diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index dcc548b6..0c3f37bb 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -1,14 +1,13 @@ -name: Ubuntu +name: Ubuntu [Focal, Jammy, Noble] on: push: branches: - master pull_request: - branches: - - master schedule: - cron: '0 5 * * *' + workflow_dispatch: release: types: - released @@ -20,52 +19,33 @@ jobs: strategy: fail-fast: false matrix: - distro: [focal, jammy] - env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - PREFIX: ${{ github.repository }}_ + distro: [focal, jammy, noble] + container: + image: ubuntu:${{ matrix.distro }} + env: + CCACHE_DIR: ${{ github.workspace }}/${{ matrix.distro }}/.ccache + DEBIAN_FRONTEND: noninteractive + TZ: Etc/UTC steps: - name: Checkout repository - uses: actions/checkout@v2 - - - name: Login to Github Packages - uses: docker/login-action@v2 + uses: actions/checkout@v4 with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + path: target_ws/src - - name: Extract Docker meta-information - id: meta - uses: docker/metadata-action@v3 + - name: Build and Tests + uses: tesseract-robotics/colcon-action@v9 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - flavor: | - latest=false - prefix= - suffix= - tags: | - type=ref,event=branch,prefix=${{ matrix.distro }}- - type=semver,pattern={{major}}.{{minor}},prefix=${{ matrix.distro }}- - - - name: Build repository - uses: 'tesseract-robotics/industrial_ci@2f4c8ab919f0aafddd514e586325defabd2911ea' - env: - DOCKER_IMAGE: ubuntu:${{ matrix.distro }} - ROS_DISTRO: false - PREFIX: ${{ github.repository }}_ - UPSTREAM_WORKSPACE: dependencies.repos - ADDITIONAL_DEBS: 'curl lsb-release' - AFTER_INIT: './.github/workflows/add_ros_apt_sources.sh' - TARGET_CMAKE_ARGS: '-DENABLE_TESTING=ON -DENABLE_RUN_TESTING=OFF -DCMAKE_BUILD_TYPE=Release' - AFTER_INSTALL_TARGET_DEPENDENCIES: 'python3 -m pip install -r requirements.txt -qq' - BEFORE_RUN_TARGET_TEST: 'apt remove *-dev -y -qq' - BEFORE_RUN_TARGET_TEST_EMBED: 'ici_with_unset_variables source $BASEDIR/${PREFIX}target_ws/install/setup.bash' - AFTER_RUN_TARGET_TEST: 'python3 -m pytest -v' - AFTER_SCRIPT: 'rm -rf $BASEDIR/${PREFIX}upstream_ws/build $BASEDIR/${PREFIX}target_ws/build' - DOCKER_COMMIT: ${{ steps.meta.outputs.tags }} + before-script: + ccache-prefix: ${{ matrix.distro }} + add-ros-ppa: true + vcs-file: dependencies.repos + upstream-args: --cmake-args -DCMAKE_BUILD_TYPE=Release + target-path: target_ws/src + target-args: --cmake-args -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTING=ON -DENABLE_RUN_TESTING=OFF - - name: Push post-build Docker - if: ${{ github.ref == 'refs/heads/master' || github.event_name == 'release' || github.ref_type == 'tag' }} - run: docker push ${{ steps.meta.outputs.tags }} + - name: Python Tests + working-directory: target_ws/src + shell: bash + run: | + source ../install/setup.bash + python3 -m pytest -v diff --git a/package.xml b/package.xml index 9f19a75b..f8b1a13b 100644 --- a/package.xml +++ b/package.xml @@ -18,6 +18,12 @@ libomp-dev yaml-cpp gtest + python3-numpy + python3-scipy + python3-open3d + python3-tqdm + python3-matplotlib + python3-pytest cmake diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 440b084c..00000000 --- a/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -numpy -scipy -open3d -tqdm -matplotlib -pytest \ No newline at end of file