mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-09 20:27:41 +08:00
feat(test): add Dockerfile support with CI env (#8209)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,3 @@
|
||||
pypng
|
||||
lz4
|
||||
kconfiglib
|
||||
@@ -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
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user