1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 19:30:21 +02:00

Remove circleci in favour of Github Actions

This commit is contained in:
Hugo Lindström
2019-12-20 18:38:16 +08:00
parent fdca99e57d
commit 27e8a665cf
7 changed files with 79 additions and 56 deletions

2
Docker/Docker.variables Normal file
View File

@@ -0,0 +1,2 @@
DOCKER_IMAGE_NAME=tomahawkmusicplayer/ubuntu
DOCKER_IMAGE_VER=latest

149
Docker/Dockerfile Normal file
View File

@@ -0,0 +1,149 @@
FROM ubuntu:19.04 as base
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
ninja-build \
openssh-client \
curl \
gnupg2 \
gosu \
wget \
locales \
git \
subversion \
make \
pkg-config \
unzip \
xz-utils \
software-properties-common \
sudo \
apt-utils \
&& rm -rf /var/lib/apt/lists/*
# LLVM/Clang
ENV CLANG_VERSION=9
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& apt-add-repository "deb http://apt.llvm.org/disco/ llvm-toolchain-disco-$CLANG_VERSION main" \
&& apt-get update && apt-get install -y \
clang-$CLANG_VERSION \
clang-tidy-$CLANG_VERSION \
clang-format-$CLANG_VERSION \
llvm-$CLANG_VERSION-dev \
libclang-$CLANG_VERSION-dev \
&& update-alternatives \
--install /usr/bin/clang clang /usr/bin/clang-$CLANG_VERSION 100 \
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-$CLANG_VERSION \
--slave /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$CLANG_VERSION \
--slave /usr/bin/clang-format clang-format /usr/bin/clang-format-$CLANG_VERSION
# GCC
ENV GCC_VERSION=9
RUN sudo apt-get update \
&& sudo apt-get install -y --no-install-recommends \
g++-$GCC_VERSION \
gcc-$GCC_VERSION \
&& sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9
# Tomahawk deps
RUN sudo apt-get update \
&& apt-get install -y --no-install-recommends \
cmake \
libattica-dev \
libboost-dev \
libboost-filesystem-dev \
libboost-iostreams-dev \
libboost-thread-dev \
libfftw3-dev \
libgnutls28-dev \
libgsasl7-dev \
liblastfm-dev \
liblastfm5-dev \
liblucene++-dev \
libphonon-dev \
libphononexperimental-dev \
libqca-qt5-2-dev \
libqca2-dev \
libqca2-plugins \
libqjson-dev \
libqt5svg5-dev \
libqt5webkit5-dev \
libqt5webkit5\
libsamplerate0-dev \
libsparsehash-dev \
libssl-dev \
libtelepathy-qt5-dev \
libvlc-dev \
libvlccore-dev \
libx11-dev \
libz-dev \
qt5-default \
qtbase5-dev \
qttools5-dev \
qttools5-dev-tools \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
RUN git clone --depth 1 https://github.com/zaphoyd/websocketpp.git --branch master --single-branch websocketpp \
&& mkdir websocketpp/build && cd websocketpp/build \
&& cmake .. \
&& sudo cmake --build . -j 16 --target install \
&& cd ../.. \
&& rm -r websocketpp
RUN git clone --depth 1 https://github.com/frankosterfeld/qtkeychain.git --branch master --single-branch qtkeychain \
&& mkdir qtkeychain/build && cd qtkeychain/build \
&& cmake .. \
&& sudo cmake --build . -j 16 --target install \
&& cd ../.. \
&& rm -r qtkeychain
RUN git clone --depth 1 https://github.com/taglib/taglib.git --branch master --single-branch taglib \
&& mkdir taglib/build && cd taglib/build \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON .. \
&& sudo cmake --build . -j 16 --target install \
&& cd ../.. \
&& rm -r taglib
RUN git clone --depth 1 https://anongit.kde.org/extra-cmake-modules.git --branch master --single-branch ecm \
&& mkdir ecm/build && cd ecm/build \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \
&& sudo cmake --build . -j 16 --target install \
&& cd ../.. \
&& rm -r ecm
RUN git clone --depth 1 https://github.com/KDE/attica.git --branch master --single-branch attica \
&& mkdir attica/build && cd attica/build \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \
&& sudo cmake --build . -j 16 --target install \
&& cd ../.. \
&& rm -r attica
RUN git clone --depth 1 https://github.com/stachenov/quazip.git --branch master --single-branch quazip \
&& mkdir quazip/build && cd quazip/build \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \
&& sudo cmake --build . -j 16 --target install \
&& cd ../.. \
&& rm -r quazip
RUN git clone --depth 1 https://github.com/euroelessar/jreen.git --branch master --single-branch jreen \
&& mkdir jreen/build && cd jreen/build \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \
&& sudo cmake --build . -j 16 --target install \
&& cd ../.. \
&& rm -r jreen
# Language
ENV LANG=en_US.UTF-8
RUN echo "$LANG UTF-8" > /etc/locale.gen && locale-gen $LANG && update-locale LANG=$LANG
#entrypoint, if it is last here makes it easy to build new image without rebuilding all layers
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
COPY build-and-test.sh /usr/local/bin/build-and-test.sh
RUN chmod +x /usr/local/bin/build-and-test.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
WORKDIR /tmp/workspace

8
Docker/build-and-test.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
mkdir build
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=${BUILD_TYPE:-Debug} ..
ninja
ninja install
env CTEST_OUTPUT_ON_FAILURE=1 ninja test

79
Docker/docker-commands.sh Executable file
View File

@@ -0,0 +1,79 @@
#!/bin/bash
get_repository_root(){
local REPOSITORY_ROOT="$(git rev-parse --show-toplevel)"
echo "$REPOSITORY_ROOT"
}
get_repository_subdir(){
REPOSITORY_ROOT=$(get_repository_root)
CUR_DIR=$(pwd)
SUB_DIR=$(echo "$CUR_DIR" | grep -oP "^$REPOSITORY_ROOT\K.*")
echo "$SUB_DIR"
}
# Run commands inside docker container
_docker_run() {
REPOSITORY_ROOT=$(get_repository_root)
SUB_DIR=$(get_repository_subdir)
echo "SUB_DIR: " "$SUB_DIR"
source $REPOSITORY_ROOT/Docker/Docker.variables
echo "Starting container: " "$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_VER"
echo "Got command: " "$*"
USER_ID=$(id -u $USER)
echo "Using USER_ID:" $USER_ID
docker run --env LOCAL_USER_ID=$USER_ID \
--rm \
--volume $REPOSITORY_ROOT:/tmp/workspace \
--workdir /tmp/workspace$SUB_DIR \
--env "TERM=xterm-256color" \
--tty \
--privileged \
"$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_VER" \
$*
}
# 1st command: Run make target inside docker
docker-make() {
_docker_run make "${@}"
}
# 2nd command: Run bash command inside docker
docker-run() {
_docker_run "${@}"
}
# 3rd command: Run bash interactive inside docker
docker-interactive() {
REPOSITORY_ROOT=$(get_repository_root)
SUB_DIR=$(get_repository_subdir)
echo "SUB_DIR: " "$SUB_DIR"
source $REPOSITORY_ROOT/Docker/Docker.variables
echo "Starting container: " "$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_VER"
echo "Got command: " "$*"
USER_ID=$(id -u $USER)
echo "Using USER_ID:" $USER_ID
docker run --env LOCAL_USER_ID=$USER_ID \
--rm \
--interactive \
--volume $REPOSITORY_ROOT:/tmp/workspace \
--workdir /tmp/workspace$SUB_DIR \
--env "TERM=xterm-256color" \
--tty \
"$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_VER" /bin/bash
}
docker-help() {
echo "docker-make - Run a make target inside docker container"
echo "docker-run - Run a specific bash command inside docker container and remove container on exit"
echo "docker-interactive - Start an interactive bash session inside docker container and remove it on exit"
echo "docker-help - Show this help text"
}

30
Docker/entrypoint.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/bash
# Add local user
# Either use the LOCAL_USER_ID if passed in at runtime or
# fallback
USER_ID=${LOCAL_USER_ID:-9001}
USER=docker
UPWD=Docker!
echo "Starting with USER: $USER and UID : $USER_ID"
useradd --shell /bin/bash -u $USER_ID -o -c "docker user" -m "$USER"
export HOME=/home/$USER
# Add user to sudoers
echo "docker ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/10-installer
# Add root password
echo "root":$UPWD | chpasswd
# Add user password
echo "$USER:$UPWD" | chpasswd
if [ -z "$CLANG_VERSION" ]; then
echo "No CLANG_VERSION set"
else
echo "alias clang=clang-$CLANG_VERSION" >> $HOME/.bashrc
echo "alias clang-tidy=clang-tidy-$CLANG_VERSION" >> $HOME/.bashrc
echo "alias clang-format=clang-format-$CLANG_VERSION" >> $HOME/.bashrc
fi
# Startup user
exec gosu "$USER" "$@"