ci(tests): add test framework (#1603)

This commit is contained in:
ReenigneArcher 2024-03-24 19:52:24 -04:00 committed by GitHub
commit 89e8b9628c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 1519 additions and 136 deletions

View file

@ -43,7 +43,8 @@ pacman -Syu --disable-download-timeout --needed --noconfirm \
cmake \
cuda \
git \
namcap
namcap \
xorg-server-xvfb
_DEPS
# Setup builder user
@ -84,6 +85,8 @@ RUN mv /build/sunshine/build/sunshine.install .
RUN <<_PKGBUILD
#!/bin/bash
set -e
export DISPLAY=:1
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
namcap -i PKGBUILD
makepkg -si --noconfirm
rm -f /build/sunshine/pkg/sunshine-debug*.pkg.tar.zst

View file

@ -14,6 +14,8 @@ FROM toolchain-base as toolchain
ARG TARGETPLATFORM
RUN echo "target_platform: ${TARGETPLATFORM}"
ENV DISPLAY=:0
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# install dependencies
RUN <<_DEPS
@ -24,10 +26,12 @@ apt-get install -y --no-install-recommends \
build-essential \
cmake=3.22.* \
ca-certificates \
doxygen \
gcc=4:11.2.* \
g++=4:11.2.* \
gdb \
git \
graphviz \
libayatana-appindicator3-dev \
libavdevice-dev \
libboost-filesystem-dev=1.74.* \
@ -54,8 +58,12 @@ apt-get install -y --no-install-recommends \
libxfixes-dev \
libxrandr-dev \
libxtst-dev \
python3.10 \
python3.10-venv \
udev \
wget
wget \
x11-xserver-utils \
xvfb
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
apt-get install -y --no-install-recommends \
libmfx-dev
@ -98,3 +106,28 @@ chmod a+x ./cuda.run
./cuda.run --silent --toolkit --toolkitpath=/usr/local --no-opengl-libs --no-man-page --no-drm
rm ./cuda.run
_INSTALL_CUDA
WORKDIR /
# Write a shell script that starts Xvfb and then runs a shell
RUN <<_ENTRYPOINT
#!/bin/bash
set -e
cat <<EOF > /entrypoint.sh
#!/bin/bash
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
if [ "\$#" -eq 0 ]; then
exec "/bin/bash"
else
exec "\$@"
fi
EOF
_ENTRYPOINT
# Make the script executable
RUN chmod +x /entrypoint.sh
# Note about CLion
RUN echo "ATTENTION: CLion will override the entrypoint, you can disable this in the toolchain settings"
# Use the shell script as the entrypoint
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -32,7 +32,9 @@ apt-get update -y
apt-get install -y --no-install-recommends \
build-essential \
cmake=3.25.* \
doxygen \
git \
graphviz \
libavdevice-dev \
libayatana-appindicator3-dev \
libboost-filesystem-dev=1.74.* \
@ -61,8 +63,12 @@ apt-get install -y --no-install-recommends \
libxtst-dev \
nodejs \
npm \
python3.11 \
python3.11-venv \
udev \
wget
wget \
x11-xserver-utils \
xvfb
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
apt-get install -y --no-install-recommends \
libmfx-dev
@ -120,6 +126,17 @@ make -j "$(nproc)"
cpack -G DEB
_MAKE
# run tests
WORKDIR /build/sunshine/build/tests
# hadolint ignore=SC1091
RUN <<_TEST
#!/bin/bash
set -e
export DISPLAY=:1
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
./test_sunshine --gtest_color=yes
_TEST
FROM scratch AS artifacts
ARG BASE
ARG TAG

View file

@ -33,7 +33,9 @@ apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
cmake=3.18.* \
doxygen \
git \
graphviz \
libavdevice-dev \
libayatana-appindicator3-dev \
libboost-filesystem-dev=1.74.* \
@ -60,8 +62,12 @@ apt-get install -y --no-install-recommends \
libxfixes-dev \
libxrandr-dev \
libxtst-dev \
python3.9 \
python3.9-venv \
udev \
wget
wget \
x11-xserver-utils \
xvfb
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
apt-get install -y --no-install-recommends \
libmfx-dev
@ -134,6 +140,17 @@ make -j "$(nproc)"
cpack -G DEB
_MAKE
# run tests
WORKDIR /build/sunshine/build/tests
# hadolint ignore=SC1091
RUN <<_TEST
#!/bin/bash
set -e
export DISPLAY=:1
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
./test_sunshine --gtest_color=yes
_TEST
FROM scratch AS artifacts
ARG BASE
ARG TAG

View file

@ -32,9 +32,11 @@ dnf -y group install "Development Tools"
dnf -y install \
boost-devel-1.78.0* \
cmake-3.27.* \
doxygen \
gcc-13.2.* \
gcc-c++-13.2.* \
git \
graphviz \
libappindicator-gtk3-devel \
libcap-devel \
libcurl-devel \
@ -58,9 +60,11 @@ dnf -y install \
openssl-devel \
opus-devel \
pulseaudio-libs-devel \
python3.10 \
rpm-build \
wget \
which
which \
xorg-x11-server-Xvfb
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
dnf -y install intel-mediasdk-devel
fi
@ -117,6 +121,17 @@ make -j "$(nproc)"
cpack -G RPM
_MAKE
# run tests
WORKDIR /build/sunshine/build/tests
# hadolint ignore=SC1091
RUN <<_TEST
#!/bin/bash
set -e
export DISPLAY=:1
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
./test_sunshine --gtest_color=yes
_TEST
FROM scratch AS artifacts
ARG BASE
ARG TAG

View file

@ -32,9 +32,11 @@ dnf -y group install "Development Tools"
dnf -y install \
boost-devel-1.81.0* \
cmake-3.27.* \
doxygen \
gcc-13.2.* \
gcc-c++-13.2.* \
git \
graphviz \
libappindicator-gtk3-devel \
libcap-devel \
libcurl-devel \
@ -58,9 +60,11 @@ dnf -y install \
openssl-devel \
opus-devel \
pulseaudio-libs-devel \
python3.11 \
rpm-build \
wget \
which
which \
xorg-x11-server-Xvfb
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
dnf -y install intel-mediasdk-devel
fi
@ -124,6 +128,17 @@ make -j "$(nproc)"
cpack -G RPM
_MAKE
# run tests
WORKDIR /build/sunshine/build/tests
# hadolint ignore=SC1091
RUN <<_TEST
#!/bin/bash
set -e
export DISPLAY=:1
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
./test_sunshine --gtest_color=yes
_TEST
FROM scratch AS artifacts
ARG BASE
ARG TAG

View file

@ -32,9 +32,11 @@ apt-get update -y
apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
doxygen \
gcc-10=10.5.* \
g++-10=10.5.* \
git \
graphviz \
libayatana-appindicator3-dev \
libavdevice-dev \
libboost-filesystem-dev=1.71.* \
@ -61,8 +63,12 @@ apt-get install -y --no-install-recommends \
libxfixes-dev \
libxrandr-dev \
libxtst-dev \
python3.9 \
python3.9-venv \
udev \
wget
wget \
x11-xserver-utils \
xvfb
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
apt-get install -y --no-install-recommends \
libmfx-dev
@ -170,6 +176,17 @@ make -j "$(nproc)"
cpack -G DEB
_MAKE
# run tests
WORKDIR /build/sunshine/build/tests
# hadolint ignore=SC1091
RUN <<_TEST
#!/bin/bash
set -e
export DISPLAY=:1
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
./test_sunshine --gtest_color=yes
_TEST
FROM scratch AS artifacts
ARG BASE
ARG TAG

View file

@ -33,7 +33,9 @@ apt-get install -y --no-install-recommends \
build-essential \
cmake=3.22.* \
ca-certificates \
doxygen \
git \
graphviz \
libayatana-appindicator3-dev \
libavdevice-dev \
libboost-filesystem-dev=1.74.* \
@ -60,8 +62,12 @@ apt-get install -y --no-install-recommends \
libxfixes-dev \
libxrandr-dev \
libxtst-dev \
python3.10 \
python3.10-venv \
udev \
wget
wget \
x11-xserver-utils \
xvfb
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
apt-get install -y --no-install-recommends \
libmfx-dev
@ -135,6 +141,17 @@ make -j "$(nproc)"
cpack -G DEB
_MAKE
# run tests
WORKDIR /build/sunshine/build/tests
# hadolint ignore=SC1091
RUN <<_TEST
#!/bin/bash
set -e
export DISPLAY=:1
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
./test_sunshine --gtest_color=yes
_TEST
FROM scratch AS artifacts
ARG BASE
ARG TAG