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

docs: fix and automate the documentation generation #545

Merged
merged 2 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
72 changes: 70 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ jobs:
path: |
./node_modules/
./build/
key: "cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-ZMQ_VERSION:${{ matrix.zmq_version }}-Node:${{ matrix.node_version }}-${{ hashFiles('./package.json') }}"
key: "cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-${{ hashFiles('./package.json') }}"
restore-keys: |
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-ZMQ_VERSION:${{ matrix.zmq_version }}-Node:${{ matrix.node_version }}-"
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-"

- name: Setup Cpp
if: ${{ !matrix.docker }}
Expand Down Expand Up @@ -160,3 +160,71 @@ jobs:
run: |
pnpm run clean
pnpm run test

Docs:
if: "startsWith(github.ref, 'refs/tags/') && !contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
node_version:
- 18
node_arch:
- x64
cpp_arch:
- x64
ARCH:
- x64
zmq_draft:
- false
env:
ZMQ_DRAFT: ${{ matrix.zmq_draft }}
ZMQ_SHARED: false
ARCH: ${{ matrix.ARCH }}

steps:
- uses: actions/checkout@v3

- name: Cache
uses: actions/cache@v3
with:
path: |
./node_modules/
./build/
key: "cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-${{ hashFiles('./package.json') }}"
restore-keys: |
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-"

- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
cmake: true
architecture: ${{ matrix.cpp_arch }}

- uses: pnpm/action-setup@v2.2.4
with:
version: 7

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
architecture: ${{ matrix.node_arch }}
cache: "pnpm"

- name: Build Documentation
if: "${{ contains(matrix.os, 'ubuntu') && !matrix.docker }}"
run: |
pnpm install
pnpm run build.doc

- name: Deploy Documentation
if: "${{ contains(matrix.os, 'ubuntu') && !matrix.docker }}"
uses: Cecilapp/GitHub-Pages-deploy@v3
with:
build_dir: docs
branch: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
},
"dependencies": {
"@aminya/node-gyp-build": "4.5.0-aminya.4",
"cross-env": "^7.0.3",
"node-addon-api": "^5.0.0",
"shelljs": "^0.8.5",
"shx": "^0.3.4",
"cross-env": "^7.0.3"
"shx": "^0.3.4"
},
"devDependencies": {
"@gnd/typedoc": "^0.15.0-0",
Expand Down Expand Up @@ -52,6 +52,11 @@
"weak-napi": "^2.0.2",
"which": "^3.0.0"
},
"pnpm": {
"overrides": {
"typescript": "~4.9.3"
}
},
"engines": {
"node": ">= 10.2"
},
Expand All @@ -72,10 +77,11 @@
"install": "(shx test -f ./script/build.js || run-s build.js) && cross-env npm_config_build_from_source=true node-gyp-build",
"clean": "shx rm -rf ./build ./lib/ ./prebuilds ./script/*.js ./script/*.js.map ./script/*.d.ts ./script/*.tsbuildinfo",
"clean.temp": "shx rm -rf ./tmp && shx mkdir -p ./tmp && shx touch ./tmp/.gitkeep",
"build.library": "tsc -p ./src/tsconfig.json && downlevel-dts ./lib ./lib/ts3.7 --to=3.7",
"build.library.compat": "shx rm -rf ./lib/ts3.7 && downlevel-dts ./lib ./lib/ts3.7 --to=3.7",
"build.library": "tsc -p ./src/tsconfig.json && run-s build.library.compat",
"build.script": "tsc -p ./script/tsconfig.json",
"build.js": "run-p build.script build.library",
"build.doc": "typedoc --out docs --name zeromq.js --excludeProtected --excludePrivate --excludeNotExported --excludeExternals --externalPattern 'src/+(draft|native|compat).ts' --tsconfig tsconfig-build.json --mode file",
"build.doc": "typedoc --options ./typedoc.json --tsconfig ./tsconfig.docs.json",
"prebuild": "run-s build.js && node ./script/prebuild.js",
"build.native": "node-gyp configure --release && node-gyp build --release",
"build.native.debug": "cross-env CMAKE_BUILD_TYPE=Debug node-gyp configure --debug && cross-env CMAKE_BUILD_TYPE=Debug node-gyp build --debug",
Expand All @@ -89,7 +95,7 @@
"lint": "run-p lint.eslint lint.clang-format",
"lint-test": "run-s lint-test.eslint",
"bench": "node --expose-gc test/bench",
"prepublishOnly": "shx rm -rf ./lib && pnpm run build.js"
"prepublishOnly": "pnpm run build.js"
},
"keywords": [
"zeromq",
Expand Down
19 changes: 5 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions tsconfig-build.json

This file was deleted.

11 changes: 11 additions & 0 deletions tsconfig.docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"incremental": false,
"paths": {
"zeromq": [
"./src/index.ts"
]
}
}
}
22 changes: 22 additions & 0 deletions typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://typedoc.org/schema.json",
"name": "zeromq.js",
"entryPoints": [
"./src/index.ts"
],
"tsconfig": " ./tsconfig.docs.json",
"out": "docs",
"excludePrivate": true,
"excludeNotExported": true,
"excludeExternals": true,
"exclude": [
"script/**/*",
"test/**/*",
"examples/**/*",
"src/+(draft|native|compat).ts",
"src/errors.ts",
"src/util.ts"
],
"pretty": false,
"githubPages": true
}