Skip to content

Commit

Permalink
ci: update workflows (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
domire8 authored Apr 8, 2024
1 parent 852f164 commit 307c964
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 115 deletions.
57 changes: 0 additions & 57 deletions .github/workflows/build-push.yml

This file was deleted.

74 changes: 59 additions & 15 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,68 @@ name: Build and Push Multi-Arch Images
on:
push:
branches:
- develop
- main
tags:
- "v*.*.*"

jobs:
get-tag:
runs-on: ubuntu-latest
name: Get tag
check-version:
name: Check if the version has been updated
outputs:
tag: ${{ steps.parse-tag.outputs.tag }}
has_changed: ${{ steps.check.outputs.has_changed }}
version: ${{ steps.versions.outputs.new_version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: aica-technology/.github/.github/actions/docker-tag-from-git@v0.6.1
id: parse-tag
with:
fetch-depth: 2
- id: versions
run: |
PREV_VERSION=$(git show HEAD^:VERSION)
NEW_VERSION=$(git show HEAD:VERSION)
echo "prev_version=${PREV_VERSION}" >> $GITHUB_OUTPUT
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
shell: bash
- uses: aica-technology/.github/.github/actions/compare-versions@v0.11.0
id: check
with:
previous_version: ${{ steps.versions.outputs.prev_version }}
new_version: ${{ steps.versions.outputs.new_version }}

metadata:
name: Get metadata
needs: check-version
runs-on: ubuntu-latest
outputs:
image_name: ${{ steps.ensure-image.outputs.image_name }}
image_tags: ${{ steps.tags.outputs.image_tags }}
create_tag: ${{ steps.tags.outputs.create_tag }}
git_tag: ${{ steps.tags.outputs.git_tag }}
steps:
- uses: aica-technology/.github/.github/actions/ghcr-ensure-prefix@v0.6.0
id: ensure-image
with:
image_name: aica-technology/control-libraries

- run: |
CREATE_TAG=false
GIT_TAG=""
if [ ${{ needs.check-version.outputs.has_changed }} = 'true' ]; then
CREATE_TAG=true
GIT_TAG="v${{ needs.check-version.outputs.version }}"
IMAGE_TAGS=latest,"${GIT_TAG}",rolling
else
IMAGE_TAGS=rolling
fi
echo "Image tags: ${IMAGE_TAGS}"
echo "Create tag: ${CREATE_TAG}"
echo "Git tag: ${GIT_TAG}"
echo "image_tags=${IMAGE_TAGS}" >> $GITHUB_OUTPUT
echo "create_tag=${CREATE_TAG}" >> $GITHUB_OUTPUT
echo "git_tag=${GIT_TAG}" >> $GITHUB_OUTPUT
id: tags
shell: bash
build:
needs: [get-tag]
needs: metadata
strategy:
matrix:
arch: [amd64, arm64]
Expand All @@ -38,25 +82,25 @@ jobs:
- uses: aica-technology/.github/.github/actions/list-add-suffixes@v0.6.1
id: merge-tags
with:
list: ${{ needs.get-tag.outputs.tag }}
list: ${{ needs.metadata.outputs.image_tags }}
suffixes: ${{ matrix.arch }}
glue_separator: "-"

- uses: aica-technology/.github/.github/actions/ghcr-build@v0.6.1
with:
image_name: aica-technology/control-libraries
image_name: ${{ needs.metadata.outputs.image_name }}
image_tags: ${{ steps.merge-tags.outputs.list }}
dockerfile_path: Dockerfile
token: ${{ secrets.GITHUB_TOKEN }}

multi-arch:
runs-on: ubuntu-latest
name: Merge into a multi-arch image
needs: [get-tag, build]
needs: [ metadata, build ]
steps:
- uses: aica-technology/.github/.github/actions/ghcr-manifest-merge@v0.6.1
with:
image_name: aica-technology/control-libraries
image_tags: ${{ needs.get-tag.outputs.tag }}
image_name: ${{ needs.metadata.outputs.image_name }}
image_tags: ${{ needs.metadata.outputs.image_tags }}
archs: amd64,arm64
token: ${{ secrets.GITHUB_TOKEN }}
64 changes: 47 additions & 17 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,70 @@ on:
push:
branches:
- main
- develop
pull_request:
workflow_dispatch:

jobs:

check-contribution:
name: Check if changelog and version have been updated
check-changelog:
name: Check if changelog has been updated
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check contributions
- name: Check changelog
if: ${{ github.event.pull_request.base.sha }}
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git fetch origin main ${{ github.event.pull_request.base.sha }} ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
VER_DIFF=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- ./VERSION)
if ! [ "${VER_DIFF}" ]; then
bash update_version.sh --commit && git push
fi
CL_DIFF=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- ./CHANGELOG.md)
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
SEARCH_STRING="## Upcoming changes (in development)"
NEW_TITLE="${{ github.event.pull_request.title }} (#${{ github.event.pull_request.number }})"
sed -z "s/${SEARCH_STRING}\n/${SEARCH_STRING}\n\n- ${NEW_TITLE}/" -i CHANGELOG.md
git add CHANGELOG.md && git commit -m "Update CHANGELOG" && git push
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 "project(clproto VERSION" "${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:
Expand Down
52 changes: 32 additions & 20 deletions .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,55 @@
name: Generate and Deploy Documentation
on:
push:
push:
branches:
- main
- develop
release:
types: [published]
workflow_dispatch:

jobs:
check-version:
name: Check if the version has been updated
outputs:
has_changed: ${{ steps.check.outputs.has_changed }}
version: ${{ steps.versions.outputs.new_version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- id: versions
run: |
PREV_VERSION=$(git show HEAD^:VERSION)
NEW_VERSION=$(git show HEAD:VERSION)
echo "prev_version=${PREV_VERSION}" >> $GITHUB_OUTPUT
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
shell: bash
- uses: aica-technology/.github/.github/actions/compare-versions@v0.11.0
id: check
with:
previous_version: ${{ steps.versions.outputs.prev_version }}
new_version: ${{ steps.versions.outputs.new_version }}

deploy:
needs: check-version
name: Generate and Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3

- name: Generate docs
uses: mattnotmitt/doxygen-action@v1
with:
working-directory: 'doxygen'
doxyfile-path: 'doxygen.conf'

- name: Tag release version
if: ${{ github.event_name == 'release' }}
shell: bash
run: |
TAG="${GITHUB_REF#refs/tags/}"
TAG="${TAG/\//-}"
mkdir -p doxygen/docs/versions
sudo mv doxygen/docs/html doxygen/docs/versions/${TAG}
- name: Tag branch version
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
- name: Tag version
shell: bash
run: |
BRANCH="${GITHUB_REF#refs/heads/}"
BRANCH="${BRANCH/\//-}"
mkdir -p doxygen/docs/versions
sudo mv doxygen/docs/html doxygen/docs/versions/${BRANCH}
sudo mv doxygen/docs/html doxygen/docs/versions/rolling
if [ ${{ needs.check-version.outputs.has_changed }} ]; then
sudo cp doxygen/docs/versions/rolling doxygen/docs/versions/latest
sudo cp doxygen/docs/versions/rolling doxygen/docs/versions/${{ needs.check-version.outputs.version }}
fi
- name: Deploy to documentation branch
uses: peaceiris/actions-gh-pages@v3
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Release Versions:

## Upcoming changes (in development)

- ci: update workflows (#175)
- feat: integrate collision detection feature into robot model (#163)
- feat: add IO states to state representation (py) (#173)
- ci: use caching from docker to run tests in CI (#429)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.3.10
7.3.11
2 changes: 1 addition & 1 deletion demos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(control_libraries 7.3.10 CONFIG REQUIRED)
find_package(control_libraries 7.3.11 CONFIG REQUIRED)

set(DEMOS_SCRIPTS
task_space_control_loop
Expand Down
2 changes: 1 addition & 1 deletion doxygen/doxygen.conf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Control Libraries"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 7.3.10
PROJECT_NUMBER = 7.3.11

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion protocol/clproto_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.15)

project(clproto VERSION 7.3.10)
project(clproto VERSION 7.3.11)

# Default to C99
if(NOT CMAKE_C_STANDARD)
Expand Down
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# names of the environment variables that define osqp and openrobots include directories
osqp_path_var = 'OSQP_INCLUDE_DIR'

__version__ = "7.3.10"
__version__ = "7.3.11"
__libraries__ = ['state_representation', 'clproto', 'controllers', 'dynamical_systems', 'robot_model']
__include_dirs__ = ['include']

Expand Down
2 changes: 1 addition & 1 deletion source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.15)

project(control_libraries VERSION 7.3.10)
project(control_libraries VERSION 7.3.11)

# Build options
option(BUILD_TESTING "Build all tests." OFF)
Expand Down

0 comments on commit 307c964

Please sign in to comment.