diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml new file mode 100644 index 0000000..fc2d72f --- /dev/null +++ b/.github/workflows/build_and_test.yaml @@ -0,0 +1,68 @@ +# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git). +# For troubleshooting, see readme (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst) + +name: Build and Test + +on: + workflow_dispatch: + pull_request: + push: + branches: + - ros2 + +jobs: + industrial_ci: + strategy: + matrix: + env: + - ROS_DISTRO: foxy + ROS_REPO: main + - ROS_DISTRO: foxy + ROS_REPO: testing + - ROS_DISTRO: rolling + ROS_REPO: main + - ROS_DISTRO: rolling + ROS_REPO: testing + env: + CCACHE_DIR: ${{ github.workspace }}/.ccache + BASEDIR: ${{ github.workspace }}/.work + CACHE_PREFIX: ${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }} + + name: ${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + # The target directory cache doesn't include the source directory because + # that comes from the checkout. See "prepare target_ws for cache" task below + - name: cache target_ws + if: ${{ ! matrix.env.CCOV }} + uses: pat-s/always-upload-cache@v2.1.3 + with: + path: ${{ env.BASEDIR }}/target_ws + key: target_ws-${{ env.CACHE_PREFIX }}-${{ hashFiles('**/CMakeLists.txt', '**/package.xml') }}-${{ github.run_id }} + restore-keys: | + target_ws-${{ env.CACHE_PREFIX }}-${{ hashFiles('**/CMakeLists.txt', '**/package.xml') }} + - name: cache ccache + uses: pat-s/always-upload-cache@v2.1.3 + with: + path: ${{ env.CCACHE_DIR }} + key: ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }}-${{ github.run_id }} + restore-keys: | + ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }} + ccache-${{ env.CACHE_PREFIX }} + - name: industrial_ci + uses: 'ros-industrial/industrial_ci@master' + env: ${{ matrix.env }} + - name: upload test artifacts (on failure) + uses: actions/upload-artifact@v2 + if: failure() + with: + name: test-results + path: ${{ env.BASEDIR }}/target_ws/**/test_results/**/*.xml + - name: prepare target_ws for cache + if: ${{ always() && ! matrix.env.CCOV }} + run: | + du -sh ${{ env.BASEDIR }}/target_ws + sudo find ${{ env.BASEDIR }}/target_ws -wholename '*/test_results/*' -delete + sudo rm -rf ${{ env.BASEDIR }}/target_ws/src + du -sh ${{ env.BASEDIR }}/target_ws diff --git a/.github/workflows/format.yml b/.github/workflows/format.yaml similarity index 93% rename from .github/workflows/format.yml rename to .github/workflows/format.yaml index fa91702..4fcae08 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yaml @@ -1,7 +1,7 @@ # This is a format job. Pre-commit has a first-party GitHub action, so we use # that: https://github.com/pre-commit/action -name: Format +name: Formatting (pre-commit) on: workflow_dispatch: diff --git a/.github/workflows/industrial_ci_action.yml b/.github/workflows/industrial_ci_action.yml deleted file mode 100644 index 2cbfc65..0000000 --- a/.github/workflows/industrial_ci_action.yml +++ /dev/null @@ -1,33 +0,0 @@ -# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git). -# For troubleshooting, see readme (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst) - -name: BuildAndTest - -on: [push, pull_request] - -jobs: - industrial_ci: - strategy: - matrix: - env: - - {ROS_DISTRO: foxy, ROS_REPO: main} - - {ROS_DISTRO: foxy, ROS_REPO: testing} - env: - CCACHE_DIR: /home/runner/.ccache - BASEDIR: .base - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v2 - with: - path: ${{ env.CCACHE_DIR }} - key: ccache-${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }}-${{ github.sha }} - restore-keys: | - ccache-${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }} - - uses: 'ros-industrial/industrial_ci@master' - env: ${{ matrix.env }} - - uses: actions/upload-artifact@v2 - if: failure() - with: - name: test-results - path: ${{ env.BASEDIR }}/target_ws/**/test_results/**/*.xml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fee4c75..aec0679 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,13 +19,19 @@ repos: hooks: - id: check-added-large-files - id: check-case-conflict + - id: check-json - id: check-merge-conflict - id: check-symlinks + - id: check-toml - id: check-xml - id: check-yaml - id: debug-statements + - id: destroyed-symlinks + - id: detect-private-key - id: end-of-file-fixer - id: mixed-line-ending + - id: pretty-format-json + - id: trailing-whitespace - repo: local hooks: diff --git a/README.md b/README.md index 0590193..d6574c0 100644 --- a/README.md +++ b/README.md @@ -2,5 +2,5 @@ Abstract interface for persisting ROS message data. Implementations are loaded | Branch | CI Status | | ------ | --------- | -| `ros2` | [![Format](https://github.com/ros-planning/warehouse_ros/actions/workflows/format.yml/badge.svg?branch=ros2)](https://github.com/ros-planning/warehouse_ros/actions/workflows/format.yml?branch=ros2) [![BuildAndTest](https://github.com/ros-planning/warehouse_ros/actions/workflows/industrial_ci_action.yml/badge.svg?branch=ros2)](https://github.com/ros-planning/warehouse_ros/actions/workflows/industrial_ci_action.yml?branch=ros2) | -| `kinetic-devel` | [![Format](https://github.com/ros-planning/warehouse_ros/actions/workflows/format.yml/badge.svg?branch=kinetic-devel)](https://github.com/ros-planning/warehouse_ros/actions/workflows/format.yml?branch=kinetic-devel) [![BuildAndTest](https://github.com/ros-planning/warehouse_ros/actions/workflows/industrial_ci_action.yml/badge.svg?branch=kinetic-devel)](https://github.com/ros-planning/warehouse_ros/actions/workflows/industrial_ci_action.yml?branch=kinetic-devel) | +| `ros2` | [![Formatting (pre-commit)](https://github.com/ros-planning/warehouse_ros/actions/workflows/format.yaml/badge.svg?branch=ros2)](https://github.com/ros-planning/warehouse_ros/actions/workflows/format.yaml?query=branch%3Aros2) [![Build and Test](https://github.com/ros-planning/warehouse_ros/actions/workflows/build_and_test.yaml/badge.svg?branch=ros2)](https://github.com/ros-planning/warehouse_ros/actions/workflows/build_and_test.yaml?query=branch%3Aros2) | +| `kinetic-devel` | [![Formatting (pre-commit)](https://github.com/ros-planning/warehouse_ros/actions/workflows/format.yaml/badge.svg?branch=kinetic-devel)](https://github.com/ros-planning/warehouse_ros/actions/workflows/format.yaml?query=branch%3Akinetic-devel) [![Build and Test](https://github.com/ros-planning/warehouse_ros/actions/workflows/build_and_test.yaml/badge.svg?branch=kinetic-devel)](https://github.com/ros-planning/warehouse_ros/actions/workflows/build_and_test.yaml?query=branch%3Akinetic-devel) |