Skip to content

feat: fix up #875 about MARGIN_WIDTH and FEATURE_SIZE #2296

feat: fix up #875 about MARGIN_WIDTH and FEATURE_SIZE

feat: fix up #875 about MARGIN_WIDTH and FEATURE_SIZE #2296

name: generate API documents
on:
push:
branches:
- main
pull_request:
defaults:
run:
shell: bash
jobs:
generate_api_document:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Rust
uses: ./.github/actions/rust-toolchain-from-file
- name: Extract the Rust version used on Docs.rs
id: docsrs-rust-version
run: |
page=$(curl -f https://docs.rs/about/builds)
date=$(
sed -n \
's:^.*<code>rustc 1\.[0-9]\+\.[0-9]\+-nightly ([0-9a-f]\{9\} \([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\))</code>.*$:\1:p' \
<<< "$page"
)
echo "rust-toolchain=nightly-$date" >> "$GITHUB_OUTPUT"
- name: Set up nightly Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.docsrs-rust-version.outputs.rust-toolchain }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: "11"
distribution: "adopt"
- name: Install cargo-docs-rs
uses: dtolnay/install@cargo-docs-rs
- name: Create a venv
uses: ./.github/actions/create-venv
- name: Install python dependencies
working-directory: ./crates/voicevox_core_python_api
run: |
pip install --upgrade poetry
poetry config virtualenvs.create false
poetry install --with test
- name: mkdir public
run: mkdir -p public/apis/c_api
- name: cp docs/ghpages/apis/index.html
run: cp docs/ghpages/apis/index.html public/apis/
- name: Generate rustdoc
run: |
cargo +${{ steps.docsrs-rust-version.outputs.rust-toolchain }} docs-rs -p voicevox_core
mv target/x86_64-unknown-linux-gnu/doc public/apis/rust_api
- name: cp crates/voicevox_core_c_api/include/voicevox_core.h
run: cp crates/voicevox_core_c_api/include/voicevox_core.h docs/ghpages/apis/c_api/doxygen/
- name: Generate doxygen document
uses: mattnotmitt/[email protected]
with:
working-directory: "docs/ghpages/apis/c_api/doxygen"
- name: Build voicevox_core_python_api
run: maturin develop --manifest-path ./crates/voicevox_core_python_api/Cargo.toml --locked
- name: Generate Sphinx document
run: sphinx-build docs/ghpages/apis/python_api public/apis/python_api
- name: Generate Javadoc
run: |
(cd crates/voicevox_core_java_api && ./gradlew javadoc)
mkdir -p public/apis/java_api
cp -r crates/voicevox_core_java_api/lib/build/docs/javadoc/* public/apis/java_api
- name: Uplaod api document
uses: actions/upload-pages-artifact@v3
if: ${{ github.ref_name == 'main' }}
with:
path: public
deploy_api_github_pages:
runs-on: ubuntu-latest
needs:
- generate_api_document
permissions:
pages: write
id-token: write
environment:
name: APIドキュメント
url: ${{ steps.api.outputs.page_url }}/apis
if: ${{ github.ref_name == 'main' }}
steps:
- name: Deploy to GitHub pages
id: api
uses: actions/deploy-pages@v4