Skip to content

Commit a723062

Browse files
authored
Merge pull request #127 from EmixamPP/ci
chore(CI): refactors
2 parents 4d18d36 + 4e892e7 commit a723062

11 files changed

Lines changed: 79 additions & 167 deletions

File tree

.github/actions/install-opencv.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/arm.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ on:
44
workflow_dispatch:
55
workflow_call:
66

7+
env:
8+
OPENCV_VERSION: "4.8.0"
9+
710
jobs:
811
build:
12+
name: Building
913
runs-on: ubuntu-latest
1014
steps:
1115
- uses: actions/checkout@v3
@@ -18,12 +22,37 @@ jobs:
1822
- name: Install dependencies
1923
run: |
2024
sudo apt-get update -y
21-
sudo apt-get install -y python3-setuptools python3-wheel ninja-build g++ pkg-config libgtk-3-dev
25+
sudo apt-get install -y python3-setuptools python3-wheel ninja-build g++ pkg-config libgtk-3-dev zlib1g-dev cmake
2226
python -m pip install --upgrade pip
2327
python -m pip install meson
2428
29+
- name: Cache OpenCV
30+
id: cache
31+
uses: actions/cache@v3
32+
with:
33+
path: opencv
34+
key: opencv-${{ env.OPENCV_VERSION }}
35+
36+
- name: Build tiny static OpenCV
37+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
38+
run: |
39+
sudo apt-get install -y curl
40+
mkdir -p opencv/build
41+
curl -L https://github.com/opencv/opencv/archive/refs/tags/${{ env.OPENCV_VERSION }}.tar.gz | tar -xz -C opencv
42+
cmake -B opencv/build -S opencv/opencv-${{ env.OPENCV_VERSION }} -GNinja \
43+
-DBUILD_SHARED_LIBS=OFF -DOPENCV_GENERATE_PKGCONFIG=YES \
44+
-DBUILD_LIST=videoio,highgui -WITH_V4L=ON -DWITH_GTK=ON \
45+
-DWITH_JPEG=OFF -DWITH_PNG=OFF -DWITH_TIFF=OFF -DWITH_WEBP=OFF -DWITH_OPENJPEG=OFF -DWITH_JASPER=OFF -DWITH_OPENEXR=OFF -DWITH_IMGCODEC_HDR=OFF -DWITH_IMGCODEC_SUNRASTER=OFF -DWITH_IMGCODEC_PXM=OFF -DWITH_IMGCODEC_PFM=OFF \
46+
-DWITH_FFMPEG=FALSE -DWITH_GSTREAMER=OFF -DWITH_1394=OFF -DDVIDEOIO_ENABLE_PLUGINS=OFF -DWITH_ANDROID_MEDIANDK=OFF \
47+
-DHIGHGUI_ENABLE_PLUGINS=OFF -DWITH_VTK=OFF \
48+
-DWITH_PROTOBUF=OFF -DOPENCV_DNN_OPENCL=OFF \
49+
-DWITH_VA_INTEL=OFF -DWITH_OPENCL=OFF -DWITH_OPENCL_SVM=OFF -DWITH_OPENCLAMDFFT=OFF -DWITH_OPENCLAMDBLAS=OFF -DWITH_OPENCL_D3D11_NV=OFF \
50+
-DWITH_IPP=OFF -DWITH_CAROTENE=OFF -DWITH_CPUFEATURES=OFF -DWITH_EIGEN=OFF -DWITH_OPENVX=OFF -DWITH_DIRECTX=OFF -DWITH_VA=OFF -DWITH_LAPACK=OFF -DWITH_QUIRC=OFF
51+
ninja -C opencv/build
52+
2553
- name: Install OpenCV
26-
uses: ./.github/actions/install-opencv.yml
54+
run: |
55+
sudo ninja install -C opencv/build
2756
2857
- name: Setup build
2958
run: |
@@ -37,8 +66,7 @@ jobs:
3766
- name: Create tarball - Systemd
3867
run: |
3968
DESTDIR=install_dir_systemd meson install -C build
40-
sudo chown -R root:root build/install_dir_systemd
41-
tar -czvf build/linux-enable-ir-emitter.systemd.x86-64.tar.gz -C build/install_dir .
69+
tar -czvf build/linux-enable-ir-emitter.systemd.x86-64.tar.gz -C build/install_dir_systemd .
4270
4371
- name: Upload tarball - Systemd
4472
uses: actions/upload-artifact@v3
@@ -54,8 +82,7 @@ jobs:
5482
- name: Create tarball - OpenRC
5583
run: |
5684
DESTDIR=install_dir_openrc meson install -C build
57-
sudo chown -R root:root build/install_dir_openrc
58-
tar -czvf build/linux-enable-ir-emitter.openrc.x86-64.tar.gz -C build/install_dir .
85+
tar -czvf build/linux-enable-ir-emitter.openrc.x86-64.tar.gz -C build/install_dir_openrc .
5986
6087
- name: Upload tarball - OpenRC
6188
uses: actions/upload-artifact@v3

.github/workflows/cpp-lint.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,20 @@ on:
66

77
jobs:
88
lint:
9+
name: C++ linting
910
runs-on: ubuntu-latest
1011
steps:
1112
- uses: actions/checkout@v3
1213

1314
- name: Install dependencies
1415
run: |
15-
sudo apt-get install -y python3-setuptools python3-wheel ninja-build g++ clang-tidy libgtk-3-dev libopencv-video-dev libopencv-video-dev
16+
sudo apt-get install -y python3-setuptools python3-wheel ninja-build g++ pkg-config clang-tidy libgtk-3-dev libopencv-dev
1617
python -m pip install --upgrade pip
1718
python -m pip install meson
1819
1920
- name: Setup
2021
run: |
21-
meson setup build
22-
meson configure build -Dwerror=false
23-
meson compile -C build
22+
meson setup build
2423
2524
- name: Lint
2625
run: |

.github/workflows/depend-opencv.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ jobs:
1919
VERSION=$(gh api "/repos/$OWNER/$REPO/releases/latest" --jq ".tag_name")
2020
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
2121
22-
- name: Modify files if new version
22+
- name: Modify file if new version
2323
run: |
24-
sed -E -i "s@(OPENCV_VERSION:\s+\")([0-9]+\.[0-9]+\.[0-9]+)(\")@\1$VERSION\3@" .github/actions/install-opencv.yml
25-
sed -E -i "s@(OPENCV_VERSION:\s+\")([0-9]+\.[0-9]+\.[0-9]+)(\")@\1$VERSION\3@" .github/workflows/arm.yml
26-
sed -E -i "s@(curl https://raw.githubusercontent.com/EmixamPP/opencv-tiny/main/build.sh | bash -s )[0-9]+\.[0-9]+\.[0-9]+(.*)@\1$VERSION\2@" README.md
24+
sed -E -i "s@(OPENCV_VERSION:\s+\")([0-9]+\.[0-9]+\.[0-9]+)(\")@\1$VERSION\3@" .github/workflows/build.yml
2725
2826
- name: Create PR if new version
2927
uses: peter-evans/create-pull-request@v5

.github/workflows/pr.yml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,42 @@ on:
55

66
jobs:
77
py-lint:
8-
runs-on: ubuntu-latest
9-
steps:
10-
- name: Python linting
11-
uses: ./.github/workflows/py-lint.yml
8+
uses: ./.github/workflows/py-lint.yml
129

1310
cpp-lint:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- name: C++ linting
17-
uses: ./.github/workflows/cpp-lint.yml
11+
uses: ./.github/workflows/cpp-lint.yml
1812

1913
build:
20-
runs-on: ubuntu-latest
21-
steps:
22-
- name: Build
23-
uses: ./.github/workflows/build.yml
14+
uses: ./.github/workflows/build.yml
2415

2516
comment:
17+
name: Bot comment
2618
needs:
2719
- py-lint
2820
- cpp-lint
2921
- build
3022
runs-on: ubuntu-latest
23+
if: always()
3124
steps:
32-
- name: Create/Update comment
33-
uses: thollander/actions-comment-pull-request@v2
25+
- uses: thollander/actions-comment-pull-request@v2
3426
with:
3527
comment_tag: bot_comment
3628
mode: recreate
3729
GITHUB_TOKEN: ${{ github.token }}
3830
message: |
39-
# Commit ${{ github.event.pull_request.head.sha }}
31+
## :arrow_right: Commit ${{ github.event.pull_request.head.sha }}
32+
33+
## :clipboard: [Logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
4034
41-
## CI results:
35+
## :mag: Linting results:
4236
${{ needs.py-lint.result == 'success' && ':heavy_check_mark:' || ':x:' }} Python Linting
4337
4438
${{ needs.cpp-lint.result == 'success' && ':heavy_check_mark:' || ':x:' }} C++ Linting
4539
40+
## :hammer_and_wrench: Building result:
4641
${{ needs.build.result == 'success' && ':heavy_check_mark:' || ':x:' }} Building
4742
48-
## Builds:
49-
If the building step was successfull, you can download the tarball you want in the artifacts section [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).
43+
## :package: Tarballs:
44+
If the building step was successfull, you can download the appropriate tarball in the artifacts section [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).
5045
5146
Unzip and then execute `sudo tar -C / --no-same-owner -h -xzf linux-enable-ir-emitter*.tar.gz`.

.github/workflows/py-lint.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ on:
55
workflow_call:
66

77
jobs:
8-
py-lint:
8+
lint:
9+
name: Python linting
910
runs-on: ubuntu-latest
1011
steps:
1112
- uses: actions/checkout@v3

.gitignore

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
# Python
2-
__pycache__
3-
env
2+
__pycache__/
3+
env/
44

55
# Meson
6-
build
6+
build/
77

88
# OpenCV
9-
opencv*
10-
!sources/camera/opencv.hpp
11-
zlib*
9+
opencv/
1210

1311
# Others
14-
.vscode
12+
.vscode/

README.md

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ Provides support for infrared cameras that are not directly enabled out-of-the b
55
`linux-enable-ir-emitter` can automatically generate a lightweight driver (located in user space) for almost any (UVC) infrared emitter.
66

77
## Installation
8-
Directly refer to the manual buid [section](#manual-build) if your boot service manager is not Systemd but OpenRC. Stay here if you don't know. We support ARM architectures, just download the `aarch64` variant.
9-
10-
Download the latest `linux-enable-ir-emitter-x.x.x.x86-64.tar.gz` [here](https://github.com/EmixamPP/linux-enable-ir-emitter/releases/latest), then execute:
8+
Download the latest `linux-enable-ir-emitter-x.x.x.systemd.x86-64.tar.gz` [here](https://github.com/EmixamPP/linux-enable-ir-emitter/releases/latest), then execute:
119
```
12-
sudo tar -C / -h -xzf linux-enable-ir-emitter-*.tar.gz
10+
sudo tar -C / --no-same-owner -h -xzf linux-enable-ir-emitter*.tar.gz
1311
```
1412

13+
We also support OpenRC, just download the `.openrc` variant.
14+
15+
### Uninstallation
1516
It can be uninstalled by executing (remove the last line to keep the emitter configuration):
1617
```
1718
sudo rm -rf /usr/lib64/linux-enable-ir-emitter \
@@ -46,30 +47,22 @@ The software supports the configuration of multiple devices, execute the configu
4647
## Manual build
4748
See [docs](docs/requirements.md) for specification concerning build requirements.
4849

49-
Clone the git:
50+
Setup build:
5051
```
5152
git clone https://github.com/EmixamPP/linux-enable-ir-emitter.git
5253
cd linux-enable-ir-emitter
53-
```
54-
55-
Build my minimal version of OpenCV that will be statically linked. This is not required, you can use the shared opencv library of your distro. But it is recommanded in order to do not have issues after distro updates:
56-
```
57-
curl https://raw.githubusercontent.com/EmixamPP/opencv-tiny/main/build.sh | bash -s 4.8.0 "${PWD}/opencv-tiny"
58-
```
59-
60-
Setup build (remove `--pkg-config-path=...` if you skipped the previous step):
61-
```
62-
meson setup build --pkg-config-path=$(find opencv-tiny -name pkgconfig | tr '\n' ':')
54+
meson setup build
6355
```
6456

6557
Only if you do not have Systemd but OpenRC:
6658
```
6759
meson configure build -Dboot_service=openrc
6860
```
6961

70-
Build and install linux-enable-ir-emitter:
62+
Compile and install:
7163
```
72-
sudo meson install -C build
64+
meson compile -C build
65+
meson install -C build
7366
```
7467

75-
You can uninstall the software by executing `sudo ninja uninstall -C build`.
68+
You can uninstall the tool by executing `sudo ninja uninstall -C build`.

docs/issues.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### Please, first, ensure that you have the last version. Compare the [latest release](https://github.com/EmixamPP/linux-enable-ir-emitter/releases/latest) with `linux-enable-ir-emitter -V`
1+
## Please, first, ensure that you have the last version. Compare the [latest release](https://github.com/EmixamPP/linux-enable-ir-emitter/releases/latest) with `linux-enable-ir-emitter -V`
22

33
## The configuration has failed
44
If you had the message `INFO: Please shut down your computer, then boot and retry.`, please follow these instructions first:
@@ -13,11 +13,12 @@ Otherwise, open an issue using the "Configuration has failed" template.
1313
## The emitter does not work after successful configuration or after update.
1414
1. If you use Howdy, be sure it uses the infrared camera configured; the path is printed after the message `INFO: Configuring the camera:`.
1515
2. Execute `sudo linux-enable-ir-emitter boot enable`.
16-
3. If none of the previous fix your problem, open an issue using the "Emitter does not work after successful configuration" template.
16+
3. Open an issue using the "Emitter does not work after successful configuration" template.
1717

1818
## Error with the systemd/openrc or udev boot service
1919
1. Ensure you have `systemd` or `openrc` (and the related version installed)
2020
2. Open an issue using the "Emitter does not work after successful configuration" template.
2121

2222
## Other bugs
23-
Open an issue using the "Bug report" template.
23+
1. If the problem seems to be a library problem, first try the binary I provide by following the [readme](../README.md) instructions.
24+
2. Open an issue using the "Bug report" template.

0 commit comments

Comments
 (0)