Skip to content

Commit

Permalink
Add cache_cleaner for Github Action (#910)
Browse files Browse the repository at this point in the history
* Add cache_cleaner for Github Action

* Update BUILDING.md

* Update BUILDING.md

* Update build.sh

* Fixing typo

* Switch STB to INTERFACE lib module

* Fix STB

* Disable sprintf warning for the external lib till it's fixed in the upstream

* Check for clang

* Add artifacts cleaner

* Fix cache cleaner ref

* Add proper labels

* Fixing typo
  • Loading branch information
awawa-dev authored Jul 25, 2024
1 parent 39c71ae commit eff9bb8
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 8,005 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/cache_cleaner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Cache clearing action after closing PR

on:
pull_request:
types:
- closed

jobs:
clean_PR_ccache:
name: Delete old CCache files
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: yumemi-inc/clean-cache-action@v1
with:
ref: 'refs/heads/${{ github.head_ref }}'
clean_PR_artifacts:
name: Delete old Artifacts
runs-on: ubuntu-latest
steps:
- uses: stefanluptak/delete-old-pr-artifacts@v1
with:
workflow_filename: push-master.yml
debug: true
18 changes: 18 additions & 0 deletions .github/workflows/push-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ jobs:
key: ${{ matrix.linuxVersion }}-${{ matrix.dockerImage }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: ${{ matrix.linuxVersion }}-${{ matrix.dockerImage }}-ccache-

- name: Clear branch ccache storage
uses: yumemi-inc/clean-cache-action@v1
with:
ref: ${{ github.event.ref }}
key: ${{ matrix.linuxVersion }}-${{ matrix.dockerImage }}-ccache-

- name: Check default version
if: matrix.linuxVersion != 'bullseye'
run: |
Expand Down Expand Up @@ -167,6 +173,12 @@ jobs:
key: macOS-ccache-${{ matrix.NICE_NAME }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: macOS-ccache-${{ matrix.NICE_NAME }}

- name: Clear branch ccache storage
uses: yumemi-inc/clean-cache-action@v1
with:
ref: ${{ github.event.ref }}
key: macOS-ccache-${{ matrix.NICE_NAME }}

# Install deps
- name: Install deps
shell: bash
Expand Down Expand Up @@ -252,6 +264,12 @@ jobs:
key: ${{ runner.os }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: ${{ runner.os }}-ccache

- name: Clear branch ccache storage
uses: yumemi-inc/clean-cache-action@v1
with:
ref: ${{ github.event.ref }}
key: ${{ runner.os }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}

- name: Install TurboJPEG
shell: powershell
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@
[submodule "external/nanopb"]
path = external/nanopb
url = https://github.com/nanopb/nanopb.git
[submodule "external/stb"]
path = external/stb
url = https://github.com/nothings/stb.git
52 changes: 48 additions & 4 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,50 @@
### 2. [Build a HyperHDR installer for any supported Linux system on any system using Docker](https://github.com/awawa-dev/HyperHDR/wiki/Compiling-HyperHDR#build-a-hyperhdr-installer-for-any-supported-linux-system-on-any-system-using-docker)
### 3. [Github Action (online - easiest)](https://github.com/awawa-dev/HyperHDR/wiki/Compiling-HyperHDR#github-action-online---easiest)

## Available CMake HyperHDR configuration options:
Use -D prefix when configuring the build.

* LED DEVICES
* ENABLE_SPIDEV = ON | OFF, enables SPI LED devices on supported systems
* ENABLE_WS281XPWM = ON | OFF, enables WS281x LED library on supported systems

* SOFTWARE GRABBERS
* ENABLE_DX = ON | OFF, enables the DirectX11 software grabber (Windows)
* ENABLE_FRAMEBUFFER = ON | OFF, enables the Framebuffer software grabber (Linux)
* ENABLE_MAC_SYSTEM = ON | OFF, enables the macOS software grabber (macOS)
* ENABLE_PIPEWIRE = ON | OFF, enables the Pipewire software grabber (Linux)
* ENABLE_PIPEWIRE_EGL = ON | OFF, enables EGL for the Pipewire grabber (Linux)
* ENABLE_X11 = ON | OFF, enables the X11 software grabber (Linux)

* HARDWARE GRABBERS
* ENABLE_AVF = ON | OFF, enables the AVF USB grabber support (macOS)
* ENABLE_MF = ON | OFF, enables the MediaFoundation USB grabber support (Windows)
* ENABLE_V4L2 = ON | OFF, enables the V4L2 USB grabber support (Linux)

* SOUND CAPTURING
* ENABLE_SOUNDCAPLINUX = ON | OFF, enables the ALSA sound grabber (Linux)
* ENABLE_SOUNDCAPMACOS = ON | OFF, enables the sound grabber (macOS)
* ENABLE_SOUNDCAPWINDOWS = ON | OFF, enables the sound grabber (Windows)

* SERVICE SUPPORT
* ENABLE_BONJOUR = ON | OFF, enables mDNS (do not disable unless required)
* ENABLE_CEC = ON | OFF, enables the HDMI-CEC support (Linux)
* ENABLE_MQTT = ON | OFF, enables the MQTT support
* ENABLE_POWER_MANAGEMENT = ON | OFF, enables sleep/wake up OS events support
* ENABLE_PROTOBUF = ON | OFF, enables Proto-Buffer server
* ENABLE_SYSTRAY = ON | OFF, enables the systray-widget
* ENABLE_XZ = ON | OFF, enables XZ support for LUT downloading

* BUILD FEATURES
* USE_SHARED_LIBS = ON | OFF, if disabled, build the application as monolithic
* USE_EMBEDDED_WEB_RESOURCES = ON | OFF, if enable, embed web content into the application
* USE_PRECOMPILED_HEADERS = ON | OFF, use pre-compiled headers when building
* USE_CCACHE_CACHING = ON | OFF, enable CCache support if available
* USE_SYSTEM_MQTT_LIBS = ON | OFF, prefer system qMQTT libs
* USE_SYSTEM_FLATBUFFERS_LIBS = ON | OFF, prefer system Flatbuffers libs
* USE_STATIC_QT_PLUGINS = ON | OFF, embed static QT-plugins into the application
* USE_STANDARD_INSTALLER_NAME = ON | OFF, use standard Linux package naming

----

# Native build
Expand Down Expand Up @@ -64,8 +108,8 @@ We assume a 64bit Windows 10. Install the following;

Hint: after you execute the configuration command in the build folder (for example ```cmake -DCMAKE_BUILD_TYPE=Release ..```) you should receive *.sln solution project file that can be opened in Visual Studio. Select `hyperhdr` project as default for the solution to run it after compilation.

### macOs
First install brew manager.
### macOS
First install [brew](https://brew.sh/) manager.
Next: `brew install qt@6 cmake xz pkg-config`

## Compiling and installing HyperHDR
Expand All @@ -86,7 +130,7 @@ make -j 2
# Run it from the build directory
bin/hyperhdr -d

# BUILD INSTALLERS (recommended method to install HyperHDR)
# BUILD INSTALLERS (recommended method to install HyperHDR, doesnt work for ArchLinux: use build.sh script )
cpack
# or compile and build the package using one command
cmake --build . --target package --config Release
Expand Down Expand Up @@ -167,7 +211,7 @@ PLATFORM=rpi DOCKER_TAG=bullseye DOCKER_IMAGE=arm-64bit-aarch64 ./build.sh
Installers from Docker builds will be ready in the deploy folder
```

The `build.sh` script can also be used to natively build installers as an alternative to the method described in the previous point. Of course, then you must have all the necessary packages installed.
The `build.sh` script can also be used to natively build macOS/Windows installers as an alternative to the method described in the previous point. Of course, then you must have all the necessary packages installed.

----

Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ elif [[ "$CI_NAME" == 'linux' ]]; then
fi
chmod -R a+rw ${CI_BUILD_DIR}/.ccache
else
executeCommand="cd build && ( cmake ${BUILD_OPTION} -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DDEBIAN_NAME_TAG=${DOCKER_TAG} -DUSE_STANDARD_INSTALLER_NAME=${USE_STANDARD_INSTALLER_NAME} ../ || exit 2 )"
executeCommand="cd build && ( cmake ${BUILD_OPTION} -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DDEBIAN_NAME_TAG=${DOCKER_TAG} ../ || exit 2 )"
executeCommand+=" && ( make -j $(nproc) package || exit 3 )"
fi

Expand Down
7 changes: 3 additions & 4 deletions cmake/packages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,10 @@ if ( UNIX AND NOT APPLE )
string(CONCAT CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libc6 (>=${GLIBC_VERSION})" )
string(CONCAT CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, glibc >= ${GLIBC_VERSION}" )
endif()
endif()

message("DEB deps: ${CPACK_DEBIAN_PACKAGE_DEPENDS}")
message("RPM deps: ${CPACK_RPM_PACKAGE_REQUIRES}")

message("DEB deps: ${CPACK_DEBIAN_PACKAGE_DEPENDS}")
message("RPM deps: ${CPACK_RPM_PACKAGE_REQUIRES}")
endif()

#if(BUILD_ARCHIVES)
SET ( CPACK_DEBIAN_COMPRESSION_TYPE "xz" )
Expand Down
14 changes: 3 additions & 11 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,9 @@ endif()
# STB
#=============================================================================

add_library(stb OBJECT ${CMAKE_CURRENT_SOURCE_DIR}/stb/stb_image.h ${CMAKE_CURRENT_SOURCE_DIR}/lunasvg/3rdparty/stb/stb_image_write.h )

install(
TARGETS stb
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)

target_include_directories(stb PUBLIC ${CMAKE_SOURCE_DIR}/external/lunasvg/3rdparty/stb ${CMAKE_SOURCE_DIR}/external/stb)

target_compile_definitions(stb PUBLIC
add_library(stb INTERFACE )
target_include_directories(stb INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/stb)
target_compile_definitions(stb INTERFACE
STB_IMAGE_WRITE_IMPLEMENTATION
STB_IMAGE_IMPLEMENTATION
)
1 change: 1 addition & 0 deletions external/stb
Submodule stb added at f7f20f
Loading

0 comments on commit eff9bb8

Please sign in to comment.