Skip to content

Commit

Permalink
Add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Nov 30, 2023
1 parent 9cc0b1f commit f825cb5
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 19 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -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 }}
23 changes: 4 additions & 19 deletions .github/workflows/cross_compile.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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-

0 comments on commit f825cb5

Please sign in to comment.