Started automated building

This commit is contained in:
Adsooi 2024-09-19 23:28:21 +02:00
parent f43050e74f
commit dd21b21829
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
10 changed files with 272 additions and 11 deletions

View file

@ -28,4 +28,18 @@ Additionally, the linux-6*-latex tag include a full TeXlive installation includi
---
## Building docker files
It's recommended to use the `build.sh` bash script to build the Docker image. They use the `config.toml` in each directory to provide the data for each build,
including the specific PySide versions to use for each.
Usage:
`bash build.sh [--pyside2] [--pyside6] [--latest] [--no-push] [--repo=ad5001/ubuntu-pyside-xvfb]`
- --pyside2: Build PySide2 images.
- --pyside6: Build PySide6 images.
- --latest: (Optional) Tag these as latest.
- --no-push: (Optional) Do not push the tags to the Docker registry.
- --repo: (Optional) Repository on the Docker registry which to push the images to.
NOTE: In Docker, use xvfb-run to run a program within a Xvfb server.

150
build.sh Normal file
View file

@ -0,0 +1,150 @@
#!/bin/bash
#
# Copyright (c) 2021-2024 Ad5001
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# shellcheck disable=SC2046
# Resets all ansi codes.
RESET="\e[0m"
# Sets the forground color to light green.
L_GREEN_FG="\e[32m"
# Sets the forground color to red.
RED_FG="\e[38;5;204m"
# Display text in a box
# Signature: (<string message>) -> string
box() {
len=${#1}
echo "┌─$(yes ─ | head -$len | tr -d "\n")─┐"
echo "$1"
echo "└─$(yes ─ | head -$len | tr -d "\n")─┘"
}
box_red() {
echo -n "$RED_FG"
box "$@"
echo -n "$RESET"
}
box_green() {
echo -n "$L_GREEN_FG"
box "$@"
echo -n "$RESET"
}
# Converts arguments from an INI/singular dict TOML file into a list of build args for docker.
# Signature: (<string source_file>) -> string
config_to_docker_args() {
grep '="' "$1" | sed 's@^@--build-arg @g' | paste -s -d " "
}
# Queries a value from an INI/singular dict TOML file into for a given key
# Signature: (<string source_file>, <string key>) -> string
query_from_config() {
grep "$2=" "$1" | cut -d'"' -f 2
}
pyside6=false
pyside2=false
latest=false
push=true
repo="ad5001/ubuntu-pyside-xvfb"
# Query arguments
while [ $# -gt 0 ]; do
case "$1" in
--pyside6)
pyside6=true
;;
--pyside2)
pyside2=true
;;
--latest)
latest=true
;;
--no-push)
push=false
;;
--repo=*)
repo="${1#*=}"
;;
*)
box "Error: Invalid argument."
exit 1
esac
shift
done
if [ "$pyside6" = "false" ] && [ "$pyside2" = "false" ]; then
box "Must at least either use --pyside2 or --pyside6"
fi
# Build PySide6
if [ "$pyside6" != "false" ]; then
config="pyside6/config.toml"
version=$(query_from_config "$config" "PYSIDE6_VERSION")
tag_linux="${repo}:linux-${version}"
tag_wine="${repo}:wine-${version}"
tag_linux_latex="${repo}:linux-${version}-latex"
# Building
box "Building PySide6 Linux Image..."
docker build -t "${tag_linux}" $(config_to_docker_args "$config") pyside6/linux
box "Building PySide6 Wine Image..."
docker build -t "${tag_wine}" $(config_to_docker_args "$config") pyside6/wine
box "Building PySide6 Linux-Latex Image..."
docker build -t "${tag_linux_latex}" $(config_to_docker_args "$config") --build-arg BASE_IMAGE="${tag_linux}" pyside6/linux-latex
# Tagging
if [ "$latest" != "false" ]; then
docker tag "${tag_linux}" "${repo}:linux-6-latest"
docker tag "${tag_wine}" "${repo}:wine-6-latest"
docker tag "${tag_linux_latex}" "${repo}:linux-6-latest-latex"
fi
# Pushing
if [ "$push" != "true" ]; then
docker push "${tag_linux}"
docker push "${tag_wine}"
docker push "${tag_linux_latex}"
if [ "$latest" != "false" ]; then
docker push "${repo}:linux-6-latest"
docker push "${repo}:wine-6-latest"
docker push "${repo}:linux-6-latest-latex"
fi
fi
fi
# Build PySide2
if [ "$pyside2" != "false" ]; then
config="pyside2/config.toml"
version=$(query_from_config "$config" "PYSIDE2_VERSION")
tag_linux="${repo}:linux-${version}"
tag_wine="${repo}:wine-${version}"
# Building
box "Building PySide2 Linux Image..."
docker build -t "${tag_linux}" $(config_to_docker_args "$config") pyside2/linux
box "Building PySide2 Wine Image..."
docker build -t "${tag_wine}" $(config_to_docker_args "$config") pyside2/wine
# Tagging
if [ "$latest" != "false" ]; then
docker tag "${tag_linux}" "${repo}:linux-5-latest"
docker tag "${tag_wine}" "${repo}:wine-5-latest"
fi
# Pushing
if [ "$push" != "true" ]; then
docker push "${tag_linux}"
docker push "${tag_wine}"
if [ "$latest" != "false" ]; then
docker push "${repo}:linux-5-latest"
docker push "${repo}:wine-5-latest"
fi
fi
fi

18
pyside2/config.toml Normal file
View file

@ -0,0 +1,18 @@
#
# Copyright (c) 2021-2024 Ad5001
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
PYSIDE2_VERSION="5.12.2.1"
# Arguments for wine builds
PYTHON_VERSION="3.10.11"
PYINSTALLER_VERSION="6.10.0"

View file

@ -1,3 +1,15 @@
#
# Copyright (c) 2021-2024 Ad5001
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
FROM ubuntu:jammy
# Jammy uses python3.10 and not 3.12, which is not compatible with PySide2.
@ -8,7 +20,7 @@ ENV TZ=Europe/Paris
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get -y install make git rpm dh-python \
xvfb xdotool wmctrl \
xvfb xdotool wmctrl libxcb-cursor0 \
python3 python3-pip python3-stdeb python3-requests python3-packaging python3-pip python3-pytest python3-pytest-cov python3-pytestqt \
qml-module-qtquick-controls2 qml-module-qtmultimedia qml-module-qtgraphicaleffects qml-module-qtquick2 qml-module-qtqml-models2 qml-module-qtquick-controls
RUN python3 -m pip install -U pip py certifi setuptools wheel # Upgrading packages that need fixes.

View file

@ -1,3 +1,15 @@
#
# Copyright (c) 2021-2024 Ad5001, 2016 Chris R
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
FROM ubuntu:noble
ARG PYSIDE2_VERSION=5.15.2.1
@ -9,7 +21,7 @@ ENV DEBIAN_FRONTEND noninteractive
ARG WINE_VERSION=winehq-staging
ARG PYTHON_VERSION=3.10.11 # Python3.10 are the last supported version of Python for PySide2.
ARG PYINSTALLER_VERSION=5.0.1
ARG PYINSTALLER_VERSION=6.10.0
# we need wine for this all to work, so we'll use the PPA
RUN set -x \

View file

@ -1,6 +0,0 @@
FROM ad5001/ubuntu-pyside-xvfb:linux-6.7.2
ENV TZ=Europe/Paris
RUN apt-get update
RUN apt-get -y install texlive-base dvipng texlive-latex-extra
RUN apt clean

18
pyside6/config.toml Normal file
View file

@ -0,0 +1,18 @@
#
# Copyright (c) 2021-2024 Ad5001
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
PYSIDE6_VERSION="6.7.2"
# Arguments for wine builds
PYTHON_VERSION="3.12.6"
PYINSTALLER_VERSION="6.10.0"

View file

@ -0,0 +1,20 @@
#
# Copyright (c) 2021-2024 Ad5001
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
ARG BASE_IMAGE=ad5001/ubuntu-pyside-xvfb:linux-6-latest
FROM ${BASE_IMAGE}
ENV TZ=Europe/Paris
RUN apt-get update
RUN apt-get -y install texlive-base dvipng texlive-latex-extra
RUN apt clean

View file

@ -1,3 +1,14 @@
#
# Copyright (c) 2021-2024 Ad5001
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
FROM ubuntu:noble
ARG DEBIAN_FRONTEND=noninteractive
@ -7,7 +18,7 @@ ENV TZ=Europe/Paris
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get -y install make git rpm dh-python \
xvfb xdotool wmctrl \
xvfb xdotool wmctrl libxcb-cursor0 \
python3 python3-pip python3-stdeb python3-requests python3-packaging python3-pip python3-pytest python3-pytest-cov python3-pytestqt
RUN rm /usr/lib/python3.*/EXTERNALLY-MANAGED # Disable managed environment. We don't care about breaking system packages here.
RUN python3 -m pip install -U setuptools # Upgrading packages that need fixes.

View file

@ -1,6 +1,18 @@
#
# Copyright (c) 2021-2024 Ad5001, 2016 Chris R
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
FROM ubuntu:noble
ARG PYSIDE2_VERSION=6.7.2
ARG PYSIDE6_VERSION=6.7.2
# Adapted from https://github.com/cdrx/docker-pyinstaller/blob/master/Dockerfile-py3-win64
# Upstream hasn't been updated for a while.
@ -78,4 +90,4 @@ RUN set -x \
RUN apt install -y wget curl p7zip-full git unzip nsis xvfb xdotool wmctrl
RUN apt clean
# Installing pyside6 & pyinstaller
RUN pip install wheel PySide6==$PYSIDE2_VERSION pyinstaller==$PYINSTALLER_VERSION requests pytest pytest-cov pytest-qt packaging
RUN pip install wheel PySide6==$PYSIDE6_VERSION pyinstaller==$PYINSTALLER_VERSION requests pytest pytest-cov pytest-qt packaging