From 42a01f00466769b63cf03ec73898ecfb43e3aee8 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Fri, 13 Sep 2019 11:05:05 -0400 Subject: [PATCH] Add a CI job which runs depgraph. It can also push the results to GitHub pages. --- .circleci/config.yml | 16 ++++++++++++++++ misc/python3/depgraph.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 misc/python3/depgraph.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index cdf2f4e9e..f3c4877e8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -41,6 +41,10 @@ workflows: # # integration tests. # - "debian-9" + # Generate the underlying data for a visualization to aid with Python 3 + # porting. + - "build-porting-depgraph" + images: # Build the Docker images used by the ci jobs. This makes the ci jobs # faster and takes various spurious failures out of the critical path. @@ -292,6 +296,18 @@ jobs: - store_artifacts: *STORE_OTHER_ARTIFACTS - run: *SUBMIT_COVERAGE + build-porting-depgraph: + # Generate up-to-date data for the dependency graph visualizer. + docker: + - image: "python:3.7-buster" + + steps: + - "checkout" + - run: + name: "Generate dependency graph data" + command: | + ./misc/python3/depgraph.sh + build-image: &BUILD_IMAGE # This is a template for a job to build a Docker image that has as much of # the setup as we can manage already done and baked in. This cuts down on diff --git a/misc/python3/depgraph.sh b/misc/python3/depgraph.sh new file mode 100644 index 000000000..0be456b8b --- /dev/null +++ b/misc/python3/depgraph.sh @@ -0,0 +1,35 @@ +#!/bin/env bash + +set -x +set -eo pipefail + +# if [ "${CIRCLE_BRANCH}" != "master" ]; then +# echo "Declining to update dependency graph for non-master build." +# exit 0 +# fi + +git config user.name 'Build Automation' +git config user.email 'tahoe-dev@tahoe-lafs.org' + +TAHOE="${PWD}" +git clone git@github.com:tahoe-lafs/tahoe-depgraph.git +cd tahoe-depgraph + +# Generate the maybe-changed data. +python tahoe-depgraph.py "${TAHOE}" + +if git diff-index --quiet --cached HEAD; then + echo "Declining to commit without any changes." + exit 0 +fi + +# Commit everything that changed. It should be tahoe-deps.json and +# tahoe-ported.json. +git commit -am "\ +Built from ${CIRCLE_REPOSITORY_URL}@${CIRCLE_SHA1} + +tahoe-depgraph was $(git --git-dir ../.git rev-parse HEAD +" + +# Publish it on GitHub. +git push -q origin gh-pages