Inkycal/.github/workflows/tests.yml

126 lines
3.9 KiB
YAML
Raw Normal View History

2023-01-20 01:09:13 +01:00
name: Inkycal testing
2020-05-16 08:22:57 +02:00
2023-01-20 01:09:13 +01:00
on:
push:
branches:
- main
2023-06-03 19:03:09 +02:00
2020-05-16 08:22:57 +02:00
jobs:
2023-07-24 12:12:43 +02:00
update-docs:
name: update docs
2020-05-16 08:22:57 +02:00
runs-on: ubuntu-latest
2023-07-24 10:44:44 +02:00
2020-05-16 08:22:57 +02:00
steps:
2023-06-03 19:53:42 +02:00
- name: Checkout Repository
uses: actions/checkout@v3
2023-06-03 20:07:57 +02:00
with:
ref: main
2023-06-03 19:53:42 +02:00
2023-06-03 19:03:09 +02:00
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
2020-06-17 14:54:48 +02:00
2023-06-03 19:53:42 +02:00
- name: Install Dependencies
2023-06-03 19:03:09 +02:00
run: |
2023-06-03 19:53:42 +02:00
python3 -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip install wheel
2023-06-03 20:00:09 +02:00
pip install -e .
2023-06-03 20:31:58 +02:00
cd ..
2023-07-24 11:37:27 +02:00
- name: Generate Docs
run: |
sudo apt-get install python3-sphinx
pip install sphinxemoji sphinx_rtd_theme recommonmark
cd docsource
make html && make github && cd ..
2023-07-24 13:05:07 +02:00
- name: Check if there are any changes
id: verify_diff
run: |
git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT
2023-07-24 11:37:27 +02:00
- name: push docs
2023-07-24 13:05:07 +02:00
if: steps.verify_diff.outputs.changed == 'true'
2023-07-24 11:37:27 +02:00
run: |
2023-07-24 12:12:43 +02:00
git config user.name "github-actions"
git config user.email "actions@github.com"
2023-07-24 11:37:27 +02:00
git add docs/*
2023-07-24 13:05:07 +02:00
git commit -m "update docs [bot]"
2023-07-24 11:37:27 +02:00
git push
2023-06-03 20:00:09 +02:00
2023-07-23 03:23:24 +02:00
test-on-arm:
name: Run Tests on Raspberry Pi OS
2023-07-24 12:12:43 +02:00
needs: update-docs
2023-06-03 19:53:42 +02:00
runs-on: ubuntu-latest
2023-07-23 21:47:41 +02:00
permissions:
contents: write
2023-06-03 19:53:42 +02:00
steps:
2023-07-23 03:23:24 +02:00
- name: Run Tests on Raspberry Pi OS
2023-07-26 03:19:13 +02:00
uses: pguyot/arm-runner-action@v2
2023-07-23 13:13:44 +02:00
id: build_image
2023-07-23 10:27:35 +02:00
env:
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 }}
2023-07-23 03:23:24 +02:00
with:
# Set the base_image to the desired Raspberry Pi OS version
2023-07-26 03:19:13 +02:00
base_image: https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2023-05-03/2023-05-03-raspios-bullseye-armhf-lite.img.xz
2023-07-24 13:13:31 +02:00
image_additional_mb: 1500 # enlarge free space to 1.5 GB
2023-07-26 01:58:26 +02:00
optimize_image: true
2023-07-26 03:19:13 +02:00
user: inky
2023-07-23 03:23:24 +02:00
commands: |
2023-07-26 03:42:24 +02:00
cd /home
2023-07-26 03:19:13 +02:00
echo $PWD && ls
2023-07-26 03:42:24 +02:00
sudo useradd -m -p ${{ secrets.INKY_INITAL_PASSWORD }} inky
2023-07-26 01:58:26 +02:00
sudo usermod -a -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi inky
2023-07-26 02:36:52 +02:00
su - inky
2023-07-26 01:58:26 +02:00
sudo apt-get update -y
sudo apt-get install -y python3-pip
2023-07-23 09:43:35 +02:00
sudo apt-get install zlib1g libjpeg-dev libatlas-base-dev rustc libopenjp2-7 python3-dev scons libssl-dev python3-venv python3-pip git libfreetype6-dev -y
2023-07-26 03:19:13 +02:00
echo $PWD && ls
2023-07-26 02:58:26 +02:00
cd /home/inky
2023-07-26 02:36:52 +02:00
- name: Clone Inkycal repo
uses: actions/checkout@v3
with:
ref: main
- name: install requirements and run tests
run: |
ls
2023-07-26 02:58:26 +02:00
cd /home/inky/Inkycal
2023-07-26 02:36:52 +02:00
. venv/bin/activate
python -m pip install --upgrade pip
pip install wheel
pip install -e ./
cd inkycal/tests
echo $PWD
wget https://raw.githubusercontent.com/aceinnolab/Inkycal/assets/tests/settings.json
for f in *.py; do python3 "$f"; done
2023-07-23 13:13:44 +02:00
- name: Compress the release image
run: |
mv ${{ steps.build_image.outputs.image }} inkycal_os.img
xz -0 -T 0 -v inkycal_os.img
2023-07-23 20:46: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
2023-07-23 03:23:24 +02:00
- name: Upload Raspberry Pi OS Image
if: success() # Only upload the image if the tests were successful
2023-07-23 13:13:44 +02:00
uses: softprops/action-gh-release@v1
2023-07-23 20:46:24 +02:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2023-07-23 03:23:24 +02:00
with:
2023-07-23 20:46:24 +02:00
tag_name: ${{ env.version }}
2023-07-23 22:59:52 +02:00
files: inkycal_os.img.xz
2023-06-03 19:53:42 +02:00
2023-07-24 11:37:27 +02:00