feat(test): add Dockerfile support with CI env (#8209)

This commit is contained in:
André Costa
2025-05-12 20:00:43 +02:00
committed by GitHub
parent 037ddc7045
commit e0b65f78cc
5 changed files with 94 additions and 17 deletions
+6 -10
View File
@@ -5,15 +5,11 @@
# here, such as MicroPython and PC simulator packages.
#
# Note: This script is run by the CI workflows.
SCRIPT_PATH=$(readlink -f $0)
SCRIPT_DIR=$(dirname $SCRIPT_PATH)
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install gcc gcc-multilib g++-multilib ninja-build \
libpng-dev libjpeg-turbo8-dev libfreetype6-dev \
libglew-dev libglfw3-dev libsdl2-dev \
libpng-dev:i386 libjpeg-dev:i386 libfreetype6-dev:i386 \
ruby-full gcovr cmake python3 libinput-dev libxkbcommon-dev \
libdrm-dev pkg-config wayland-protocols libwayland-dev libwayland-bin \
libwayland-dev:i386 libxkbcommon-dev:i386 libudev-dev \
libavformat-dev libavcodec-dev libswscale-dev libavutil-dev \
libavformat-dev:i386 libavcodec-dev:i386 libswscale-dev:i386 libavutil-dev:i386
pip3 install pypng lz4 kconfiglib
cat $SCRIPT_DIR/prerequisites-apt.txt | xargs sudo apt install -y
pip3 install --user -r $SCRIPT_DIR/prerequisites-pip.txt
+37
View File
@@ -0,0 +1,37 @@
git
gcc
gcc-multilib
g++-multilib
ninja-build
libpng-dev
libjpeg-turbo8-dev
libfreetype6-dev
libglew-dev
libglfw3-dev
libsdl2-dev
libpng-dev:i386
libjpeg-dev:i386
libfreetype6-dev:i386
ruby-full
gcovr
cmake
python3
python3-pip
libinput-dev
libxkbcommon-dev
libdrm-dev
pkg-config
wayland-protocols
libwayland-dev
libwayland-bin
libwayland-dev:i386
libxkbcommon-dev:i386
libudev-dev
libavformat-dev
libavcodec-dev
libswscale-dev
libavutil-dev
libavformat-dev:i386
libavcodec-dev:i386
libswscale-dev:i386
libavutil-dev:i386
+3
View File
@@ -0,0 +1,3 @@
pypng
lz4
kconfiglib
+24
View File
@@ -0,0 +1,24 @@
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
RUN dpkg --add-architecture i386
RUN apt update
COPY ./scripts/prerequisites-apt.txt .
COPY ./scripts/prerequisites-pip.txt .
RUN cat prerequisites-apt.txt | xargs apt install -y
RUN pip install --break-system-packages -r prerequisites-pip.txt
RUN git clone https://github.com/kornelski/pngquant && \
cd pngquant && \
git checkout 2.17.0 && \
./configure && \
make -j$(nproc) && \
make install
RUN rm -rf pngquant
WORKDIR /work
+24 -7
View File
@@ -4,21 +4,20 @@ The tests in the folder can be run locally and automatically by GitHub CI.
## Running locally
### Requirements (Linux)
### Local
Install requirements by:
1. Install requirements by:
```sh
scripts/install-prerequisites.sh
```
### Run test
1. Run all executable tests with `./tests/main.py test`.
2. Build all build-only tests with `./tests/main.py build`.
3. Clean prior test build, build all build-only tests,
2. Run all executable tests with `./tests/main.py test`.
3. Build all build-only tests with `./tests/main.py build`.
4. Clean prior test build, build all build-only tests,
run executable tests, and generate code coverage
report `./tests/main.py --clean --report build test`.
4. You can re-generate the test images by adding option `--update-image`.
5. You can re-generate the test images by adding option `--update-image`.
It relies on scripts/LVGLImage.py, which requires pngquant and pypng.
You can run below command firstly and follow instructions in logs to install them.
`./tests/main.py --update-image test`
@@ -27,6 +26,24 @@ scripts/install-prerequisites.sh
For full information on running tests run: `./tests/main.py --help`.
### Docker
To run the tests in an environment matching the CI setup:
1. Build it
```bash
docker build . -f tests/Dockerfile -t lvgl_test_env
```
2. Run the tests
```bash
docker run --rm -it -v $(pwd):/work lvgl_test_env "./tests/main.py"
```
This ensures you are testing in a consistent environment with the same dependencies as the CI pipeline.
## Running automatically
GitHub's CI automatically runs these tests on pushes and pull requests to `master` and `releasev8.*` branches.