This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build for Raspberry Pi 3 with raylib (static) | |
on: | |
push: | |
branches: | |
- main | |
- github-actions | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y \ | |
qemu-utils qemu-user-static debootstrap \ | |
gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \ | |
make cmake | |
sudo chmod u+s /bin/tar | |
- name: Restore cache sysroot | |
id: restore-cache-sysroot | |
uses: actions/cache/restore@v4 | |
with: | |
path: ./sysroot | |
key: sysroot-buster-2 | |
- name: Create sysroot for Raspbian Buster | |
if: steps.restore-cache-sysroot.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p ./sysroot | |
sudo debootstrap --arch=armhf --foreign buster ./sysroot http://raspbian.raspberrypi.org/raspbian/ | |
sudo cp /usr/bin/qemu-arm-static ./sysroot/usr/bin/ | |
sudo chroot ./sysroot /debootstrap/debootstrap --second-stage | |
sudo chroot ./sysroot apt update | |
sudo chroot ./sysroot apt install -y libgbm-dev libasound2-dev libdrm-dev libegl1-mesa-dev libgles2-mesa-dev libgbm-dev libdrm-dev build-essential | |
- name: Save cache sysroot | |
if: steps.restore-cache-sysroot.outputs.cache-hit != 'true' | |
id: save-cache-sysroot | |
uses: actions/cache/save@v4 | |
with: | |
path: ./sysroot | |
key: sysroot-buster-2 | |
- name: Build raylib (static) for Raspberry Pi | |
run: | | |
export SYSROOT=$(pwd)/sysroot | |
git clone --depth 1 https://github.com/raysan5/raylib.git | |
cd raylib/src | |
echo $SYSROOT | |
ls ../../sysroot/usr/include | |
make PLATFORM=PLATFORM_DRM USE_RPI_CROSS_COMPILER=TRUE RPI_TOOLCHAIN=/usr RPI_TOOLCHAIN_NAME=arm-linux-gnueabihf INCLUDE_PATHS=' -nostdinc -I . -I ../../sysroot/usr/lib/gcc/arm-linux-gnueabihf/8/include -I ../../sysroot/usr/include/arm-linux-gnueabihf/ -I ../../sysroot/usr/include -I ../../sysroot/usr/include/libdrm' | |
- name: Build the project | |
run: | | |
export SYSROOT=$(pwd)/sysroot | |
make SYSROOT=$SYSROOT | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: rpi3-binary | |
path: ./snake_animation | |