diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1936cc1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +html diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6c74687 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: python +python: + - "3.6" + +env: + global: + - GIT_COMMITTER_NAME="SymbiYosys Travis Bot" + - GIT_COMMITTER_EMAIL="nobody@nowhere.com" + +script: + - ./.travis/generate-html.sh + +after_install: + - if [ ! -z "$GH_KEY" ]; then ./.travis/push-html.sh; fi diff --git a/.travis/generate-html.sh b/.travis/generate-html.sh new file mode 100755 index 0000000..11e109c --- /dev/null +++ b/.travis/generate-html.sh @@ -0,0 +1,28 @@ +#! /bin/bash + +set -e + +export CURRENT_OWNER="$(git remote get-url origin | sed -e's@/[^/]\+$@@' -e's@.*[:/]\([^:/]\+\)$@\1@')" + +SRCDIR=$PWD +TMPDIR=$(mktemp -d) + +# Remove any pre-existing html output. +for d in html/*; do + if [ -d "$d" ]; then + rm -rf $d + fi +done + +# Try a users version of the repo first, then try the SymbiFlow version if that fails. +git clone git+ssh://github.com/$CURRENT_OWNER/prjxray.git $TMPDIR/prjxray || git clone git+ssh://github.com/SymbiFlow/prjxray.git $TMPDIR/prjxray + +for s in $(find -name settings.sh); do + echo + echo "Generating for $s" + echo "--------------------------------------------" + python3 $TMPDIR/prjxray/htmlgen/htmlgen.py --settings=$s; + echo "--------------------------------------------" +done + +find -type f html | sort diff --git a/.travis/push-html.sh b/.travis/push-html.sh new file mode 100755 index 0000000..378b75f --- /dev/null +++ b/.travis/push-html.sh @@ -0,0 +1,61 @@ +#! /bin/bash + +set -e + +if [ ! -d html ]; then + echo "Please generate the html files first." + exit 1 +fi + +export GIT_AUTHOR_NAME="$(git log -1 --pretty=%an)" +export GIT_AUTHOR_EMAIL="$(git log -1 --pretty=%ae)" + +export CURRENT_OWNER="$(git remote get-url origin | sed -e's@/[^/]\+$@@' -e's@.*[:/]\([^:/]\+\)$@\1@')" +export CURRENT_REVISION="$(git describe --always)" +export CURRENT_MESSAGE="$(git log -1 --pretty=%s)" + +SRCDIR=$PWD +TMPDIR=$(mktemp -d) + +( + cd $TMPDIR + + # Clone the destination + git clone git+ssh://github.com/$CURRENT_OWNER/prjxray-db.git --reference $SRCDIR/.git -b gh-pages html + ( + cd html + git fetch + ) + rm -rf html/* + + cp -a $SRCDIR/html/* html/ + ( + cd html + git add --all . + + echo + echo "Committing" + echo "--------------------------------------------" + git status + echo "--------------------------------------------" + + if [ ! -z "$TRAVIS" ]; then + git commit -a \ + -m "Travis build #$TRAVIS_BUILD_NUMBER of $CURRENT_REVISION" \ + -m "" \ + -m "From https://github.com/$TRAVIS_REPO_SLUG/tree/$TRAVIS_COMMIT" \ + -m "$TRAVIS_COMIT_MESSAGE" + else + git commit -a \ + -m "Manual build of $CURRENT_REVISION" \ + -m "" \ + -m "$CURRENT_MESSAGE" + fi + echo + echo "Pushing" + echo "--------------------------------------------" + git push origin + echo "--------------------------------------------" + ) +) +