Inkycal/.github/workflows/update-os.yml

114 lines
4.5 KiB
YAML
Raw Normal View History

2024-02-14 09:21:49 +01:00
name: build
2023-08-18 01:19:24 +02:00
on:
workflow_dispatch:
jobs:
test-on-arm:
name: Update OS
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Build Raspberry Pi OS
uses: pguyot/arm-runner-action@v2
id: build_image
env:
INKY_INITAL_PASSWORD: ${{ secrets.INKY_INITAL_PASSWORD }}
OPENWEATHERMAP_API_KEY: ${{ secrets.OPENWEATHERMAP_API_KEY }}
SAMPLE_ICAL_URL: ${{ secrets.SAMPLE_ICAL_URL }}
TEST_ICAL_URL: ${{ secrets.TEST_ICAL_URL }}
TODOIST_API_KEY: ${{ secrets.TODOIST_API_KEY }}
2024-02-19 13:00:03 +01:00
TINDIE_API_KEY: ${{ secrets.TINDIE_API_KEY }}
TINDIE_USERNAME: ${{ secrets.TINDIE_USERNAME }}
2023-08-18 01:19:24 +02:00
with:
# Set the base_image to the desired Raspberry Pi OS version
base_image: https://downloads.raspberrypi.com/raspios_lite_armhf/images/raspios_lite_armhf-2024-03-15/2024-03-15-raspios-bookworm-armhf-lite.img.xz
2024-07-02 02:09:32 +02:00
image_additional_mb: 3072 # enlarge free space to 3 GB
2024-07-02 02:29:14 +02:00
optimize_image: true
2023-08-18 01:19:24 +02:00
commands: |
cd /home
sudo useradd -m -p "$(openssl passwd -1 $INKY_INITAL_PASSWORD)" inky
sudo usermod -a -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi inky
sudo su inky
echo $HOME
2024-03-24 17:17:33 +01:00
# get kernel info
uname -srm
2023-08-18 01:19:24 +02:00
cd /home/inky
sudo apt-get update -y
2024-04-29 14:25:36 +02:00
# sudo apt-get dist-upgrade -y
2024-02-13 15:36:07 +01:00
2023-08-18 01:19:24 +02:00
sudo apt-get install -y python3-pip
2024-07-02 01:19:40 +02:00
sudo apt-get install git zlib1g libjpeg-dev libatlas-base-dev rustc libopenjp2-7 python3-dev scons libssl-dev python3-venv python3-pip git libfreetype6-dev wkhtmltopdf libopenblas-dev libxml2-dev libxslt-dev python-dev-is-python3 -y
# #334 & #335
git clone https://github.com/WiringPi/WiringPi
cd WiringPi
./build
cd ..
2023-08-18 01:19:24 +02:00
echo $PWD && ls
2024-01-10 14:47:48 +01:00
git clone https://github.com/aceinnolab/Inkycal
2023-08-18 01:19:24 +02:00
cd Inkycal
2024-02-14 09:38:04 +01:00
python3 -m venv venv
2023-08-18 01:19:24 +02:00
. venv/bin/activate
python -m pip install --upgrade pip
pip install wheel
pip install -e ./
2023-12-21 16:54:23 +01:00
pip install RPi.GPIO==0.7.1 spidev==3.5 gpiozero==2.0
2023-08-18 01:19:24 +02:00
wget https://raw.githubusercontent.com/aceinnolab/Inkycal/assets/tests/settings.json
2023-11-08 18:06:11 +01:00
pip install pytest
python -m pytest
2023-08-18 01:19:24 +02:00
2023-09-02 15:03:56 +02:00
# install deps for 12.48" display
2024-02-13 15:36:07 +01:00
wget https://github.com/aceinnolab/Inkycal/raw/assets/tests/bcm2835-1.71.tar
2024-02-19 14:24:16 +01:00
tar -xf bcm2835-1.71.tar
2023-09-02 15:03:56 +02:00
cd bcm2835-1.71/
sudo ./configure && sudo make && sudo make check && sudo make install
cd ..
echo $CWD
# increase swap-size
2024-07-02 02:51:01 +02:00
# temporarily disabled due to unmounting issues
# sudo dphys-swapfile swapoff
# sudo sed -i -E '/^CONF_SWAPSIZE=/s/=.*/=512/' /etc/dphys-swapfile
# sudo dphys-swapfile setup
# sudo dphys-swapfile swapon
2023-09-02 15:03:56 +02:00
2023-08-18 01:19:24 +02:00
# enable SPI
sudo sed -i s/#dtparam=spi=on/dtparam=spi=on/ /boot/config.txt
2023-08-18 01:19:24 +02:00
# enable inkycal start at boot
sudo -u inky bash -c 'echo "@reboot sleep 60 && cd /home/inky/Inkycal && venv/bin/python inky_run.py &" | crontab -'
sudo chown inky:crontab /var/spool/cron/crontabs/inky
# fix permissions of Inkycal folder recursively
sudo chown -R inky:inky /home/inky/Inkycal
# make all users require a password for sudo commands (improves security)
2024-07-02 01:35:24 +02:00
# temporarily disabled to allow pisugar support
# echo 'ALL ALL=(ALL:ALL) PASSWD: ALL' | sudo tee -a /etc/sudoers.d/010_require_sudo_password
2024-03-24 12:12:10 +01:00
# allow some time to unmount
2024-07-02 02:51:01 +02:00
sleep 10
2023-08-18 01:19:24 +02:00
- name: Compress the release image
run: |
2024-03-24 12:12:10 +01:00
# allow some time to unmount
sleep 10
2023-12-21 20:09:40 +01:00
mv ${{ steps.build_image.outputs.image }} InkycalOS_Lite.img
xz -0 -T 0 -v InkycalOS_Lite.img
2023-08-18 01:19:24 +02:00
- name: Get latest release version
run: |
export tag="$(curl -s https://api.github.com/repos/aceinnolab/Inkycal/releases/latest | jq -r '.tag_name')"
echo "version=${tag}" >> $GITHUB_ENV
- name: Upload Raspberry Pi OS Image
if: success() # Only upload the image if the tests were successful
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.version }}
2023-12-21 20:24:35 +01:00
files: InkycalOS_Lite.img.xz