Skip to content

Commit

Permalink
chore(docs): split docs build into small jobs (#2356)
Browse files Browse the repository at this point in the history
* chore(docs): split docs build into small jobs

Signed-off-by: suyanhanx <[email protected]>

* polish

Signed-off-by: suyanhanx <[email protected]>

* revert python install deps

Signed-off-by: suyanhanx <[email protected]>

---------

Signed-off-by: suyanhanx <[email protected]>
  • Loading branch information
suyanhanx authored May 29, 2023
1 parent 2d4c144 commit 5a109fe
Showing 1 changed file with 103 additions and 42 deletions.
145 changes: 103 additions & 42 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,59 +24,60 @@ concurrency:
cancel-in-progress: true

jobs:
build:
build-rust-doc:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# Build OpenDAL docs ----------------------------------------------
- name: Setup Rust toolchain
uses: ./.github/actions/setup
with:
cache-key: "-docs"

- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '17'

- name: Setup Rust toolchain
uses: ./.github/actions/setup
with:
cache-key: "-services-all"

- name: Build OpenDAL doc
run: cargo doc --lib --no-deps --all-features -p opendal
env:
LD_LIBRARY_PATH: ${{ env.JAVA_HOME }}/lib/server:${{ env.LD_LIBRARY_PATH }}

- name: Copy docs into build
run: |
cp -r ./target/doc ./website/static/docs/rust
- name: Upload docs
uses: actions/upload-artifact@v2
with:
name: rust-docs
path: ./target/doc

build-java-doc:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '17'

# Build bindings/java docs --------------------------------------
- name: Build and test
working-directory: bindings/java
run: mvn javadoc:javadoc

- name: Copy docs into build
run: |
cp -r ./bindings/java/target/site/apidocs ./website/static/docs/java
# Set node.js environment -----------------------------------------
- uses: actions/setup-node@v3
- name: Upload docs
uses: actions/upload-artifact@v2
with:
node-version: '16'
- run: corepack enable
working-directory: bindings/nodejs
name: java-docs
path: ./bindings/java/target/site/apidocs

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
build-nodejs-doc:
runs-on: ubuntu-latest

- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
steps:
- uses: actions/checkout@v3

# Build bindings/nodejs docs --------------------------------------
- name: Install dependencies
working-directory: bindings/nodejs
run: yarn install
Expand All @@ -85,16 +86,22 @@ jobs:
working-directory: bindings/nodejs
run: yarn docs

- name: Copy docs into build
run: |
cp -r ./bindings/nodejs/docs ./website/static/docs/nodejs
- name: Upload docs
uses: actions/upload-artifact@v2
with:
name: nodejs-docs
path: ./bindings/nodejs/docs

# Setup python environment ----------------------------------------
- uses: actions/setup-python@v4
build-python-doc:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v3
with:
python-version: '3.11'

# Build bindings/python docs --------------------------------------
- name: Install dependencies
working-directory: bindings/python
run: |
Expand All @@ -106,20 +113,74 @@ jobs:
working-directory: bindings/python
run: pdoc --output-dir ./docs opendal

- name: Copy docs into build
run: |
cp -r ./bindings/python/docs ./website/static/docs/python
- name: Upload docs
uses: actions/upload-artifact@v2
with:
name: python-docs
path: ./bindings/python/docs

build-website:
runs-on: ubuntu-latest
needs:
- build-rust-doc
- build-java-doc
- build-nodejs-doc
- build-python-doc

steps:
- uses: actions/checkout@v3

# Set node.js environment -----------------------------------------
- uses: actions/setup-node@v3
with:
node-version: '16'

- run: corepack enable
working-directory: bindings/nodejs

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

# Download docs ---------------------------------------------------
- name: Download rust docs
uses: actions/download-artifact@v2
with:
name: rust-docs
path: ./website/static/docs/rust

- name: Download nodejs docs
uses: actions/download-artifact@v2
with:
name: nodejs-docs
path: ./website/static/docs/nodejs

- name: Download python docs
uses: actions/download-artifact@v2
with:
name: python-docs
path: ./website/static/docs/python

- name: Download java docs
uses: actions/download-artifact@v2
with:
name: java-docs
path: ./website/static/docs/java

# Build website ---------------------------------------------------
- name: Install Dependencies
working-directory: website
run: |
yarn install
run: yarn install

- name: Build
working-directory: website
run: |
yarn build
run: yarn build

# Start deploy --------------------------------------------------
- name: Copy asf file
Expand Down

0 comments on commit 5a109fe

Please sign in to comment.