From f825cb5c15752151f450458cdf05485f2251d9a1 Mon Sep 17 00:00:00 2001 From: Uwe Seimet Date: Thu, 30 Nov 2023 10:23:15 +0100 Subject: [PATCH] Add workflow --- .github/workflows/compile.yml | 37 +++++++++++++++++++++++++++++ .github/workflows/cross_compile.yml | 23 ++++-------------- 2 files changed, 41 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/compile.yml diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml new file mode 100644 index 00000000..95a44dde --- /dev/null +++ b/.github/workflows/compile.yml @@ -0,0 +1,37 @@ +name: Compile on amd64 + +on: + workflow_call: + inputs: + connect-type: + required: true + type: string + debug-flag: + required: false + type: boolean + +jobs: + build: + runs-on: ubuntu-22.04 + defaults: + run: + working-directory: cpp + env: + TOOLCHAIN: "g++-" + LIBRARIES: "libspdlog-dev libpcap-dev protobuf-compiler libprotobuf-dev" + steps: + - uses: actions/checkout@v3 + + - name: Update apt + run: sudo apt update + + - name: Install apt packages + run: sudo apt-get --yes install ${{ env.TOOLCHAIN }} ${{ env.LIBRARIES }} + + - name: Build debug strings + if: ${{ inputs.debug-flag }} + run: | + echo "debug_flag_compile=DEBUG\=1" >> $GITHUB_ENV + + - name: Compile + run: make all -j $(nproc) CONNECT_TYPE=${{ inputs.connect-type }} ${{ env.debug_flag_compile }} diff --git a/.github/workflows/cross_compile.yml b/.github/workflows/cross_compile.yml index 5f53f6e7..aa2249fd 100644 --- a/.github/workflows/cross_compile.yml +++ b/.github/workflows/cross_compile.yml @@ -1,24 +1,23 @@ name: Cross-compile for arm on: - workflow_call: + workflow_dispatch: inputs: connect-type: required: true type: string - # Debug flag indicates whether to build a debug build (no optimization, debugger symbols) debug-flag: required: false type: boolean jobs: - build_arm: + build: runs-on: ubuntu-22.04 defaults: run: working-directory: cpp env: - APT_ARM_TOOLCHAIN: "gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf libspdlog-dev" + APT_ARM_TOOLCHAIN: "g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf" APT_LIBRARIES: "libspdlog-dev:armhf libpcap-dev:armhf protobuf-compiler libprotobuf-dev:armhf" steps: - uses: actions/checkout@v3 @@ -45,20 +44,6 @@ jobs: if: ${{ inputs.debug-flag }} run: | echo "debug_flag_compile=DEBUG\=1" >> $GITHUB_ENV - echo "debug_flag_filename=debug-" >> $GITHUB_ENV - name: Compile - run: make all -j -j $(nproc) CONNECT_TYPE=${{ inputs.connect-type }} ${{ env.debug_flag_compile }} CROSS_COMPILE=arm-linux-gnueabihf- - - # We need to tar the binary outputs to retain the executable - # file permission. Currently, actions/upload-artifact only - # supports .ZIP files. - # This is workaround for https://github.com/actions/upload-artifact/issues/38 - - name: Tar binary output - run: tar -czvf ${{ env.debug_flag_filename }}piscsi-${{ inputs.connect-type }}.tar.gz ./bin - - - name: Upload binaries - uses: actions/upload-artifact@v3 - with: - name: ${{ env.debug_flag_filename }}arm-binaries-${{ inputs.connect-type }}.tar.gz - path: cpp/${{ env.debug_flag_filename }}piscsi-${{ inputs.connect-type }}.tar.gz + run: make all -j $(nproc) CONNECT_TYPE=${{ inputs.connect-type }} ${{ env.debug_flag_compile }} CROSS_COMPILE=arm-linux-gnueabihf-