forked from f1xpl/aasdk
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* package using cpack (#18) Added build to .gitignore Added vscode tasks to clean, build, package Added CPack support for debian packages * Added gitversion,cmake and last commit epoch as patch version * Switched patch version to use commit hash instead of epoch * Added CPACK_Version * added message to output version * added dockerbuild temp * workflow fix * fixed tabs * fixed depends * fixed typo * typo in Dockerfile * added upload artifact * added deb_architecture * added releases * fixed checkout * added tags * fixed release gha * Added versioning * switch to use commit_timestamp
- Loading branch information
Showing
9 changed files
with
429 additions
and
13 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,162 @@ | ||
name: Build and test with docker | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
version: | ||
outputs: | ||
version: ${{ steps.get_version.outputs.version }} | ||
buildname: ${{ steps.get_version.outputs.buildname }} | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- | ||
name: Checkout repository | ||
uses: actions/checkout@v1 | ||
- | ||
name: Get the version | ||
id: get_version | ||
run: | | ||
if [ -z "$version" ] | ||
then | ||
version=$(date '+%Y%m%d') | ||
echo ::set-output name=version::"${version}" | ||
else | ||
echo ::set-output name=version::"${version}" | ||
fi | ||
builddate=$(date '+%Y-%m-%d') | ||
buildhash=$(git rev-parse --short "$GITHUB_SHA") | ||
buildname="${builddate}-${buildhash}" | ||
echo ::set-output name=version::${VERSION} | ||
echo ::set-output name=buildhash::${buildhash} | ||
echo ::set-output name=builddate::${builddate} | ||
echo ::set-output name=buildname::${buildname} | ||
env: | ||
version: ${{ github.event.inputs.version }} | ||
compile: | ||
runs-on: ${{ matrix.host }} | ||
needs: [ version ] | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 3 | ||
matrix: | ||
host: [ | ||
"ubuntu-latest", | ||
#"macos-10.15", | ||
] | ||
config: | ||
- { | ||
name: "armhf Release", | ||
arch: "armhf" | ||
} | ||
- { | ||
name: "amd64 Release", | ||
arch: "amd64" | ||
} | ||
|
||
name: 'Build and Upload release: ${{ matrix.config.name }}' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- | ||
name: Build the Docker image | ||
run: docker build -t aasdk_builder --file buildenv/Dockerfile . | ||
- | ||
name: 'Build ${{ matrix.config.arch }} Debian package' | ||
run: docker run -v "${PWD}/release":/release aasdk_builder:latest ${{ matrix.config.arch }} | ||
- | ||
name: Get Name of Artifact | ||
id: get-artifact-name | ||
run: | | ||
ls -hla | ||
ARTIFACT_PATHNAME=$(ls ./release/*.deb | head -n 1) | ||
ARTIFACT_NAME=$(basename $ARTIFACT_PATHNAME) | ||
echo ::set-output name=artifact_filename::${ARTIFACT_NAME} | ||
echo ::set-output name=artifact_path::${ARTIFACT_PATHNAME} | ||
- | ||
name: Upload build artifacts | ||
id: upload_deploy | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ matrix.config.arch }} | ||
path: | | ||
${{ steps.get-artifact-name.outputs.artifact_path }} | ||
# Create Release | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: [ version, compile ] | ||
if: startsWith(github.ref, 'refs/tags/') | ||
name: 'Create release' | ||
outputs: | ||
release_upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- | ||
name: Build Changelog | ||
id: github_release | ||
uses: mikepenz/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Create GitHub release | ||
id: create_release | ||
uses: softprops/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{needs.version.outputs.version }} | ||
release_name: ${{needs.version.outputs.buildname }} | ||
body: ${{steps.github_release.outputs.changelog}} | ||
draft: true | ||
prerelease: true | ||
# Upload release artifacts | ||
upload: | ||
needs: [ version, compile, release ] | ||
runs-on: ${{ matrix.host }} | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 3 | ||
matrix: | ||
host: [ | ||
"ubuntu-latest", | ||
#"macos-10.15", | ||
] | ||
config: | ||
- { | ||
name: "armhf Release", | ||
arch: "armhf" | ||
} | ||
- { | ||
name: "amd64 Release", | ||
arch: "amd64" | ||
} | ||
|
||
name: 'Upload release: ${{ matrix.config.name }}' | ||
steps: | ||
- | ||
name: Download build artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: ${{ steps.get_version.outputs.version }} | ||
|
||
- | ||
name: Get Artifact Filenames | ||
id: get-artifact-name | ||
run: | | ||
ARTIFACT_PATHNAME=$(ls ${{ matrix.config.arch }}/*.deb | head -n 1) | ||
ARTIFACT_NAME=$(basename $ARTIFACT_PATHNAME) | ||
echo ::set-output name=artifact_filename::${ARTIFACT_NAME} | ||
echo ::set-output name=artifact_path::${ARTIFACT_PATHNAME} | ||
- | ||
name: Upload zip to release | ||
id: upload_zip | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
RELEASE_VERSION: ${{ needs.version.outputs.buildname }} | ||
with: | ||
upload_url: ${{needs.release.outputs.release_upload_url}} | ||
asset_path: ${{ steps.get-artifact-name.outputs.artifact_path }} | ||
asset_name: ${{ steps.get-artifact-name.outputs.artifact_filename }} | ||
asset_content_type: application/vnd.debian.binary-package |
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 |
---|---|---|
|
@@ -9,3 +9,4 @@ aasdk_proto/*.pb.h | |
Makefile | ||
cmake_install.cmake | ||
install_manifest.txt | ||
build/** |
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,57 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Clean", | ||
"command": "sudo rm -R build", | ||
"type": "shell", | ||
"args": [], | ||
"problemMatcher": [ | ||
"$tsc" | ||
], | ||
"presentation": { | ||
"reveal": "always" | ||
}, | ||
"group": "build" | ||
}, | ||
{ | ||
"label": "Build", | ||
"command": "mkdir build;cd build;cmake -DCMAKE_BUILD_TYPE=Release ../", | ||
"type": "shell", | ||
"args": [], | ||
"problemMatcher": [ | ||
"$tsc" | ||
], | ||
"presentation": { | ||
"reveal": "always" | ||
}, | ||
"group": "build" | ||
}, | ||
{ | ||
"label": "Create DEB Package", | ||
"command": "cd build;cpack --config CPackConfig.cmake", | ||
"type": "shell", | ||
"args": [], | ||
"problemMatcher": [ | ||
"$tsc" | ||
], | ||
"presentation": { | ||
"reveal": "always" | ||
}, | ||
"group": "build" | ||
}, | ||
{ | ||
"label": "Create DEB SRC Package", | ||
"command": "cd build;cpack --config CPackSourceConfig.cmake", | ||
"type": "shell", | ||
"args": [], | ||
"problemMatcher": [ | ||
"$tsc" | ||
], | ||
"presentation": { | ||
"reveal": "always" | ||
}, | ||
"group": "build" | ||
} | ||
] | ||
} |
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
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,28 @@ | ||
FROM debian:buster AS aasdk | ||
|
||
RUN dpkg --add-architecture armhf | ||
RUN apt-get update | ||
RUN apt-get -y install cmake build-essential git | ||
RUN apt-get -y install gcc-arm-linux-gnueabihf cpp-arm-linux-gnueabihf g++-arm-linux-gnueabihf protobuf-compiler | ||
RUN apt-get -y install gcc-8-base:armhf libc6:armhf libgcc1:armhf libicu63:armhf libidn2-0:armhf libstdc++6:armhf libunistring2:armhf | ||
|
||
# These are all the libboost requirements. It would be shorter if libboost-log-dev wasn't a disaster that's being dealt with manually. | ||
RUN apt-get install -y libprotobuf-dev libusb-1.0.0-dev libssl-dev libboost-dev libboost-system-dev libboost-atomic1.67.0 libboost-chrono1.67.0 libboost-date-time1.67.0 libboost-filesystem1.67.0 libboost-regex1.67.0 libboost-thread1.67.0 libboost-filesystem1.67-dev libboost-thread1.67-dev libboost-date-time1.67-dev | ||
RUN apt-get install -y libprotobuf-dev:armhf libusb-1.0.0-dev:armhf libssl-dev:armhf libboost-dev:armhf libboost-system-dev:armhf libboost-atomic1.67.0:armhf libboost-chrono1.67.0:armhf libboost-date-time1.67.0:armhf libboost-filesystem1.67.0:armhf libboost-regex1.67.0:armhf libboost-system1.67.0:armhf libboost-thread1.67.0:armhf libboost-filesystem1.67-dev:armhf libboost-thread1.67-dev:armhf libboost-date-time1.67-dev:armhf | ||
|
||
COPY / /src | ||
|
||
WORKDIR /src | ||
|
||
# Import resources | ||
COPY ./buildenv/patch-libboost-log-deb.sh /src/resources/patch-libboost-log-deb.sh | ||
COPY ./buildenv/entrypoint.sh /entrypoint.sh | ||
|
||
# Patch libboost-log-dev and install | ||
RUN chmod +x ./resources/patch-libboost-log-deb.sh | ||
RUN ./resources/patch-libboost-log-deb.sh | ||
|
||
# Make Executable | ||
RUN chmod +x /entrypoint.sh | ||
|
||
ENTRYPOINT ["/bin/bash", "/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,28 @@ | ||
#!/bin/bash | ||
ARCH=$1 | ||
MAJORVER=0 | ||
|
||
if [ -z "$ARCH" ] | ||
then | ||
echo "Please supply a target architecture to build" | ||
echo "Choose from 'amd64', 'armhf'" | ||
exit | ||
else | ||
if [ "$ARCH" != "amd64" ] && [ "$ARCH" != "armhf" ] | ||
then | ||
echo "Invalid architecture requested" | ||
exit | ||
fi | ||
fi | ||
|
||
echo "Now building within docker for $ARCH" | ||
|
||
# Clear out the /build directory | ||
mkdir build; | ||
cd build; | ||
cmake -DCMAKE_BUILD_TYPE=Release -DTARGET_ARCH=$ARCH ../ | ||
make -j4 | ||
cpack --config CPackConfig.cmake | ||
|
||
# Move it to release | ||
mv *.deb /release/ |
Oops, something went wrong.