Make inital test run on debian, ubuntu, arch, fedora

This commit is contained in:
jaseg 2021-02-07 12:47:49 +01:00
parent 79db262858
commit 4a967682d4
12 changed files with 598 additions and 19 deletions

View file

@ -7,3 +7,4 @@ recursive-exclude upstream/poisson-disk-sampling/images *
recursive-exclude upstream/clipper-6.4.2/Documentation *
recursive-exclude upstream/CavalierContours tests/* examples/*
recursive-exclude upstream/argagg doc/* examples/* tests/*
recursive-exclude svg-flatten/build *

View file

@ -73,13 +73,18 @@ Note:
rustup default stable
cargo install usvg
pip3 install --user gerbolyze --no-binary gerbolyze
git clone --recurse-submodules https://git.jaseg.de/gerbolyze.git
cd gerbolyze
Ubuntu
~~~~~~
.. code-block:: shell
sudo apt install libopencv-dev libpugixml-dev libpangocairo-1.0-0 libpango1.0-dev libcairo2-dev clang make python3 git python3-wheel curl python3-pip python3-venv cargo
cargo install usvg
pip3 install --user gerbolyze --no-binary gerbolyze
python3 -m venv
source venv/bin/activate
python3 setup.py install
Fedora
~~~~~~
@ -89,12 +94,7 @@ Fedora
sudo dnf install python3 make clang opencv-devel pugixml-devel pango-devel cairo-devel rust cargo
cargo install usvg
git clone --recurse-submodules https://git.jaseg.de/gerbolyze.git
cd gerbolyze
python3 -m venv
source venv/bin/activate
python3 setup.py install
pip3 install --user gerbolyze --no-binary gerbolyze
Arch
~~~~
@ -107,6 +107,15 @@ Arch
rustup default stable
cargo install usvg
pip3 install --user gerbolyze --no-binary gerbolyze
Build from source (any distro)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
First, install prerequisites like shown above. Then,
.. code-block:: shell
git clone --recurse-submodules https://git.jaseg.de/gerbolyze.git
cd gerbolyze

9
podman/arch-testenv Normal file
View file

@ -0,0 +1,9 @@
FROM docker.io/archlinux:latest
MAINTAINER gerbolyze@jaseg.de
RUN pacman --noconfirm -Syu
RUN pacman --noconfirm -Sy pugixml opencv pango cairo git python make clang rustup cargo python-pip base-devel
RUN rustup install stable
RUN rustup default stable
RUN cargo install usvg

11
podman/debian-testenv Normal file
View file

@ -0,0 +1,11 @@
FROM docker.io/debian:latest
MAINTAINER gerbolyze@jaseg.de
RUN env DEBIAN_FRONTEND=noninteractive apt update -y
RUN env DEBIAN_FRONTEND=noninteractive apt install -y libopencv-dev libpugixml-dev libpangocairo-1.0-0 libpango1.0-dev libcairo2-dev clang make python3 git python3-wheel curl python3-pip python3-venv
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN sh -c '. ~/.cargo/env && rustup install stable'
RUN sh -c '. ~/.cargo/env && rustup default stable'
RUN sh -c '. ~/.cargo/env && cargo install usvg'

7
podman/fedora-testenv Normal file
View file

@ -0,0 +1,7 @@
FROM docker.io/fedora:latest
MAINTAINER gerbolyze@jaseg.de
RUN dnf update --refresh -y
RUN dnf install -y python3 make clang opencv-devel pugixml-devel pango-devel cairo-devel rust cargo
RUN cargo install usvg

BIN
podman/testdata/gerbolyze-2.0.0.tar.gz vendored Normal file

Binary file not shown.

515
podman/testdata/test_svg_readme.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 143 KiB

5
podman/testdata/testscript.sh vendored Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
pip3 install --user /data/gerbolyze-*.tar.gz --no-binary gerbolyze
/root/.local/bin/svg-flatten --clear-color black --dark-color white --format svg /data/test_svg_readme.svg /out/test_out.svg

7
podman/ubuntu-testenv Normal file
View file

@ -0,0 +1,7 @@
FROM docker.io/ubuntu:latest
MAINTAINER gerbolyze@jaseg.de
RUN env DEBIAN_FRONTEND=noninteractive apt update -y
RUN env DEBIAN_FRONTEND=noninteractive apt install -y libopencv-dev libpugixml-dev libpangocairo-1.0-0 libpango1.0-dev libcairo2-dev clang make python3 git python3-wheel curl python3-pip python3-venv cargo
RUN cargo install usvg

14
run-tests.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
set -e
python setup.py sdist build
cp dist/*.tar.gz podman/testdata
for distro in arch fedora debian ubuntu
do
podman build -t gerbolyze-$distro-testenv -f podman/$distro-testenv
mkdir -p /tmp/gerbolyze-test-out
podman run --mount type=bind,src=podman/testdata,dst=/data,ro --mount type=bind,src=/tmp/gerbolyze-test-out,dst=/out gerbolyze-$distro-testenv /data/testscript.sh
done

View file

@ -1,6 +1,6 @@
CXX := clang++
LD := ld
LD ?= ld
INSTALL := install
PKG_CONFIG ?= pkg-config
@ -46,7 +46,8 @@ CXXFLAGS += $(shell $(PKG_CONFIG) --cflags opencv4 2> /dev/null || $(PKG_CONFIG)
LDFLAGS := -lm -lc -lstdc++
LDFLAGS += $(shell $(PKG_CONFIG) --libs $(PKG_CONFIG_DEPS))
# debian hack. see above.
LDFLAGS += $(shell $(PKG_CONFIG) --libs opencv4 2> /dev/null || $(PKG_CONFIG) --libs opencv 2>/dev/null)
OPENCV_LDFLAGS := $(shell $(PKG_CONFIG) --libs opencv4 2> /dev/null || $(PKG_CONFIG) --libs opencv 2>/dev/null)
LDFLAGS += $(shell echo $(OPENCV_LDFLAGS) | sed 's/-l\S\+ //g') -lopencv_core -lopencv_imgproc -lopencv_imgcodecs
TARGET := svg-flatten
@ -65,7 +66,7 @@ $(BUILDDIR)/%.o: %.cpp
$(BUILDDIR)/$(TARGET): $(SOURCES:%.cpp=$(BUILDDIR)/%.o)
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ -lstdc++fs
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ -Wl,--start-group $^ -lstdc++fs -Wl,--end-group
.PHONY: install
install:

View file

@ -168,7 +168,7 @@ int main(int argc, char **argv) {
precision = atoi(args["precision"]);
}
string fmt = args["ofmt"] ? args["ofmt"] : "gerber";
string fmt = args["ofmt"] ? args["ofmt"].as<string>() : "gerber";
transform(fmt.begin(), fmt.end(), fmt.begin(), [](unsigned char c){ return std::tolower(c); }); /* c++ yeah */
string sexp_layer = args["sexp_layer"] ? args["sexp_layer"].as<string>() : "auto";
@ -179,8 +179,8 @@ int main(int argc, char **argv) {
PolygonSink *flattener = nullptr;
PolygonSink *dilater = nullptr;
if (fmt == "svg") {
string dark_color = args["svg_dark_color"] ? args["svg_dark_color"] : "#000000";
string clear_color = args["svg_clear_color"] ? args["svg_clear_color"] : "#ffffff";
string dark_color = args["svg_dark_color"] ? args["svg_dark_color"].as<string>() : "#000000";
string clear_color = args["svg_clear_color"] ? args["svg_clear_color"].as<string>() : "#ffffff";
sink = new SimpleSVGOutput(*out_f, only_polys, precision, dark_color, clear_color);
} else if (fmt == "gbr" || fmt == "grb" || fmt == "gerber") {
@ -232,7 +232,7 @@ int main(int argc, char **argv) {
sel.layers = &gerbolyze::kicad_default_layers;
}
string vectorizer = args["vectorizer"] ? args["vectorizer"] : "poisson-disc";
string vectorizer = args["vectorizer"] ? args["vectorizer"].as<string>() : "poisson-disc";
/* Check argument */
ImageVectorizer *vec = makeVectorizer(vectorizer);
if (!vec) {
@ -408,7 +408,7 @@ int main(int argc, char **argv) {
}
}
VectorizerSelectorizer vec_sel(vectorizer, args["vectorizer_map"] ? args["vectorizer_map"] : "");
VectorizerSelectorizer vec_sel(vectorizer, args["vectorizer_map"] ? args["vectorizer_map"].as<string>() : "");
RenderSettings rset {
min_feature_size,
vec_sel,