Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup rustdoc #7836

Open
Tracked by #7670
matklad opened this issue Oct 14, 2022 · 2 comments
Open
Tracked by #7670

Setup rustdoc #7836

matklad opened this issue Oct 14, 2022 · 2 comments
Labels
C-docs Category: documentation, including rustdoc, nomicon, and docs.nearprotocol.com

Comments

@matklad
Copy link
Contributor

matklad commented Oct 14, 2022

We already have workflow to generate some static HTML files from data in this repo and publish it to github pages:

https://near.github.io/nearcore/

I think it would be an easy win to generate rustdoc API docs from master as well, some folks find those very useful.

@matklad matklad added the C-docs Category: documentation, including rustdoc, nomicon, and docs.nearprotocol.com label Oct 14, 2022
@matklad
Copy link
Contributor Author

matklad commented Oct 14, 2022

Ok, I gave this a crack, I think this should be as simple as

diff --git a/.github/workflows/book.yml b/.github/workflows/pages.yml
similarity index 61%
rename from .github/workflows/book.yml
rename to .github/workflows/pages.yml
index 0fe9db24f..1ffe8f1ba 100644
--- a/.github/workflows/book.yml
+++ b/.github/workflows/pages.yml
@@ -1,3 +1,8 @@
+# This workflow builds GitHub pages at https://near.github.io/nearcore/
+# Currently, we host two things there:
+#  * mdBook build form `./docs`
+#  * rustdoc build from inline `///` code comments
+
 name: Book
 
 on:
@@ -27,16 +32,32 @@ jobs:
       with:
         name: book
         path: target/book
+  rustdoc:
+    name: rustdoc
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - name: Build Docs
+      run: |
+        cargo doc --no-deps --document-private-items
+    - uses: actions/upload-artifact@v2
+      with:
+        name: rustdoc
+        path: target/doc
 
   deploy:
     name: Deploy
     runs-on: ubuntu-latest
-    needs: book
+    needs: [book, rustdoc]
     if: github.event_name == 'push' && github.ref == 'refs/heads/master'
     steps:
     - uses: actions/download-artifact@v2
       with:
         name: book
+    - uses: actions/download-artifact@v2
+      with:
+        name: rustdoc
+        path: ./rustdoc
     - uses: peaceiris/actions-gh-pages@v3
       with:
         github_token: ${{ secrets.GITHUB_TOKEN }}

However, the builds for docs takes >15 minutes, which I think is a non-starter.

I think this is mostly due to the docs trying to build rocks from source. This should be avoidable by apt-get installing rocks and setting ROCKSDB_LIB_DIR=/usr/lib/x86_64-linux-gnu, but that seems brittle enough which for me moves this from "obvious easy win" to "creeping technical debt".

@akhi3030
Copy link
Collaborator

Should we track this issue as "nice to have" under #7670?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-docs Category: documentation, including rustdoc, nomicon, and docs.nearprotocol.com
Projects
None yet
Development

No branches or pull requests

2 participants