squash commits
This commit is contained in:
commit
0f545c5e4d
611 files changed
+272565
No files matched your search
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
##
|
||||
# Copyright 2018 Google Inc. All Rights Reserved.
|
||||
# Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
##
|
||||
|
||||
if [ "${TEST_TYPE}" = "fidelity" ]; then
|
||||
set -x
|
||||
|
||||
git checkout origin/gh-pages -- ./fidelity
|
||||
LAST_RESULT="`tail -n 1 ./fidelity/manifest`"
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z "$LAST_RESULT" ]; then
|
||||
echo "No previous fidelity results available for comparison!";
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
node ./scripts/compare-fidelity-results.js "./test/fidelity/results" "./fidelity/$LAST_RESULT"
|
||||
|
||||
set +e
|
||||
set +x
|
||||
fi
|
||||
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
##
|
||||
# Copyright 2018 Google Inc. All Rights Reserved.
|
||||
# Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
##
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
if [ -z "$TMPDIR" ]; then
|
||||
TMPDIR="/tmp/";
|
||||
fi
|
||||
|
||||
REF=$1
|
||||
CLONE_DIR="${TMPDIR}model-viewer-master"
|
||||
CURRENT_DIR="`pwd`"
|
||||
|
||||
if [ -d "$CLONE_DIR" ]; then
|
||||
rm -rf "$CLONE_DIR"
|
||||
fi
|
||||
|
||||
git clone --branch $REF ./ "$CLONE_DIR"
|
||||
cd "$CLONE_DIR"
|
||||
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
set +e
|
||||
|
||||
npm run check-fidelity
|
||||
|
||||
cd "$CURRENT_DIR"
|
||||
|
||||
node ./scripts/compare-fidelity-results.js "$CURRENT_DIR/test/fidelity/results" "$CLONE_DIR/test/fidelity/results"
|
||||
|
||||
set +x
|
||||
@@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
|
||||
##
|
||||
# Copyright 2018 Google Inc. All Rights Reserved.
|
||||
# Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
##
|
||||
|
||||
##
|
||||
# This script updates the screenshots of the third-party renderers that we are
|
||||
# able to compare to <model-viewer>`. If there are any changes to the
|
||||
# screenshots, the script then generates a branch and commits the screenshots to
|
||||
# it. Finally, it opens a PR against the main project on Github.
|
||||
#
|
||||
# NOTE: This script is only intended to be run as part of automation
|
||||
# infrastructure. It will probably work anywhere with the right environment
|
||||
# variables set but please use it with caution!
|
||||
##
|
||||
|
||||
if [ -z "$MODEL_VIEWER_CHECKOUT_DIRECTORY" ] || [ -z "$GIT_USER_EMAIL" ] || [ -z "$GIT_USER_NAME" ] || [ -z "$GITHUB_USER" ] || [ -z "$GITHUB_ACCESS_TOKEN" ] || [ -z "$MODEL_VIEWER_BASE_BRANCH" ]; then
|
||||
echo '🚨 Some variables needed to create screenshot update PR were not set!'
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
pushd $MODEL_VIEWER_CHECKOUT_DIRECTORY
|
||||
|
||||
# Take a new set of screenshots
|
||||
npm run update-screenshots
|
||||
|
||||
FIDELITY_SCREENSHOT_PATH=$MODEL_VIEWER_CHECKOUT_DIRECTORY/test/fidelity
|
||||
NUMBER_CHANGED_SCREENSHOTS=`git ls-files -m $FIDELITY_SCREENSHOT_PATH | wc -l`
|
||||
|
||||
# If any screenshots changed, we will be creating a branch and crafting a PR
|
||||
if [ "$NUMBER_CHANGED_SCREENSHOTS" -gt "0" ]; then
|
||||
UPDATES_BRANCH="screenshot-updates-`TZ='America/Los_Angeles' date +"%m-%d-%y"`"
|
||||
BRANCH_SHA=`git rev-parse --verify $UPDATES_BRANCH`
|
||||
|
||||
# If we already ran today, we already have a branch by this name so delete it
|
||||
if [ ! -z "$BRANCH_SHA" ]; then
|
||||
git branch -d $UPDATES_BRANCH
|
||||
fi
|
||||
|
||||
git checkout -b $UPDATES_BRANCH
|
||||
# Only add changes in the fidelity testing subtree
|
||||
git add $FIDELITY_SCREENSHOT_PATH
|
||||
|
||||
COMMIT_MESSAGE="🤖 Render fidelity updates as of `TZ='America/Los_Angeles' date`"
|
||||
git config user.name "$GIT_USER_NAME"
|
||||
git config user.email "$GIT_USER_EMAIL"
|
||||
git commit -m "$COMMIT_MESSAGE"
|
||||
git push -f origin $UPDATES_BRANCH
|
||||
|
||||
PULL_REQUEST_BODY="**NOTE**: This PR was automatically generated. It contains updated render results from third-party renderers for use in our fidelity tests. Please remember to take the following steps when reviewing:\n\n - Review the changed images and take note of any patterns (same renderer, same model etc)\n - Review fidelity test results in the CI build and take note of any reported changes\n\nTo read more about \`<model-viewer>\` fidelity testing and learn how to update these screenshots yourself, check out [this explainer](https://github.com/google/model-viewer/blob/master/test/fidelity/README.md).\n\nPlease refer to this [startup script](https://github.com/google/model-viewer/blob/master/scripts/render-vm-startup-script.sh) for technical details related to how this PR was produced.";
|
||||
|
||||
# Create the PR via Github's API
|
||||
curl --user "$GITHUB_USER:$GITHUB_ACCESS_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data "{ \"title\": \"$COMMIT_MESSAGE\", \"head\": \"$UPDATES_BRANCH\", \"base\": \"$MODEL_VIEWER_BASE_BRANCH\", \"body\": \"$PULL_REQUEST_BODY\", \"maintainer_can_modify\": true }" \
|
||||
https://api.github.com/repos/googlewebcomponents/model-viewer/pulls
|
||||
fi
|
||||
|
||||
popd
|
||||
@@ -0,0 +1,80 @@
|
||||
#!/bin/bash
|
||||
|
||||
##
|
||||
# Copyright 2018 Google Inc. All Rights Reserved.
|
||||
# Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
##
|
||||
|
||||
##
|
||||
# Provision an Ubuntu 18.04 VM for performing automated tasks on behalf of the
|
||||
# <model-viewer> project. VM is assumed to have an attached NVIDIA GPU. This
|
||||
# script doesn't guarantee idempotency, but it *should* be safe to run multiple
|
||||
# times.
|
||||
##
|
||||
|
||||
if [ -z "$MODEL_VIEWER_CHECKOUT_DIRECTORY" ]; then
|
||||
MODEL_VIEWER_CHECKOUT_DIRECTORY=`pwd`
|
||||
fi
|
||||
|
||||
# Set the DISPLAY so that headless windows launch correctly
|
||||
export DISPLAY=:0
|
||||
|
||||
# Set up build toolchain apt repos
|
||||
sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
|
||||
echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main" | sudo tee -a /etc/apt/sources.list >/dev/null
|
||||
|
||||
# Check for CUDA and try to install NVIDIA drivers
|
||||
if ! dpkg-query -W cuda-10-0; then
|
||||
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
|
||||
sudo dpkg -i ./cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
|
||||
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
|
||||
sudo apt-get update
|
||||
sudo apt-get install cuda-10-0 -y
|
||||
fi
|
||||
|
||||
# Enable persistence mode
|
||||
sudo nvidia-smi -pm 1
|
||||
|
||||
# Install build chain, graphics and X.org packages
|
||||
sudo apt-get install -y \
|
||||
xserver-xorg \
|
||||
freeglut3-dev \
|
||||
mesa-common-dev \
|
||||
mesa-utils \
|
||||
libxmu-dev \
|
||||
libglu1-mesa-dev \
|
||||
libc++-7-dev \
|
||||
libc++abi-7-dev \
|
||||
libstdc++-7-dev \
|
||||
clang-7 \
|
||||
cmake \
|
||||
ninja-build \
|
||||
libxi-dev
|
||||
|
||||
# Start X.org as a daemon
|
||||
sudo /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/X -- :0
|
||||
sleep 3 # Give X.org a few seconds to start up...
|
||||
|
||||
# Set up NVM and Node.js/NPM
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
nvm install --lts
|
||||
|
||||
pushd $MODEL_VIEWER_CHECKOUT_DIRECTORY
|
||||
|
||||
# Install NPM dependencies
|
||||
npm install
|
||||
|
||||
popd
|
||||
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##
|
||||
# Copyright 2018 Google Inc. All Rights Reserved.
|
||||
# Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
##
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
if [ -z "$TRAVIS_TAG" ]; then
|
||||
echo '$TRAVIS_TAG is not set!';
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
TEST_RESULTS="./test/fidelity/results"
|
||||
FIDELITY_ROOT="./fidelity"
|
||||
RECORD_MANIFEST="$FIDELITY_ROOT/manifest"
|
||||
OUTPUT_DIRECTORY="$FIDELITY_ROOT/$TRAVIS_TAG"
|
||||
|
||||
set +e
|
||||
|
||||
git checkout origin/gh-pages -- ./fidelity
|
||||
|
||||
set -e
|
||||
|
||||
if [[ ! -d $FIDELITY_ROOT ]]; then
|
||||
mkdir -p $FIDELITY_ROOT;
|
||||
fi
|
||||
|
||||
if [[ -d $OUTPUT_DIRECTORY ]]; then
|
||||
rm -rf $OUTPUT_DIRECTORY;
|
||||
fi
|
||||
|
||||
cp -r $TEST_RESULTS $OUTPUT_DIRECTORY
|
||||
|
||||
# All directories in the root are recorded in a file for later reference
|
||||
# by the frontend of the Github Pages deployment:
|
||||
ls -l $FIDELITY_ROOT | egrep '^d' | awk '{ print $9 }' > $RECORD_MANIFEST
|
||||
|
||||
set +x
|
||||
set +e
|
||||
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
##
|
||||
# Copyright 2018 Google Inc. All Rights Reserved.
|
||||
# Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
##
|
||||
|
||||
##
|
||||
# Render VM Startup Script
|
||||
#
|
||||
# This script is intended to be used in an Ubuntu 18.04 cloud VM with an NVIDIA
|
||||
# Tesla GPU. It is designed to run on startup, provision the VM if necessary,
|
||||
# collect screenshots and create a PR on Github if there are any changes.
|
||||
#
|
||||
# NOTE: In order to use this script as a startup script in your own VM,
|
||||
# uncomment the variables below and fill them in as appropriate, or else make
|
||||
# sure the environment variables are set before this script is run.
|
||||
##
|
||||
|
||||
# These values should definitely be customized:
|
||||
# export [email protected]
|
||||
# export GIT_USER_NAME="User Name"
|
||||
# export GITHUB_USER=example
|
||||
# export GITHUB_ACCESS_TOKEN=your-github-access-token-here
|
||||
|
||||
# These values may not need to be customized:
|
||||
export MODEL_VIEWER_REPOSITORY=https://$GITHUB_USER:$GITHUB_ACCESS_TOKEN@github.com/google/model-viewer.git
|
||||
export MODEL_VIEWER_CHECKOUT_DIRECTORY=$HOME/model-viewer
|
||||
export MODEL_VIEWER_BASE_BRANCH=master
|
||||
|
||||
##
|
||||
# NOTE: No need to modify below this line when configuring for deployment
|
||||
##
|
||||
|
||||
# Clone the repo if necessary
|
||||
if [ ! -d ./model-viewer ]; then
|
||||
git clone $MODEL_VIEWER_REPOSITORY $MODEL_VIEWER_CHECKOUT_DIRECTORY
|
||||
fi
|
||||
|
||||
pushd $MODEL_VIEWER_CHECKOUT_DIRECTORY
|
||||
|
||||
# Update <model-viewer> repo from the origin and reset the tracked branch
|
||||
git fetch origin
|
||||
git add .
|
||||
git reset --hard origin/$MODEL_VIEWER_BASE_BRANCH
|
||||
|
||||
popd
|
||||
|
||||
# Invoke relevant startup sub-scripts
|
||||
source $MODEL_VIEWER_CHECKOUT_DIRECTORY/scripts/provision-ubuntu-xenial-vm.sh
|
||||
source $MODEL_VIEWER_CHECKOUT_DIRECTORY/scripts/create-screenshot-update-pr.sh
|
||||
|
||||
sudo poweroff
|
||||
Reference in new issue
Block a user