forked from AutonomyLab/libcreate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from F-WuTS/feature/ci-packing
- Loading branch information
Showing
12 changed files
with
207 additions
and
48 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.github | ||
ci/Dockerfile |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Package | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
package: | ||
runs-on: ubuntu-24.04 | ||
strategy: | ||
matrix: | ||
platform: [linux/arm64/v8] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
platforms: linux/arm64 | ||
|
||
- name: Prepare container | ||
run: docker buildx build -f ci/Dockerfile . -t libcreate --platform ${{ matrix.platform }} --load | ||
- name: Build | ||
run: docker run --platform ${{ matrix.platform }} -v ./output:/libcreate/_packages libcreate | ||
- name: Push deb to compREP | ||
uses: cpina/github-action-push-to-another-repository@main | ||
env: | ||
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} | ||
with: | ||
source-directory: "output/" | ||
target-directory: "debs/libcreate/" | ||
destination-github-username: "F-WuTS" | ||
destination-repository-name: "compREP" | ||
target-branch: master |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Build and test | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
|
||
env: | ||
BUILD_TYPE: Release | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-24.04 | ||
|
||
steps: | ||
- name: Install dependencies | ||
run: | | ||
sudo apt install build-essential cmake git libboost-system-dev libboost-thread-dev file libgtest-dev googletest | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Configure CMake | ||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | ||
|
||
- name: Build | ||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | ||
|
||
- name: Test | ||
working-directory: ${{github.workspace}}/build | ||
run: ctest -C ${{env.BUILD_TYPE}} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM debian:bookworm | ||
|
||
RUN apt update && \ | ||
apt install -y \ | ||
build-essential cmake git file tree \ | ||
libboost-system-dev libboost-thread-dev \ | ||
libgtest-dev googletest && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /libcreate | ||
COPY . . | ||
|
||
WORKDIR /libcreate/build | ||
ENTRYPOINT ["/bin/bash", "/libcreate/ci/entrypoint.sh"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
cmake -B /libcreate/build -S /libcreate -DCMAKE_BUILD_TYPE=Release | ||
cmake --build /libcreate/build --config Release | ||
ctest -C Release --output-on-failure | ||
cpack --build /libcreate/build -G DEB | ||
|
||
debs=(/libcreate/_packages/*.deb) | ||
cp "${debs[0]}" /tmp/libcreate.deb | ||
dpkg-deb -R /tmp/libcreate.deb /tmp/libcreate | ||
tree /tmp/libcreate |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# these are cache variables, so they could be overwritten with -D, | ||
set(CPACK_PACKAGE_NAME ${PROJECT_NAME} | ||
CACHE STRING "The resulting package name" | ||
) | ||
# which is useful in case of packing only selected components instead of the whole thing | ||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "C++ library for interfacing with iRobot's Create 1 and 2" | ||
CACHE STRING "Package description for the package metadata" | ||
) | ||
set(CPACK_PACKAGE_VENDOR "Verein zur Förderung von Jugendlichen durch Robotikwettbewerbe") | ||
|
||
set(CPACK_VERBATIM_VARIABLES YES) | ||
|
||
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}) | ||
SET(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_SOURCE_DIR}/_packages") | ||
|
||
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) | ||
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) | ||
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) | ||
|
||
set(CPACK_PACKAGE_CONTACT "[email protected]") | ||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "comp-air dev team") | ||
|
||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") | ||
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") | ||
|
||
# Discover and set dependencies correcly | ||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS YES) | ||
|
||
# The installation path directory should have 0755 permissions | ||
set( | ||
CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS | ||
OWNER_READ OWNER_WRITE OWNER_EXECUTE | ||
GROUP_READ GROUP_EXECUTE | ||
WORLD_READ WORLD_EXECUTE | ||
) | ||
|
||
# package name for deb. If set, then instead of some-application-0.9.2-Linux.deb | ||
# you'll get some-application_0.9.2_amd64.deb (note the underscores too) | ||
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) | ||
|
||
include(CPack) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
find_package(Git) | ||
|
||
if(GIT_EXECUTABLE) | ||
execute_process( | ||
COMMAND ${GIT_EXECUTABLE} describe --tags | ||
OUTPUT_VARIABLE TAG_VERSION | ||
RESULT_VARIABLE ERROR_CODE | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
|
||
if(DEFINED ENV{GITHUB_REF} AND ENV{GITHUB_REF_TYPE} EQUAL "tag") | ||
set(TAG_VERSION $ENV{GITHUB_REF}) | ||
message(STATUS "Extracted version from GITHUB_REF") | ||
endif() | ||
|
||
if(TAG_VERSION STREQUAL "") | ||
set(TAG_VERSION 0.0.0) | ||
message(WARNING "Failed to determine version from Git tags. Using default version \"${TAG_VERSION}\".") | ||
endif() | ||
|
||
message(STATUS "Project version: ${TAG_VERSION}") | ||
|
||
# Split into major, minor, patch | ||
string( | ||
REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" | ||
TAG_VERSION_MATCH ${TAG_VERSION} | ||
) | ||
set(TAG_VERSION_MAJOR ${CMAKE_MATCH_1}) | ||
set(TAG_VERSION_MINOR ${CMAKE_MATCH_2}) | ||
set(TAG_VERSION_PATCH ${CMAKE_MATCH_3}) | ||
endif() |
This file contains 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
Empty file.
This file contains 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