-
Notifications
You must be signed in to change notification settings - Fork 148
Install github runner on pynq
To auto test QICK or other software on an actual RFSoC board running a pynq linux kernel, we have installed the github runner software on a ZCU111. This page outlines the steps taken to install and configure your own runner on a RFSoC board or pynq.
To install the github runner, from the home page of the repository, navigate from the Actions tab to Runners (left menu) > New Runner (button) > New Self-hosted Runner (Button). Here you'll find directions for installing the runner which depend on the operating system and architectures. For RFSoC and pynq, choose Linux and Arm64. This will then give the following instructions which should be executed from an ssh session on the board.
mkdir actions-runner && cd actions-runner
curl -o actions-runner-linux-arm64-2.311.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.311.0/actions-runner-linux-arm64-2.311.0.tar.gz
tar xzf ./actions-runner-linux-arm64-2.311.0.tar.gz
cd actions-runner
./config.cmd --url https://github.com/openquantumhardware/qick --token {token}
While this configuration script runs, you can assign a custom tag to this machine which can be used on the github actions script to indicate that certain actions will be run on machines with this tag (which ever is available first). For the ZCU111, we used the tag zcu111.
After the configuration script is complete, you can test that you're actually connecting with github by running the command:
./run.sh
Your runner should also show up under Actions > Runners > Self-Hosted Runners as connected to the repo.
For some reason, actions running on our pynq-runner don't have admin rights to run commands. To change this, we give password-less sudo to the default user xilinx. We do this by first accessing the /etc/sudoers.tmp file through
sudo visudo
And in this line, we add the following two lines:
xilinx ALL= NOPASSWD: /usr/local/share/pynq_venv_bin/python
xilinx ALL= NOPASSWD: /user/bin/rm
Followed by a save an exit.
Additionally, (or alternatively?) when the runner is operating as a service, we have further issues with asking for sudo permission. This is solved by making a SUDO_ASKPASS environment variable, which points to a file that returns the password when asked via a sudo -A command.
This is accomplished by making a file
~/.supwd.sh
with contents
#!/bin/bash
echo 'xilinx'
and, to ~/.bash_profile the following lines:
export SUDO_ASKPASS=${HOME}/.supwd.sh
For more straightforward scripting, we change the default python environment to pynq python environment via:
sudo nano /etc/profile.d/python.d
and adding the line
`PATH=/usr/local/share/pynq_venv/bin/python3:$PATH
For some reason, the easiest way to install nbmake is to use the qick installation notebook Then, we can install the pytest extension nbmake, and run the notebooks using pytest
cd /home/xilinx/jupyternotebooks
git clone https://github.com/openquantumhardware/qick.git
Then, using your browser, navigate to the ip address of the board, go to qick/qick_demos/000_Install_qick_package.ipynb
In cell 2, under !pip3 install -e ../, add the line
!pip3 install nbmake
and run the cell.
Now the github actions should run as prescribed by our test_zcu111.md example (printed at the bottom of this file). However, this requires that we have an ssh terminal window open. Therefore, we setup the runner as a service in the next section.
Stop the self hosted runner if it's running. Then, from the actions-runner folder, run
sudo ./svc.sh install
The runner as a service uses different environment variables than the standard terminal session, therefore we need to modify the actions-runner/.env file to contain the following lines:
SUDO_ASKPASS=/home/xilinx/.supwd.sh
BOARD=ZCU111
XILINX_XTR=/usr
Note that the BOARD variable will depend on the actual board for the pynq-runner.
To execute the pynq-runner as a daemon, automatically starting on boot. we make an modify the service file by
sudo touch /etc/systemd/system/actions-runner.service
sudo nano /etch/systemd/system/actions-runner.service
and enter the following text
[Unit]
Description=Github Runner
After=network.target
[Service]
ExecStart=/home/xilinx/actions-runner/runsvc.sh
User=xilinx
WorkingDirectory=/home/xilinx/actions-runner
KillMode=process
KillSignal=SIGTERM
TimeoutStopSec=5min
[Install]
WantedBy=multi-user.target
Finally to start the pynq-runner, we execute reload, enable, and start commands:
sudo systemctl daemon-reload
sudo systemctl enable actions-runner.service
sudo systemctl start actions-runner.service