Skip to content

Commit 6d0a7ed

Browse files
committed
Add CI resources based on Robot-Framework
* Include Docker setup and scripts (`Dockerfile`, `install-requirements.sh`, `podman-compose.sh`, `prepare-board.sh`). * Add initial Robot Framework resources, tests, and test setup files. * Integrate scripts for touch events and video performance testing with Robot Framework. * Add `conf/nginx.conf` for NGINX configuration and `docker-compose.yml` for environment setup. * Provide a comprehensive `README.md` for project setup and usage instructions. Also: * Add `.gitattributes` configuration for handling large files with Git LFS. * Include `.github/scripts/` with various sanitizer scripts (`run-all-sanatizers`, `sanatizer-pycodestyle`, `sanatizer-pyflake8`, `sanatizer-shellcheck`) for automated code quality checks. * Add GitHub Actions workflow (`sanatizers.yml`) to run sanitizers on pull requests. * Add `.gitignore` with entries for backup files, virtual environments, and testing artifacts.
1 parent 43e23c2 commit 6d0a7ed

37 files changed

+1291
-4
lines changed

.ci/README.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
A Robot Framework tests suite for automating the validation of the
2+
meta-wpe-image images.
3+
4+
# Installation
5+
6+
We have the `install-requirements.sh` and `podman-compose.sh` scripts in the
7+
project.The first one is a convenient script for installing the Podman
8+
requirements. The second, is a wrapper for execute the podman-compose command
9+
but with the environment variables defined in the setup-env.sh.
10+
11+
``` sh
12+
./install-requirements.sh
13+
cp setup-env-local.sh.sample setup-env-local.sh # Use an editor for adapt the content
14+
```
15+
16+
A sample environment setup file (`setup-env-local.sh.sample`) is provided to
17+
guide the initial configuration. It sets the variables for the test board and
18+
network configurations adapted to your environment.
19+
20+
## How It Works
21+
22+
To set up the testing environment, run:
23+
24+
```sh
25+
./podman-compose.sh up --force-recreate --always-recreate-deps --build -d -t 4
26+
```
27+
28+
Once the environment is running, you can trigger the tests with the
29+
`./run-tests.sh` launcher:
30+
31+
```sh
32+
./run-tests.sh
33+
```
34+
### Services Setup
35+
36+
The `./podman-compose.sh up` command initializes the following services:
37+
38+
- **webserver**: Runs an NGINX container, exposing port **8008** for HTTP
39+
requests.
40+
- **robot**: Runs a Python-based container configured for executing tests
41+
using the Robot Framework.
42+
43+
### Running Tests
44+
45+
To execute the tests, use:
46+
47+
```sh
48+
./run-tests.sh [options]
49+
```
50+
51+
Options:
52+
53+
- `--force-recreate` : Recreate and build containers before running tests.
54+
- `--help` : Display the help message for available options.
55+
56+
### Stopping the Containers
57+
58+
To stop the Podman containers, use:
59+
60+
```sh
61+
./podman-compose.sh down -t 4
62+
```
63+

.ci/conf/nginx.conf

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
server {
2+
listen 8008;
3+
listen [::]:8008;
4+
server_name localhost;
5+
6+
#access_log /var/log/nginx/host.access.log main;
7+
8+
location / {
9+
root /usr/share/nginx/html;
10+
index index.html index.htm;
11+
}
12+
13+
location /robot_framework/html/ {
14+
root /;
15+
autoindex on;
16+
}
17+
18+
location /tests_results/ {
19+
root /;
20+
autoindex on;
21+
}
22+
23+
#error_page 404 /404.html;
24+
25+
# redirect server error pages to the static page
26+
# /50x.html
27+
#
28+
error_page 500 502 503 504 /50x.html;
29+
location = /50x.html {
30+
root /usr/share/nginx/html;
31+
}
32+
33+
}
34+
35+

.ci/docker-compose.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: '3'
2+
services:
3+
webserver:
4+
image: docker.io/library/nginx:latest
5+
network_mode: host
6+
volumes:
7+
- ./conf/nginx.conf:/etc/nginx/conf.d/default.conf
8+
- ./robot_framework/html:/robot_framework/html
9+
- ./tests_results:/tests_results
10+
robot:
11+
build: docker/robot/
12+
network_mode: host
13+
volumes:
14+
- .:/app

.ci/docker/robot/Dockerfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM python:3-slim
2+
3+
WORKDIR /app
4+
5+
CMD ["robot_framework/init-robot.sh"]

.ci/install-requirements.sh

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#! /bin/sh -e
2+
3+
# Identify the Linux distribution
4+
if [ -f /etc/os-release ]; then
5+
. /etc/os-release
6+
else
7+
echo "Distribution identification file /etc/os-release is missing."
8+
exit 1
9+
fi
10+
11+
# Function to install podman-compose on Fedora
12+
install_fedora() {
13+
echo "Installing podman-compose on Fedora..."
14+
sudo yum install -y podman-compose pycodestyle python3-pyflakes shellcheck
15+
}
16+
17+
# Function to install podman-compose on Debian or Ubuntu
18+
install_debian_ubuntu() {
19+
echo "Installing podman-compose on $NAME..."
20+
sudo apt update
21+
sudo apt install -y podman-compose pycodestyle pyflakes3 shellcheck
22+
}
23+
24+
# Installation process based on the identified distribution
25+
case $ID in
26+
fedora)
27+
install_fedora
28+
;;
29+
ubuntu | debian)
30+
install_debian_ubuntu
31+
;;
32+
*)
33+
echo "Your distribution ($ID) is not supported by this script."
34+
exit 2
35+
;;
36+
esac
37+

.ci/podman-compose.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#! /bin/sh
2+
3+
set -e
4+
5+
if [ ! -e ./setup-env.sh ]
6+
then
7+
echo "Please, create a ./setup-env.sh to run this command"
8+
exit 1
9+
fi
10+
11+
. ./setup-env.sh
12+
exec podman-compose "$@"

.ci/prepare-board.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#! /bin/bash
2+
3+
set -e
4+
5+
BASEPATH="$(dirname "$(readlink -f "$0")")"
6+
7+
SETUPENV="${BASEPATH}/setup-env.sh"
8+
9+
if [ ! -e "${SETUPENV}" ]
10+
then
11+
echo "Please, create a ${SETUPENV} to run this command"
12+
exit 1
13+
fi
14+
15+
# shellcheck source=./setup-env.sh
16+
. "${SETUPENV}"
17+
18+
sshi() {
19+
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "root@${TEST_BOARD_IP}" "$@"
20+
}
21+
22+
scpi() {
23+
scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -r "$@" "root@${TEST_BOARD_IP}":
24+
}
25+
26+
pushd "${BASEPATH}" || exit 1
27+
scpi scripts
28+
popd || exit 1
29+
30+
sshi "/usr/bin/kill-demo || true"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:2c56cd32f709d1da3b93302381736b26ffb0da916b5bde950134b863a93ea5e7
3+
size 276134947

.ci/robot_framework/html/glyphs.html

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Static HTML Page</title>
7+
<style>
8+
body {
9+
font-family: Arial, sans-serif;
10+
margin: 20px;
11+
}
12+
.number-list {
13+
margin-top: 20px;
14+
}
15+
</style>
16+
</head>
17+
<body>
18+
<div class="text">
19+
<h2>Text</h2>
20+
21+
<!-- Regular text -->
22+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
23+
eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
24+
25+
<!-- Bold text -->
26+
<p><strong>Lorem ipsum dolor sit amet, consectetur adipiscing elit,
27+
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</strong></p>
28+
29+
<!-- Italic text -->
30+
<p><em>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
31+
eiusmod tempor incididunt ut labore et dolore magna aliqua.</em></p>
32+
33+
<!-- Heading -->
34+
<h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
35+
eiusmod tempor incididunt ut labore et dolore magna aliqua.</h2>
36+
</div>
37+
38+
<div class="numbers">
39+
<h2>Numbers from 0 to 100</h2>
40+
<!-- Generate numbers dynamically -->
41+
<p><script>
42+
for (let i = 0; i <= 100; i++) {
43+
document.write(' ' + i);
44+
}
45+
</script></p>
46+
<p><strong><script>
47+
for (let i = 0; i <= 100; i++) {
48+
document.write(' ' + i);
49+
}
50+
</script></strong></p>
51+
<p><em><script>
52+
for (let i = 0; i <= 100; i++) {
53+
document.write(' ' + i);
54+
}
55+
</script></em></p>
56+
<h2><script>
57+
for (let i = 0; i <= 100; i++) {
58+
document.write(' ' + i);
59+
}
60+
</script></h2>
61+
</div>
62+
<div class="status">
63+
<h2> Status:
64+
<script>
65+
document.write('Ready');
66+
</script>
67+
</h2>
68+
</div>
69+
</body>
70+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Alternating Color Blocks</title>
7+
<style>
8+
/* Style for blocks */
9+
.block {
10+
width: 100%;
11+
height: 135px;
12+
display: flex;
13+
align-items: center;
14+
justify-content: center;
15+
font-size: 24px;
16+
font-weight: bold;
17+
color: black;
18+
}
19+
/* Alternate colors for blocks */
20+
.block:nth-child(odd) {
21+
background-color: yellow;
22+
}
23+
.block:nth-child(even) {
24+
background-color: white;
25+
}
26+
</style>
27+
</head>
28+
<body>
29+
30+
<!-- Container for blocks -->
31+
<div class="container">
32+
<!-- Generate blocks 1 to 64 -->
33+
<div class="block">1</div>
34+
<div class="block">2</div>
35+
<div class="block">3</div>
36+
<div class="block">4</div>
37+
<div class="block">5</div>
38+
<div class="block">6</div>
39+
<div class="block">7</div>
40+
<div class="block">8</div>
41+
<div class="block">9</div>
42+
<div class="block">10</div>
43+
<div class="block">11</div>
44+
<div class="block">12</div>
45+
<div class="block">13</div>
46+
<div class="block">14</div>
47+
<div class="block">15</div>
48+
<div class="block">16</div>
49+
<div class="block">17</div>
50+
<div class="block">18</div>
51+
<div class="block">19</div>
52+
<div class="block">20</div>
53+
<div class="block">21</div>
54+
<div class="block">22</div>
55+
<div class="block">23</div>
56+
<div class="block">24</div>
57+
<div class="block">25</div>
58+
<div class="block">26</div>
59+
<div class="block">27</div>
60+
<div class="block">28</div>
61+
<div class="block">29</div>
62+
<div class="block">30</div>
63+
<div class="block">31</div>
64+
<div class="block">32</div>
65+
<div class="block">33</div>
66+
<div class="block">34</div>
67+
<div class="block">35</div>
68+
<div class="block">36</div>
69+
<div class="block">37</div>
70+
<div class="block">38</div>
71+
<div class="block">39</div>
72+
<div class="block">40</div>
73+
<div class="block">41</div>
74+
<div class="block">42</div>
75+
<div class="block">43</div>
76+
<div class="block">44</div>
77+
<div class="block">45</div>
78+
<div class="block">46</div>
79+
<div class="block">47</div>
80+
<div class="block">48</div>
81+
<div class="block">49</div>
82+
<div class="block">50</div>
83+
<div class="block">51</div>
84+
<div class="block">52</div>
85+
<div class="block">53</div>
86+
<div class="block">54</div>
87+
<div class="block">55</div>
88+
<div class="block">56</div>
89+
<div class="block">57</div>
90+
<div class="block">58</div>
91+
<div class="block">59</div>
92+
<div class="block">60</div>
93+
<div class="block">61</div>
94+
<div class="block">62</div>
95+
<div class="block">63</div>
96+
<div class="block">64</div>
97+
</div>
98+
99+
</body>
100+
</html>
101+

0 commit comments

Comments
 (0)