[toolbox] Add debian package creation to nightly and release workflows
This commit is contained in:
parent
f4a6dc912a
commit
3e02704e95
|
@ -14,6 +14,7 @@ on:
|
|||
paths:
|
||||
- '.github/workflows/nightly.yml'
|
||||
- '.github/matrix_includes.json'
|
||||
- 'debian/**'
|
||||
- 'test/**'
|
||||
- '!test/RobotTests.md'
|
||||
- '!test/tests.py'
|
||||
|
@ -242,6 +243,30 @@ jobs:
|
|||
path: cmsis-toolbox
|
||||
retention-days: ${{ env.retention-days }}
|
||||
|
||||
# Debian Package
|
||||
- name: Update dependencies
|
||||
if: ${{ matrix.target == 'linux' && matrix.arch == 'amd64' }}
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install ninja-build
|
||||
|
||||
- name: Create Debian Package
|
||||
if: ${{ matrix.target == 'linux' && matrix.arch == 'amd64' }}
|
||||
run: |
|
||||
git fetch --unshallow
|
||||
mkdir -p ./debian/build
|
||||
cmake -G Ninja -S ./debian -B ./debian/build -DTOOLBOX_ROOT=$(realpath ./cmsis-toolbox) -DTOOLBOX_VERSION=$(git describe --tags --abbrev=0)+nightly-$(date +%Y%m%d%H%M)
|
||||
cd ./debian/build
|
||||
cpack -G DEB
|
||||
|
||||
- name: Archive Debian Package
|
||||
if: ${{ matrix.target == 'linux' && matrix.arch == 'amd64' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cmsis-toolbox-debian-package
|
||||
path: ./debian/build/cmsis-toolbox_*_amd64.deb
|
||||
retention-days: ${{ env.retention-days }}
|
||||
|
||||
run-tests:
|
||||
needs: [ matrix_prep, create-toolbox ]
|
||||
runs-on: ${{ matrix.runs_on }}
|
||||
|
|
|
@ -5,6 +5,7 @@ on:
|
|||
- main
|
||||
paths:
|
||||
- '.github/workflows/toolbox.yml'
|
||||
- 'debian/**'
|
||||
- 'test/test.py'
|
||||
- 'scripts/**'
|
||||
- '!docs/**'
|
||||
|
@ -275,6 +276,27 @@ jobs:
|
|||
retention-days: 1
|
||||
if-no-files-found: error
|
||||
|
||||
# Debian Package
|
||||
- name: Update dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install ninja-build
|
||||
|
||||
- name: Create Debian Package
|
||||
run: |
|
||||
mkdir -p ./debian/build
|
||||
cmake -G Ninja -S ./debian -B ./debian/build -DTOOLBOX_ROOT=$(realpath ./toolbox/zip/cmsis-toolbox-linux-amd64) -DTOOLBOX_VERSION=$(echo ${{ github.ref }} | cut -d'/' -f3)
|
||||
cd ./debian/build
|
||||
cpack -G DEB
|
||||
|
||||
- name: Archive Debian Package
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cmsis-toolbox-debian-package
|
||||
path: ./debian/build/cmsis-toolbox_*_amd64.deb
|
||||
retention-days: 1
|
||||
if-no-files-found: error
|
||||
|
||||
tests:
|
||||
if: |
|
||||
${{ github.event_name == 'pull_request' || github.event_name == 'release' }}
|
||||
|
@ -472,3 +494,19 @@ jobs:
|
|||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
file_glob: true
|
||||
|
||||
# Debian Package
|
||||
- name: Download Debian Package
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: cmsis-toolbox-debian-package
|
||||
path: debian
|
||||
|
||||
- name: Attach Debian Package to release assets
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: debian/cmsis-toolbox_*_amd64.deb
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
file_glob: true
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
cmake_minimum_required(VERSION 3.22)
|
||||
project(cmsis-toolbox NONE)
|
||||
|
||||
set(TOOLBOX_ROOT "" CACHE PATH "CMSIS-Toolbox Root")
|
||||
set(TOOLBOX_VERSION "" CACHE STRING "CMSIS-Toolbox Version")
|
||||
|
||||
if(TOOLBOX_ROOT STREQUAL "")
|
||||
message(SEND_ERROR "TOOLBOX_ROOT not defined")
|
||||
endif()
|
||||
if(TOOLBOX_VERSION STREQUAL "")
|
||||
message(SEND_ERROR "TOOLBOX_VERSION not defined")
|
||||
endif()
|
||||
|
||||
# install cmsis-toolbox files in /usr/lib/cmsis-toolbox
|
||||
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
|
||||
install(DIRECTORY ${TOOLBOX_ROOT}/
|
||||
FILE_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
||||
DESTINATION lib/${CMAKE_PROJECT_NAME})
|
||||
|
||||
# create symlinks and install them in /usr/bin
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
|
||||
${CMAKE_CURRENT_BINARY_DIR}/symlink)
|
||||
file(GLOB_RECURSE EXECUTABLES ${TOOLBOX_ROOT}/bin/*)
|
||||
foreach(EXECUTABLE ${EXECUTABLES})
|
||||
cmake_path(GET EXECUTABLE FILENAME NAME)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
|
||||
${CPACK_PACKAGING_INSTALL_PREFIX}/lib/${CMAKE_PROJECT_NAME}/bin/${NAME}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/symlink/${NAME})
|
||||
endforeach()
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/symlink/ DESTINATION bin)
|
||||
|
||||
# set debian package info
|
||||
set(CPACK_GENERATOR "DEB")
|
||||
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
|
||||
set(CPACK_DEBIAN_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
|
||||
set(CPACK_DEBIAN_PACKAGE_VERSION ${TOOLBOX_VERSION})
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMSIS-Toolbox command-line tools")
|
||||
set(CPACK_PACKAGE_DESCRIPTION
|
||||
"The CMSIS-Toolbox uses software packs for device/board support and access
|
||||
reusable software components. The operation is controlled via intuitive csolution
|
||||
project files in YAML format. The overall application is defined in the
|
||||
*.csolution.yml file and contains one or more projects that can utilize
|
||||
pre-configured software layers. The build engine CMake/Ninja calls the C/C++
|
||||
compiler toolchain that generates the Build Output.")
|
||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Daniel Brondani - Arm Ltd. <daniel.brondani@arm.com>")
|
||||
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/Open-CMSIS-Pack/cmsis-toolbox")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "cmake (>= 3.27), ninja-build (>=1.11.1)")
|
||||
|
||||
include(CPack)
|
Loading…
Reference in New Issue