Skip to content

Commit

Permalink
add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
Kethen committed Aug 24, 2024
1 parent 2cabb47 commit c6862ec
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 11 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build package

on: [ push, pull_request, workflow_dispatch ]

# written referencing apollo save tool psp's CI

jobs:
build_pkg:
runs-on: ubuntu-22.04
steps:

- name: Checkout
uses: actions/checkout@v3

- name: Install podman and qemu
run: |
sudo apt update
sudo apt install -y qemu-user-static podman
- name: Set env vars
run: |
echo "sha_name=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV
- name: Build
run: |
bash build_podman.sh
- name: Push package artifact
uses: actions/upload-artifact@v3
with:
name: lg4ff_userspace_${{ env.sha_name }}
path: |
lg4ff_userspace_386
lg4ff_userspace_usb_386
lg4ff_userspace_amd64
lg4ff_userspace_usb_amd64
lg4ff_userspace_arm64
lg4ff_userspace_usb_arm64
lg4ff_userspace_arm
lg4ff_userspace_usb_arm
60-lg4ff-userspace.rules
60-lg4ff-userspace-usb.rules
logitech-hid.conf
if-no-files-found: error
26 changes: 16 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ set -xe
CC=${CC:-gcc}
CPPC=${CC:-g++}

$CC -g -c probe.c -o probe.o
$CC -g -c device_ids.c -o device_ids.o
$CC -g -c driver_loops.c -o driver_loops.o
$CC -g -c switch_mode.c -o switch_mode.o
$CC -g -c configure.c -o configure.o
$CC -g -c force_feedback.c -o force_feedback.o
$CC -g -c main.c -o main.o
$CC probe.o device_ids.o driver_loops.o switch_mode.o configure.o force_feedback.o main.o -o lg4ff_userspace -lhidapi-hidraw -lm
$CC probe.o device_ids.o driver_loops.o switch_mode.o configure.o force_feedback.o main.o -o lg4ff_userspace_usb -lhidapi-libusb -lm
if [ "$DEBUG" == "true" ]
then
$CC -g -c probe.c -o probe.o
$CC -g -c device_ids.c -o device_ids.o
$CC -g -c driver_loops.c -o driver_loops.o
$CC -g -c switch_mode.c -o switch_mode.o
$CC -g -c configure.c -o configure.o
$CC -g -c force_feedback.c -o force_feedback.o
$CC -g -c main.c -o main.o
$CC probe.o device_ids.o driver_loops.o switch_mode.o configure.o force_feedback.o main.o -o lg4ff_userspace -lhidapi-hidraw -lm
$CC probe.o device_ids.o driver_loops.o switch_mode.o configure.o force_feedback.o main.o -o lg4ff_userspace_usb -lhidapi-libusb -lm
else
$CC probe.c device_ids.c driver_loops.c switch_mode.c configure.c force_feedback.c main.c -O2 -o lg4ff_userspace -lhidapi-hidraw -lm
$CC probe.c device_ids.c driver_loops.c switch_mode.c configure.c force_feedback.c main.c -O2 -o lg4ff_userspace_usb -lhidapi-libusb -lm
fi

rm *.o
rm -f *.o
3 changes: 2 additions & 1 deletion build_podman.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set -e

for arch in i386 amd64 arm64 arm
for arch in 386 amd64 arm64 arm
do
podman run --rm -it \
--security-opt label=disable \
Expand All @@ -16,6 +16,7 @@ do
apt install -y gcc libhidapi-dev
bash build.sh
'
arch=$(echo $arch | sed 's#/##g')
mv lg4ff_userspace lg4ff_userspace_${arch}
mv lg4ff_userspace_usb lg4ff_userspace_usb_${arch}
done

0 comments on commit c6862ec

Please sign in to comment.