Skip to content

Commit b9869a9

Browse files
Merge branch 'omeryusufyagci-main'
2 parents 2b2b706 + 8c2e7a6 commit b9869a9

File tree

7 files changed

+78
-14
lines changed

7 files changed

+78
-14
lines changed
Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
name: Build and Publish Docker Image
1+
name: Build and Publish Docker Images
22

33
on:
44
push:
55
branches:
66
- main
7-
pull_request:
8-
branches:
9-
- main
7+
108

119
jobs:
1210
build-and-push:
@@ -18,7 +16,6 @@ jobs:
1816
id-token: write
1917

2018
steps:
21-
2219
- name: Checkout Repository
2320
uses: actions/checkout@v3
2421

@@ -29,11 +26,22 @@ jobs:
2926
username: ${{ github.actor }}
3027
password: ${{ secrets.GITHUB_TOKEN }}
3128

32-
- name: Build Docker Image
33-
run: |
34-
docker build -t ghcr.io/${{ github.repository_owner }}/fast-music-remover:latest .
29+
# Required for cross-platform builds with buildx to emulate foreign archs
30+
- name: Enable QEMU Emulation
31+
uses: docker/setup-qemu-action@v2
32+
33+
# Required for multi-arch image
34+
- name: Enable Buildx for Multi-Platform
35+
uses: docker/setup-buildx-action@v2
3536

36-
- name: Push Docker Image
37-
if: github.event_name == 'push'
37+
# Build and Push Multi-Arch Image:
38+
# Thanks to buildx, this image works for both archs (amd64/arm64)
39+
# Docker resolves the arch per platform for us, via the manifest
40+
- name: Build and Push Multi-Arch Image
3841
run: |
39-
docker push ghcr.io/${{ github.repository_owner }}/fast-music-remover:latest
42+
docker buildx build \
43+
--platform linux/amd64,linux/arm64 \
44+
--no-cache \
45+
--tag ghcr.io/${{ github.repository_owner }}/fast-music-remover:latest \
46+
--push \
47+
.

Dockerfile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,20 @@ RUN apt-get update && \
1111

1212
WORKDIR /app
1313

14-
# Copy the project into the container/app
14+
# Copy the project into the container
1515
COPY . /app
1616

17-
# Compile the C++ project with a fresh CMakeCache (issues with cache not matching source)
17+
# Handle library wrt arch
18+
# This is used in CI to avoid having separate images per arch
19+
ARG TARGETPLATFORM
20+
RUN echo "Detected platform: ${TARGETPLATFORM}" && \
21+
case "${TARGETPLATFORM}" in \
22+
"linux/amd64") cp /app/MediaProcessor/lib/libdf-linux-amd64.so /app/MediaProcessor/lib/libdf.so ;; \
23+
"linux/arm64") cp /app/MediaProcessor/lib/libdf-linux-arm64.so /app/MediaProcessor/lib/libdf.so ;; \
24+
*) echo "Unsupported platform: ${TARGETPLATFORM}" && exit 1 ;; \
25+
esac
26+
27+
# Compile the C++ project with a fresh CMakeCache
1828
RUN mkdir -p MediaProcessor/build && \
1929
cd MediaProcessor/build && \
2030
rm -rf CMakeCache.txt CMakeFiles _deps && \

MediaProcessor/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if(NOT CMAKE_BUILD_TYPE)
88
set(CMAKE_BUILD_TYPE Release)
99
endif()
1010

11-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -march=native -ffast-math -flto")
11+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -march=native")
1212

1313
include(FetchContent)
1414
set(FETCHCONTENT_BASE_DIR "${CMAKE_BINARY_DIR}/_deps") # helps with Docker to resolve
19.8 MB
Binary file not shown.
13.3 MB
Binary file not shown.

MediaProcessor/lib/libdf.so

-1.04 MB
Binary file not shown.

MediaProcessor/src/Engine.cpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1+
<<<<<<<< HEAD:MediaProcessor/src/Processor.cpp
2+
<<<<<<<< HEAD:MediaProcessor/src/Engine.cpp
13
#include "Engine.h"
4+
========
5+
#include "Processor.h"
6+
>>>>>>>> 48771f6 (Fix broken build and add macos-specific link fix):MediaProcessor/src/Processor.cpp
7+
========
8+
#include "Engine.h"
9+
>>>>>>>> 1766575 (Core: Refactor Processor class to better reflect intentions):MediaProcessor/src/Engine.cpp
210

311
#include <iostream>
412

@@ -9,10 +17,24 @@
917

1018
namespace MediaProcessor {
1119

20+
<<<<<<<< HEAD:MediaProcessor/src/Processor.cpp
21+
<<<<<<<< HEAD:MediaProcessor/src/Engine.cpp
22+
Engine::Engine(const std::filesystem::path& mediaPath)
23+
: m_mediaPath(std::filesystem::absolute(mediaPath)) {}
24+
25+
bool Engine::processMedia() {
26+
========
27+
Processor::Processor(const std::filesystem::path& mediaPath)
28+
: m_mediaPath(std::filesystem::absolute(mediaPath)) {}
29+
30+
bool Processor::process() {
31+
>>>>>>>> 48771f6 (Fix broken build and add macos-specific link fix):MediaProcessor/src/Processor.cpp
32+
========
1233
Engine::Engine(const std::filesystem::path& mediaPath)
1334
: m_mediaPath(std::filesystem::absolute(mediaPath)) {}
1435

1536
bool Engine::processMedia() {
37+
>>>>>>>> 1766575 (Core: Refactor Processor class to better reflect intentions):MediaProcessor/src/Engine.cpp
1638
ConfigManager& configManager = ConfigManager::getInstance();
1739
if (!configManager.loadConfig("config.json")) {
1840
std::cerr << "Error: Could not load configuration." << std::endl;
@@ -33,7 +55,15 @@ bool Engine::processMedia() {
3355
}
3456
}
3557

58+
<<<<<<<< HEAD:MediaProcessor/src/Processor.cpp
59+
<<<<<<<< HEAD:MediaProcessor/src/Engine.cpp
60+
bool Engine::processAudio() {
61+
========
62+
bool Processor::processAudio() {
63+
>>>>>>>> 48771f6 (Fix broken build and add macos-specific link fix):MediaProcessor/src/Processor.cpp
64+
========
3665
bool Engine::processAudio() {
66+
>>>>>>>> 1766575 (Core: Refactor Processor class to better reflect intentions):MediaProcessor/src/Engine.cpp
3767
AudioProcessor audioProcessor(m_mediaPath, Utils::prepareAudioOutputPath(m_mediaPath));
3868
if (!audioProcessor.isolateVocals()) {
3969
std::cerr << "Failed to process audio." << std::endl;
@@ -44,7 +74,15 @@ bool Engine::processAudio() {
4474
return true;
4575
}
4676

77+
<<<<<<<< HEAD:MediaProcessor/src/Processor.cpp
78+
<<<<<<<< HEAD:MediaProcessor/src/Engine.cpp
4779
bool Engine::processVideo() {
80+
========
81+
bool Processor::processVideo() {
82+
>>>>>>>> 48771f6 (Fix broken build and add macos-specific link fix):MediaProcessor/src/Processor.cpp
83+
========
84+
bool Engine::processVideo() {
85+
>>>>>>>> 1766575 (Core: Refactor Processor class to better reflect intentions):MediaProcessor/src/Engine.cpp
4886
auto [extractedVocalsPath, processedMediaPath] = Utils::prepareOutputPaths(m_mediaPath);
4987
AudioProcessor audioProcessor(m_mediaPath, extractedVocalsPath);
5088

@@ -63,7 +101,15 @@ bool Engine::processVideo() {
63101
return true;
64102
}
65103

104+
<<<<<<<< HEAD:MediaProcessor/src/Processor.cpp
105+
<<<<<<<< HEAD:MediaProcessor/src/Engine.cpp
106+
MediaType Engine::getMediaType() const {
107+
========
108+
MediaType Processor::getMediaType() const {
109+
>>>>>>>> 48771f6 (Fix broken build and add macos-specific link fix):MediaProcessor/src/Processor.cpp
110+
========
66111
MediaType Engine::getMediaType() const {
112+
>>>>>>>> 1766575 (Core: Refactor Processor class to better reflect intentions):MediaProcessor/src/Engine.cpp
67113
const std::string command =
68114
"ffprobe -loglevel error -show_entries stream=codec_type "
69115
"-of default=noprint_wrappers=1:nokey=1 \"" +

0 commit comments

Comments
 (0)