2022-11-18 13:58:26 +00:00
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
connect-type:
|
|
|
|
required: true
|
|
|
|
type: string
|
2022-12-04 04:40:19 +00:00
|
|
|
# Debug flag indicates whether to build a debug build (no optimization, debugger symbols)
|
|
|
|
debug-flag:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
2022-11-18 13:58:26 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build_arm:
|
|
|
|
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_LIBRARIES: "libspdlog-dev:armhf libpcap-dev:armhf libevdev2:armhf libev-dev:armhf protobuf-compiler libprotobuf-dev:armhf"
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Add armhf as architecture
|
|
|
|
run: sudo dpkg --add-architecture armhf
|
|
|
|
|
|
|
|
- name: Reconfigure apt for arch amd64
|
|
|
|
run: sudo sed -i "s/deb /deb [arch=amd64] /g" /etc/apt/sources.list
|
|
|
|
|
|
|
|
- name: Add armhf repos (jammy)
|
|
|
|
run: sudo bash -c "echo \"deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy main multiverse restricted universe\" >> /etc/apt/sources.list"
|
|
|
|
|
|
|
|
- name: Add armhf repos (jammy-updates)
|
|
|
|
run: sudo bash -c "echo \"deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main multiverse restricted universe\" >> /etc/apt/sources.list"
|
|
|
|
|
|
|
|
- name: Update apt
|
|
|
|
run: sudo apt update
|
|
|
|
|
|
|
|
- name: Install apt packages
|
|
|
|
run: sudo apt-get --yes install ${{ env.APT_ARM_TOOLCHAIN }} ${{ env.APT_LIBRARIES }}
|
|
|
|
|
2022-12-04 04:40:19 +00:00
|
|
|
- name: Build debug strings
|
|
|
|
if: ${{ inputs.debug-flag }}
|
|
|
|
run: |
|
|
|
|
echo "debug_flag_compile=DEBUG\=1" >> $GITHUB_ENV
|
|
|
|
echo "debug_flag_filename=debug-" >> $GITHUB_ENV
|
|
|
|
|
2022-11-18 13:58:26 +00:00
|
|
|
- name: Compile
|
2022-12-04 04:40:19 +00:00
|
|
|
run: make all -j 6 CONNECT_TYPE=${{ inputs.connect-type }} ${{ env.debug_flag_compile }} CROSS_COMPILE=arm-linux-gnueabihf-
|
2022-11-18 13:58:26 +00:00
|
|
|
|
|
|
|
# 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
|
2022-12-05 17:58:23 +00:00
|
|
|
run: tar -czvf ${{ env.debug_flag_filename }}piscsi-${{ inputs.connect-type }}.tar.gz ./bin
|
2022-11-18 13:58:26 +00:00
|
|
|
|
|
|
|
- name: Upload binaries
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2022-12-04 04:40:19 +00:00
|
|
|
name: ${{ env.debug_flag_filename }}arm-binaries-${{ inputs.connect-type }}.tar.gz
|
2022-12-05 17:58:23 +00:00
|
|
|
path: cpp/${{ env.debug_flag_filename }}piscsi-${{ inputs.connect-type }}.tar.gz
|