From 022a918911817b1897fd69ea72da84054450c8cb Mon Sep 17 00:00:00 2001 From: ludamad Date: Thu, 4 Jan 2024 10:22:42 -0500 Subject: [PATCH] feat: barretenberg doxygen CI (#3818) First pass on doxygen CI. This is now uploading files to S3 based on running doxygen on the barretenberg codebase. - It's mostly a listing of everything's signature + source, and a few pieces of documentation. We can figure out a documentation plan from here - This needs to actually be pointed somewhere to be [slash]meaningful[/slash] convenient right now, but lives here https://aztec-ci-artifacts.s3.us-east-2.amazonaws.com/barretenberg-doxygen/3f0fad0de81d472cf71c03df11cf01ed6e7e09e0/index.html --------- Co-authored-by: ludamad Co-authored-by: Maddiaa <47148561+Maddiaa0@users.noreply.github.com> --- .circleci/config.yml | 16 ++++++++++++++++ barretenberg/cpp/.dockerignore | 5 ++++- barretenberg/cpp/docs/Dockerfile | 8 ++++++++ barretenberg/cpp/docs/Doxyfile | 19 +++++++++++++++++++ barretenberg/cpp/docs/deploy_doxygen.sh | 14 ++++++++++++++ build_manifest.yml | 4 ++++ 6 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 barretenberg/cpp/docs/Dockerfile create mode 100644 barretenberg/cpp/docs/Doxyfile create mode 100755 barretenberg/cpp/docs/deploy_doxygen.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 7237ac8093a..7581421ad38 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -192,6 +192,21 @@ jobs: name: "Build" command: cond_spot_run_build barretenberg-x86_64-linux-clang-sol 32 + barretenberg-docs: + machine: + image: ubuntu-2204:2023.07.2 + resource_class: large + steps: + - *checkout + - *setup_env + - run: + name: "Build barretenberg docs" + command: build barretenberg-docs + - run: + name: "Deploy barretenberg docs" + command: | + barretenberg/cpp/docs/deploy_doxygen.sh + barretenberg-stdlib-tests: docker: - image: aztecprotocol/alpine-build-image @@ -1091,6 +1106,7 @@ workflows: - barretenberg-x86_64-linux-clang-assert - noir-compile-acir-tests <<: *defaults + - barretenberg-docs: *defaults - bb-js: requires: - barretenberg-wasm-linux-clang diff --git a/barretenberg/cpp/.dockerignore b/barretenberg/cpp/.dockerignore index 7c18c4a13f9..27554eeebcc 100644 --- a/barretenberg/cpp/.dockerignore +++ b/barretenberg/cpp/.dockerignore @@ -20,4 +20,7 @@ !scripts/install-wasi-sdk.sh !scripts/strip-wasm.sh !./.clang-format -!./format.sh \ No newline at end of file +!./format.sh + +# Doxygen stuff. +!docs diff --git a/barretenberg/cpp/docs/Dockerfile b/barretenberg/cpp/docs/Dockerfile new file mode 100644 index 00000000000..509ab46e539 --- /dev/null +++ b/barretenberg/cpp/docs/Dockerfile @@ -0,0 +1,8 @@ +FROM alpine:3.18 AS builder +RUN apk update \ + && apk upgrade \ + && apk add --no-cache \ + doxygen +WORKDIR /usr/src/barretenberg/cpp/ +COPY . . +RUN doxygen docs/Doxyfile diff --git a/barretenberg/cpp/docs/Doxyfile b/barretenberg/cpp/docs/Doxyfile new file mode 100644 index 00000000000..c2f8de48099 --- /dev/null +++ b/barretenberg/cpp/docs/Doxyfile @@ -0,0 +1,19 @@ +# Minimal Doxyfile. See https://www.doxygen.nl/manual/config.html + +# Project related configuration options +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = "barretenberg" + +# Paths and filenames +INPUT = src/barretenberg +HTML_OUTPUT = docs/build +FILE_PATTERNS = *.c \ + *.cpp \ + *.h \ + *.hpp +RECURSIVE = YES + +# Output format options +GENERATE_HTML = YES +GENERATE_LATEX = NO +HAVE_DOT = NO diff --git a/barretenberg/cpp/docs/deploy_doxygen.sh b/barretenberg/cpp/docs/deploy_doxygen.sh new file mode 100755 index 00000000000..14560bd01a2 --- /dev/null +++ b/barretenberg/cpp/docs/deploy_doxygen.sh @@ -0,0 +1,14 @@ +# Uploads to S3 the contents of a doxygen barretenberg C++ documentation build. +# This is then to be used as a static website. +#!/usr/bin/env bash +[ -n "${BUILD_SYSTEM_DEBUG:-}" ] && set -x # conditionally trace +set -eu + +extract_repo barretenberg-docs /usr/src extracted-repo + +BUCKET_NAME="aztec-ci-artifacts" +COMMIT_HASH="${COMMIT_HASH:-$(git rev-parse HEAD)}" +TARGET_FOLDER="barretenberg-doxygen/$COMMIT_HASH" + +echo "Uploading to s3://$BUCKET_NAME/$TARGET_FOLDER" +aws s3 cp extracted-repo/src/barretenberg/cpp/docs/build "s3://$BUCKET_NAME/$TARGET_FOLDER" --recursive \ No newline at end of file diff --git a/build_manifest.yml b/build_manifest.yml index 17b2506a382..be3cf243273 100644 --- a/build_manifest.yml +++ b/build_manifest.yml @@ -104,6 +104,10 @@ barretenberg-acir-tests-bb.js: - bb.js - noir-compile-acir-tests +barretenberg-docs: + buildDir: barretenberg/cpp + dockerfile: docs/Dockerfile + l1-contracts: buildDir: l1-contracts