Fixed arch build

This commit is contained in:
emeric
2022-05-28 14:57:39 +02:00
parent 558ffe1d87
commit 657b35d541
8 changed files with 75 additions and 18 deletions
@@ -1,4 +1,4 @@
name: Build name: Build (alpine)
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
Build: Build:
@@ -22,11 +22,11 @@ jobs:
id: buildx id: buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Build - name: Build (alpine)
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: ./ context: ./
file: ./Dockerfile-build file: ./Dockerfile-build-alpine
builder: ${{ steps.buildx.outputs.name }} builder: ${{ steps.buildx.outputs.name }}
build-args: LMS_BUILD_TYPE=${{ matrix.BUILD_TYPE }} build-args: LMS_BUILD_TYPE=${{ matrix.BUILD_TYPE }}
push: false push: false
+34
View File
@@ -0,0 +1,34 @@
name: Build (arch)
on: [push, pull_request]
jobs:
Build:
strategy:
matrix:
BUILD_TYPE: [Release, Debug]
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v2
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile-build-arch
builder: ${{ steps.buildx.outputs.name }}
build-args: LMS_BUILD_TYPE=${{ matrix.BUILD_TYPE }}
push: false
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
+26
View File
@@ -0,0 +1,26 @@
FROM archlinux:latest
ARG BUILD_PACKAGES="\
clang \
cmake \
boost \
ffmpeg \
gtest \
graphicsmagick \
libconfig \
make \
pkgconfig \
taglib \
wt"
RUN pacman -Syy
RUN pacman -S --noconfirm ${BUILD_PACKAGES}
# LMS
COPY . /tmp/lms/
ARG LMS_BUILD_TYPE="Release"
RUN \
DIR=/tmp/lms/build && mkdir -p ${DIR} && cd ${DIR} && \
cmake /tmp/lms/ -DCMAKE_BUILD_TYPE=${LMS_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/usr && \
VERBOSE=1 make -j$(nproc) && \
make test
@@ -67,7 +67,12 @@ std::vector<std::filesystem::path>
ScanSettings::getAudioFileExtensions() const ScanSettings::getAudioFileExtensions() const
{ {
const auto extensions {StringUtils::splitString(_audioFileExtensions, " ")}; const auto extensions {StringUtils::splitString(_audioFileExtensions, " ")};
return std::vector<std::filesystem::path>(std::cbegin(extensions), std::cend(extensions));
std::vector<std::filesystem::path> res (std::cbegin(extensions), std::cend(extensions));
std::sort(std::begin(res), std::end(res));
res.erase(std::unique( std::begin(res), std::end(res)), std::end(res));
return res;
} }
void void
@@ -69,11 +69,11 @@ getNextFirstOfMonth(Wt::WDate current)
} }
bool bool
isFileSupported(const std::filesystem::path& file, const std::unordered_set<std::filesystem::path>& extensions) isFileSupported(const std::filesystem::path& file, const std::vector<std::filesystem::path>& extensions)
{ {
const std::filesystem::path extension {StringUtils::stringToLower(file.extension().string())}; const std::filesystem::path extension {StringUtils::stringToLower(file.extension().string())};
return (extensions.find(extension) != extensions.end()); return (std::find(std::cbegin(extensions), std::cend(extensions), extension) != std::cend(extensions));
} }
bool bool
@@ -642,7 +642,7 @@ ScannerService::refreshScanSettings()
{ {
const auto fileExtensions {scanSettings->getAudioFileExtensions()}; const auto fileExtensions {scanSettings->getAudioFileExtensions()};
_fileExtensions.clear(); _fileExtensions.clear();
std::transform(std::cbegin(fileExtensions), std::end(fileExtensions), std::inserter(_fileExtensions, std::begin(_fileExtensions)), std::transform(std::cbegin(fileExtensions), std::end(fileExtensions), std::back_inserter(_fileExtensions),
[](const std::filesystem::path& extension) { return std::filesystem::path{ StringUtils::stringToLower(extension.string()) }; }); [](const std::filesystem::path& extension) { return std::filesystem::path{ StringUtils::stringToLower(extension.string()) }; });
} }
_mediaDirectory = scanSettings->getMediaDirectory(); _mediaDirectory = scanSettings->getMediaDirectory();
@@ -896,7 +896,7 @@ ScannerService::scanMediaDirectory(const std::filesystem::path& mediaDirectory,
// Check if a file exists and is still in a media directory // Check if a file exists and is still in a media directory
static bool static bool
checkFile(const std::filesystem::path& p, const std::filesystem::path& mediaDirectory, const std::unordered_set<std::filesystem::path>& extensions) checkFile(const std::filesystem::path& p, const std::filesystem::path& mediaDirectory, const std::vector<std::filesystem::path>& extensions)
{ {
try try
{ {
@@ -22,7 +22,7 @@
#include <chrono> #include <chrono>
#include <shared_mutex> #include <shared_mutex>
#include <optional> #include <optional>
#include <unordered_set> #include <vector>
#include <Wt/WDateTime.h> #include <Wt/WDateTime.h>
#include <Wt/WIOService.h> #include <Wt/WIOService.h>
@@ -114,7 +114,7 @@ namespace Scanner
std::size_t _scanVersion {}; std::size_t _scanVersion {};
Wt::WTime _startTime; Wt::WTime _startTime;
Database::ScanSettings::UpdatePeriod _updatePeriod {Database::ScanSettings::UpdatePeriod::Never}; Database::ScanSettings::UpdatePeriod _updatePeriod {Database::ScanSettings::UpdatePeriod::Never};
std::unordered_set<std::filesystem::path> _fileExtensions; std::vector<std::filesystem::path> _fileExtensions;
std::filesystem::path _mediaDirectory; std::filesystem::path _mediaDirectory;
Database::ScanSettings::RecommendationEngineType _recommendationServiceType; Database::ScanSettings::RecommendationEngineType _recommendationServiceType;
}; };
-8
View File
@@ -38,11 +38,3 @@ Wt::WDateTime getLastWriteTime(const std::filesystem::path& dir);
// returns false if aborted by user // returns false if aborted by user
bool exploreFilesRecursive(const std::filesystem::path& directory, std::function<bool(std::error_code, const std::filesystem::path&)> cb, const std::filesystem::path& excludeDirFileName = {}); bool exploreFilesRecursive(const std::filesystem::path& directory, std::function<bool(std::error_code, const std::filesystem::path&)> cb, const std::filesystem::path& excludeDirFileName = {});
namespace std
{
template <>
struct hash<std::filesystem::path>
{
inline std::size_t operator()(const std::filesystem::path &path) const { return hash_value(path); }
};
}