From 09c3c90ff3e52c8edf825de6704d6652eedca13f Mon Sep 17 00:00:00 2001 From: richardmarston Date: Wed, 20 May 2020 17:34:22 +0200 Subject: [PATCH] Build RPM and DEB packages in github CI --- .github/actions/action.yml | 7 ++++++ .github/workflows/package.yml | 45 +++++++++++++++++++++++++++++++++++ CMakeLists.txt | 1 + Dockerfile | 9 +++++++ entrypoint.sh | 7 ++++++ 5 files changed, 69 insertions(+) create mode 100644 .github/actions/action.yml create mode 100644 .github/workflows/package.yml create mode 100644 Dockerfile create mode 100755 entrypoint.sh diff --git a/.github/actions/action.yml b/.github/actions/action.yml new file mode 100644 index 00000000..f57ea0f5 --- /dev/null +++ b/.github/actions/action.yml @@ -0,0 +1,7 @@ + +name: Docker Image CI +description: 'Create package' +runs: + using: 'docker' + image: 'Dockerfile' + diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 00000000..c429ac5e --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,45 @@ +name: package build workflow +# https://www.patriksvensson.se/2020/03/creating-release-artifacts-with-github-actions/ +# https://github.community/t5/GitHub-Actions/Using-on-push-tags-ignore-and-paths-ignore-together/td-p/38559 +# https://github.com/softprops/action-gh-release +# https://github.com/actions/download-artifact + +on: + push: + tags: + - 'release/v*' + +jobs: + package: + runs-on: ubuntu-latest + name: A job to build the packages + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Build + id: build-it-now + uses: ./ + - name: UploadRPM + uses: actions/upload-artifact@v2 + with: + name: rpm + path: ${{ github.workspace }}/build/*.rpm + - name: UploadDEB + uses: actions/upload-artifact@v2 + with: + name: deb + path: ${{ github.workspace }}/build/*.deb + release: + needs: package + runs-on: ubuntu-latest + steps: + - name: GetArtifact + uses: actions/download-artifact@v2 + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: | + rpm/* + deb/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CMakeLists.txt b/CMakeLists.txt index f69da259..e67f3576 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,7 @@ set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README") set(CPACK_DEBIAN_PACKAGE_DEPENDS "libexpat1") set(CPACK_DEBIAN_PACKAGE_SECTION "devel") set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/jezhiggins/arabica") +set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") set(CPACK_RPM_PACKAGE_LICENSE "BSD 3-clause") set(CPACK_RPM_PACKAGE_URL "https://github.com/jezhiggins/arabica") diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..d5f2dd0c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ + +from alpine:latest + +run apk update +run apk add boost-dev g++ make +run apk add cmake expat-dev rpm +copy entrypoint.sh entrypoint.sh + +entrypoint [ "./entrypoint.sh" ] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 00000000..53596d53 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +cd /github/workspace +mkdir build +cd build +cmake -DBUILD_SHARED_LIBS=ON .. +cpack