Просмотр исходного кода

Merge pull request #388 from rcorre/docker

Add a Dockerfile for local reference updates.
Lu Jiacheng 4 лет назад
Родитель
Сommit
be76c4e7d1
4 измененных файлов с 55 добавлено и 6 удалено
  1. 28 0
      Dockerfile
  2. 2 6
      Makefile
  3. 21 0
      README.md
  4. 4 0
      tests/entrypoint.sh

+ 28 - 0
Dockerfile

@@ -0,0 +1,28 @@
+FROM ubuntu:xenial
+
+ENV BLENDER_VERSION 2.81
+
+RUN apt-get update
+RUN apt-get install --no-install-recommends -y \
+    libsdl1.2debian \
+    libglu1 python3-pip \
+    bash \
+    wget \
+    bzip2 \
+    make \
+    libxi6 \
+    libxrender1
+RUN pip3 install --upgrade pip
+RUN pip3 install --upgrade setuptools
+
+COPY requirements.txt .
+RUN pip3 install -r requirements.txt
+
+COPY tests/install_blender.sh .
+
+RUN bash install_blender.sh ${BLENDER_VERSION}
+
+VOLUME /workdir
+WORKDIR /workdir
+
+ENTRYPOINT ["tests/entrypoint.sh"]

+ 2 - 6
Makefile

@@ -25,12 +25,8 @@ test-import: export-blends
 
 
 update-examples:
-	mkdir -p tests/reference_exports
-	find tests/godot_project/exports/ -name *.escn | while read f; \
-	do \
-		mkdir -p "tests/reference_exports/$$(echo $$f | cut -d/ -f4)"; \
-		cp "$$f" "tests/reference_exports/$$(echo $$f | cut -d/ -f4-)"; \
-	done;
+	rm -r tests/reference_exports/*
+	cp -r tests/godot_project/exports/* tests/reference_exports/
 
 compare: export-blends
 	diff -x "*.escn.import" -rq tests/godot_project/exports/ tests/reference_exports/

+ 21 - 0
README.md

@@ -52,6 +52,27 @@ diff test failure:
    -  You can run a `make export-blends` followed by a `make update-examples` and commit the changes made to the [reference_exports](tests/reference_exports). However, if you are running on a platform different than the one used by the TravisCI, there is a small chance that regression won't be passing because of float rounding. Then you might need to look at the TravisCI log and fix the remaining issue by hand.
    - Or you can use the [update_scene_from_travis.sh](tests/update_scene_from_travis.sh) script, run it with the failing TravisCI job ID as the argument. The script will fetch the scene diffs from the Travis machine to your local git repository and apply it.
 
+## Docker
+
+The reference exports depend on a very specific version of Blender, and may
+produce different results with your local blender version. A Dockerfile is
+provided to help test and update examples:
+
+To build:
+```
+sudo docker build . -t godot_blender_exporter:latest
+```
+
+To test:
+```
+docker run --volume .:/tests/reference_exports godot_blender_exporter:latest compare
+```
+
+To update reference exports:
+```
+docker run --volume .:/tests/reference_exports godot_blender_exporter:latest export-blends update-examples
+```
+
 ## License
 
 This Godot exporter is distributed under the terms of the GNU General

+ 4 - 0
tests/entrypoint.sh

@@ -0,0 +1,4 @@
+#!/bin/bash
+
+. ../.envs  # generated by install_blender.sh
+make BLENDER=${BLENDER_BIN} PYLINT='python3 -m pylint' $@