Skip to content

Commit

Permalink
try to emulate rpi
Browse files Browse the repository at this point in the history
  • Loading branch information
atticusrussell committed Jun 20, 2023
1 parent cc758ce commit f82cf24
Showing 1 changed file with 47 additions and 50 deletions.
97 changes: 47 additions & 50 deletions .github/workflows/ci-industrial.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,62 @@
# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git).
# For troubleshooting, see README (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst)

name: CI Industrial

on: # this determines when this workflow is run
on:
push:
# branches: [ master, melodic-devel ] # when master or melodic-devel branch is pushed to
pull_request:
# branches: [ master ] # when there is a pull request against master
# schedule: # uncomment to run periodically
# - cron: '0 4 * * *' # every day at 4 AM (UTC)
workflow_dispatch: # allow manually starting this workflow
workflow_dispatch:

jobs:
industrial_ci:
name: ROS ${{ matrix.ROS_DISTRO }} (${{ matrix.ROS_REPO }})
runs-on: ubuntu-latest
strategy:
# fail-fast: false # uncomment if failing jobs should not cancel the others immediately
matrix: # matrix is the product of entries
matrix:
ROS_DISTRO: [humble, rolling]
ROS_REPO: [main]
# exclude: # specific configuration can be excludes
# - {ROS_DISTRO: melodic, ROS_REPO: testing}
# include: # add additional configurations
# - {ROS_DISTRO: kinetic, ROS_REPO: testing}
env:
CCACHE_DIR: "${{ github.workspace }}/.ccache" # directory for ccache (and how we enable ccache in industrial_ci)
CCACHE_DIR: "${{ github.workspace }}/.ccache"
steps:
- name: Set current directory
run: echo "CURRENT_DIR=$(pwd)" >> $GITHUB_ENV
- name: Install pigpio library
run: |
cd ~
wget https://github.com/joan2937/pigpio/archive/master.zip
unzip master.zip
cd pigpio-master
make
sudo make install
pwd
ls -la
sudo pigpiod # start daemon
./x_pigpiod_if2 # check C I/F to daemon
./x_pigs # check pigs I/F to daemon
./x_pipe # check pipe I/F to daemon
# - name: Go back to prev directory
# run: cd $CURRENT_DIR
# - uses: actions/checkout@v3 # clone target repository

# - uses: actions/cache@v2 # fetch/store the directory used by ccache before/after the ci run
# with:
# path: ${{ env.CCACHE_DIR }}
# # This configuration will always create a new ccache cache starting off from the previous one (if any).
# # In this simple version it will be shared between all builds of the same ROS_REPO and ROS_REPO
# # and might need some fine-tuning to match the use case
# key: ccache-${{ matrix.ROS_DISTRO }}-${{ matrix.ROS_REPO }}-${{github.run_id}}
# restore-keys: |
# ccache-${{ matrix.ROS_DISTRO }}-${{ matrix.ROS_REPO }}-
# - uses: 'ros-industrial/industrial_ci@master' # run industrial_ci
# env: # either pass all entries explicitly
# ROS_DISTRO: ${{ matrix.ROS_DISTRO }}
# ROS_REPO: ${{ matrix.ROS_REPO }}
# # with: # or pass the full matrix as config
# # config: ${{toJSON(matrix)}}
- name: Set current directory
run: echo "CURRENT_DIR=$(pwd)" >> $GITHUB_ENV
- name: Emulate Raspberry Pi 3B with Ubuntu 22.04 using QEMU
run: |
wget https://cdimage.ubuntu.com/releases/22.04/release/ubuntu-22.04.2-preinstalled-desktop-arm64+raspi.img.xz
xz -d ubuntu-22.04-preinstalled-server-arm64+raspi.img.xz
qemu-img resize ubuntu-22.04-preinstalled-server-arm64+raspi.img +8G
qemu-system-aarch64 -machine type=raspi3 -m 1024 -kernel vmlinux -initrd initramfs -drive file=ubuntu-22.04-preinstalled-server-arm64+raspi.img,format=raw -append "root=/dev/mmcblk0p2 rw rootwait console=ttyAMA0,115200 console=tty1 selinux=0 plymouth.enable=0 smsc95xx.macaddr=DC:A6:32:01:5C:B7 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0"
- name: Install pigpio library on the emulated Pi
run: |
echo '#!/bin/bash' > install_pigpio.sh
echo 'cd ~' >> install_pigpio.sh
echo 'wget https://github.com/joan2937/pigpio/archive/master.zip' >> install_pigpio.sh
echo 'unzip master.zip' >> install_pigpio.sh
echo 'cd pigpio-master' >> install_pigpio.sh
echo 'make' >> install_pigpio.sh
echo 'sudo make install' >> install_pigpio.sh
echo 'sudo ./x_pigpio # check C I/F' >> install_pigpio.sh
echo 'sudo pigpiod # start daemon' >> install_pigpio.sh
echo './x_pigpiod_if2 # check C I/F to daemon' >> install_pigpio.sh
echo './x_pigpio.py # check Python I/F to daemon' >> install_pigpio.sh
echo './x_pigs # check pigs I/F to daemon' >> install_pigpio.sh
echo './x_pipe # check pipe I/F to daemon' >> install_pigpio.sh
chmod +x install_pigpio.sh
qemu-system-aarch64 -machine type=raspi3 -m 1024 -kernel vmlinux -initrd initramfs -init /home/user/install_pigpio.sh
- uses: actions/checkout@v3 # clone target repository

- uses: actions/cache@v2 # fetch/store the directory used by ccache before/after the ci run
with:
path: ${{ env.CCACHE_DIR }}
# This configuration will always create a new ccache cache starting off from the previous one (if any).
# In this simple version it will be shared between all builds of the same ROS_REPO and ROS_REPO
# and might need some fine-tuning to match the use case
key: ccache-${{ matrix.ROS_DISTRO }}-${{ matrix.ROS_REPO }}-${{github.run_id}}
restore-keys: |
ccache-${{ matrix.ROS_DISTRO }}-${{ matrix.ROS_REPO }}-
- uses: 'ros-industrial/industrial_ci@master' # run industrial_ci
env: # either pass all entries explicitly
ROS_DISTRO: ${{ matrix.ROS_DISTRO }}
ROS_REPO: ${{ matrix.ROS_REPO }}
# with: # or pass the full matrix as config
# config: ${{toJSON(matrix)}}

0 comments on commit f82cf24

Please sign in to comment.