Skip to content

feat: migrate communication interfaces #547

feat: migrate communication interfaces

feat: migrate communication interfaces #547

Workflow file for this run

name: Build and Test
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
check-changelog:
name: Check if changelog has been updated
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check changelog
if: ${{ github.event.pull_request.base.sha }}
run: |
git fetch origin main ${{ github.event.pull_request.base.sha }}
CL_DIFF=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- CHANGELOG.md)
if ! [ "${CL_DIFF}" ]; then
echo "::error file="CHANGELOG.md",title=Check failed::CHANGELOG.md must be updated!"
exit 1
fi
shell: bash
check-version:
name: Check if version has been updated
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check version
if: ${{ github.event.pull_request.base.sha }}
run: |
VERSION=$(echo $(<VERSION) | tr -d -c 0-9)
MESSAGE="Set the desired version correctly using the 'update_version' script!"
SOURCE_CMAKE="./source/CMakeLists.txt"
if [ $(echo $(grep "project(control_libraries VERSION" "${SOURCE_CMAKE}") | tr -d -c 0-9) -ne "${VERSION}" ]; then
echo "::error file="${SOURCE_CMAKE}",title=Check failed::Version in "${SOURCE_CMAKE}" does not correspond to VERSION. ${MESSAGE}"
exit 1
fi
PROTO_CMAKE="./protocol/clproto_cpp/CMakeLists.txt"
if [ $(echo $(grep "project(clproto VERSION" "${PROTO_CMAKE}") | tr -d -c 0-9) -ne "${VERSION}" ]; then
echo "::error file="${PROTO_CMAKE}",title=Check failed::Version in "${PROTO_CMAKE}" does not correspond to VERSION. ${MESSAGE}"
exit 1
fi
PY_SETUP="./python/setup.py"
if [ $(echo $(grep "__version__ =" "${PY_SETUP}") | tr -d -c 0-9) -ne "${VERSION}" ]; then
echo "::error file="${PY_SETUP}",title=Check failed::Version in "${PY_SETUP}" does not correspond to VERSION. ${MESSAGE}"
exit 1
fi
DOXY="./doxygen/doxygen.conf"
if [ $(echo $(echo $(grep "PROJECT_NUMBER =" "${DOXY}") | tr -d -c 0-9) | tr -d '\0' ) -ne "${VERSION}" ]; then
echo "::error file="${DOXY}",title=Check failed::Version in "${DOXY}" does not correspond to VERSION. ${MESSAGE}"
exit 1
fi
DEMO_CMAKE="./demos/CMakeLists.txt"
if [ $(echo $(grep "find_package(control_libraries" "${DEMO_CMAKE}") | tr -d -c 0-9) -ne "${VERSION}" ]; then
echo "::error file="${DEMO_CMAKE}",title=Check failed::Version in "${DEMO_CMAKE}" does not correspond to VERSION. ${MESSAGE}"
exit 1
fi
shell: bash
check-skippable-changes:
needs: [ check-changelog, check-version ]
name: Check skippable changes
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check_if_skippable.outputs.should_skip }}
steps:
- id: check_if_skippable
uses: fkirc/skip-duplicate-actions@master
with:
cancel_others: 'true'
do_not_skip: '["workflow_dispatch"]'
paths_ignore: '["**.md", ".**/**", "**.gitignore"]'
skip_after_successful_duplicate: 'true'
build-test:
needs: check-skippable-changes
if: ${{ needs.check-skippable-changes.outputs.skip != 'true' }}
runs-on: ubuntu-latest
name: Run tests
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Cache for Docker
uses: actions/cache@v3
with:
path: build-cache
key: ${{ runner.os }}-build-cache-${{ hashFiles('./') }}
- name: Inject build-cache into docker
uses: reproducible-containers/buildkit-cache-dance@v2.1.2
with:
cache-source: build-cache
cache-target: /build
- name: Build and Test
uses: docker/build-push-action@v5
with:
context: .
target: python-test
cache-from: type=gha
cache-to: type=gha,mode=max