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

feat: github action to integrate/publish endo and agoric-sdk reference docs too #1038

Merged
merged 24 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
649e426
feat: github action to integrate/publish endo reference doc too
LuqiPan Mar 26, 2024
e806103
feat: refine build steps and add steps to build agoric-sdk docs
LuqiPan Mar 26, 2024
9544c91
Merge branch 'main' into 927-reference-docs-in-search
LuqiPan Mar 26, 2024
3da9eca
debug: add `yarn build` like Dan suggested
LuqiPan Mar 26, 2024
162d794
chore: bump vitepress to 1.0.1
LuqiPan Mar 26, 2024
293db4e
debug: add a DEBUG flag to "docs:build-cf" script
LuqiPan Mar 26, 2024
9c85876
chore: update ignoreDeadLinks list
LuqiPan Mar 26, 2024
deb67f6
ci: update yarn commands to generate markdown files
LuqiPan Mar 26, 2024
56a16bb
ci: update github workflow to reflect upstream changes
LuqiPan Mar 27, 2024
50f3e25
ci: use cloudflare/pages-action instead and add a step to comment URL
LuqiPan Mar 27, 2024
b16111d
ci: switch back to using wrangler-action and use its output
LuqiPan Mar 27, 2024
f64b764
ci: add a condition to check if event is pull request
LuqiPan Mar 27, 2024
40d3697
ci: add conditions for preview and production deployments separately
LuqiPan Mar 27, 2024
059336b
comment: add some background in comments for build-deploy-doc workflow
LuqiPan Mar 27, 2024
2885469
chore: add endo and agoric-sdk to submodules
LuqiPan Apr 1, 2024
a1e4a9b
ci: disable github workflow for now
LuqiPan Apr 1, 2024
2f3993b
chore: bump node version to 18.18.0
LuqiPan Apr 1, 2024
9cdca18
ci: add several yarn targets to build .md docs for endo and agoric-sdk
LuqiPan Apr 1, 2024
57ac64e
chore: update submodules
LuqiPan Apr 1, 2024
b7ca228
chore: add a yarn target for `git:update-submodules`
LuqiPan Apr 1, 2024
891494f
debug: undo `yarn install` by cloudflare to build
LuqiPan Apr 1, 2024
a4284c5
debug: update file paths when `mv`ing
LuqiPan Apr 1, 2024
c813781
chore: add a comment for docs:build-cf script
LuqiPan Apr 1, 2024
ba4232f
chore: add a yarn script for git-submodule:init
LuqiPan Apr 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/workflows/build-deploy-doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Build and Deploy documentation site

# This workflow is a customized workflow to deploy docs site to Cloudflare
# The reason we can no longer use Cloudflare's git integration to deploy docs
# site anymore is that Cloudflare's git integration would only check out
# documentation repo, whereas we need to check out both `endojs/endo` and
# `agoric/agoric-sdk` repo to build the docs site.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder about using submodules.

It would be nice to be able to get snippets from dapp-agoric-basics, for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I considered it but in my past experience I've only been frustrated about needing to update the hashes for submodules and make git commits. That said, there's not really a good solution whenever we are "orchestrating" multiple repos.

I'm happy to give it another try if there's some submodule-fu I'm missing though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the submodule friction is a good thing?

Looks like this workflow is checking out HEAD of the other two repos, but that's not what people can use. I propose that the docs reflect what's in Mainnet. To do that requires a PR on this repo to specify the the branch or tag in the other repos. Expressing that as a git submodule makes sense and it sounds like it would obviate the need to define this additional workflow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose that the docs reflect what's in Mainnet.

There's some appeal to that, but then how to we make progress on generated reference docs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reference docs from each repo can publish anywhere. But this PR is about docs.agoric.com, right? Shouldn't that URL only show you what's in Mainnet?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, yes, there's some appeal to that, but running typedoc on the mainnet version of our code yields mostly garbage. So should the generated reference docs on dogs.agoric.com be garbage until our fixes to the jsdoc in agoric-sdk make it to mainnet?

Copy link
Member

@dckc dckc Mar 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running typedoc on the mainnet version of the code won't work at all, in fact, will it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So should the generated reference docs on dogs.agoric.com be garbage until our fixes to the jsdoc in agoric-sdk make it to mainnet?

I'm not proposing that. I'm speaking to whether this repo sources from HEAD or a git submodule. My claim is that sourcing HEAD of agoric-sdk is untenable and so it shouldn't be how this PR is implemented. IIUC, there's no need for a new workflow if the reop used git submodules. Given that we need some way to specify a tag of the source repos, I propose that be how this is implemented.

What tag/version of the other repos to source, I think can change over time. I agree that u13 would be unworkable. Probably same for u14. But maybe u15 can get the docs improvements that have been going into master. Again, independent of my request that the repos are sourced by a tag instead of HEAD.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that u13 would be unworkable. Probably same for u14. But maybe u15 can get the docs improvements that have been going into master.

ok. yes, that's pretty much what I'm thinking.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This discussion is helpful, I'll look into submodules


on:
# If it's a push to production branch, Cloudflare wrangler will deploy it as a
# production deployment
# The production branch for documentation project on Cloudflare is configured
# to be `main`
push:
branches:
- main
# If it's a push to a non-production branch, Cloudflare wrangler will deploy
# it as a preview deployment
pull_request:
branches:
- "*"

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Checkout Endo
uses: actions/checkout@v4
with:
repository: endojs/endo
path: endo

- name: Build Endo docs
run: |
cd endo
yarn install
yarn docs:markdown-for-agoric-documentation-repo

- name: Move Endo docs into main/reference
run: mv endo/api-docs main/reference/endo

- name: Checkout agoric-sdk
uses: actions/checkout@v4
with:
repository: agoric/agoric-sdk
path: agoric-sdk

- name: Build agoric-sdk docs
run: |
cd agoric-sdk
yarn install
yarn build
yarn docs:markdown-for-agoric-documentation-repo

- name: Move agoric-sdk docs into main/reference
run: mv agoric-sdk/api-docs main/reference/agoric-sdk

- name: Build Doc site
run: |
yarn install
yarn docs:build-cf

- name: Publish to Cloudflare Pages
id: publish-to-cloudflare-pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
# Cloudflare account ID is safe to be public
# Ref: https://github.com/cloudflare/wrangler-legacy/issues/209#issuecomment-541654484
accountId: 0c4635effffcd7f36d1b9f0425a4367a
command: pages deploy --project-name=documentation dist/

- name: Comment with preview URL
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Cloudflare Pages Preview URL: ${{ steps.publish-to-cloudflare-pages.outputs.deployment-url }}'
})
57 changes: 0 additions & 57 deletions .github/workflows/build-deploy-doc.yml.DISABLED

This file was deleted.

5 changes: 5 additions & 0 deletions main/.vitepress/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ export default defineConfig({
ignoreDeadLinks: [
// ignore all localhost links
/^https?:\/\/localhost/,
// ignore links that starts with ./packages/*
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the .md files generated from endo and agoric-sdk repo use these links below, which will fail the vitepress build as they're indeed dead links. There are 8 total offenders so it's not widespread, and I'm adding all of them here so they can be ignored by vitepress

/^.\/packages\/*/,
'./MAINTAINERS',
'./CONTRIBUTING',
'./LICENSE',
],
sitemap: {
hostname: 'https://docs.agoric.com',
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"docs:dev": "NODE_OPTIONS=--openssl-legacy-provider vitepress dev main",
"docs:build": "NODE_OPTIONS=--openssl-legacy-provider vitepress build main",
"docs:preview": "NODE_OPTIONS=--openssl-legacy-provider vitepress preview main",
"docs:build-cf": "NODE_OPTIONS=--openssl-legacy-provider vitepress build main && cp _redirects dist/",
"docs:build-cf": "DEBUG='vitepress:*' NODE_OPTIONS=--openssl-legacy-provider vitepress build main && cp _redirects dist/",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DEBUG environment variable would allow us to see what broke during a github workflow run.

We could potentially add this environment variable to other docs:* yarn commands too

"test": "ava",
"lint-fix": "yarn lint --fix",
"lint": "eslint 'snippets/**/*.js'",
Expand Down Expand Up @@ -65,7 +65,7 @@
"prettier": "^1.19.1",
"ses": "^0.18.8",
"stylus": "^0.62.0",
"vitepress": "^1.0.0-rc.42"
"vitepress": "^1.0.1"
},
"resolutions": {},
"globals": {
Expand Down
Loading
Loading