From a728d7eb6dcb975a8fa4f8b1b14ce693d7815213 Mon Sep 17 00:00:00 2001 From: Ryo Yamashita Date: Thu, 4 Jul 2024 16:31:36 +0900 Subject: [PATCH] =?UTF-8?q?add:=20Rust=20API=E3=81=AEAPI=E3=83=89=E3=82=AD?= =?UTF-8?q?=E3=83=A5=E3=83=A1=E3=83=B3=E3=83=88=E3=82=92=E3=83=87=E3=83=97?= =?UTF-8?q?=E3=83=AD=E3=82=A4=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=99=E3=82=8B=20(#803)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/generate_document.yml | 22 ++++++++++++++++++++-- docs/apis/index.html | 1 + 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate_document.yml b/.github/workflows/generate_document.yml index 531e800c3..039800df1 100644 --- a/.github/workflows/generate_document.yml +++ b/.github/workflows/generate_document.yml @@ -16,6 +16,20 @@ jobs: 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:^.*rustc 1\.[0-9]\+\.[0-9]\+-nightly ([0-9a-f]\{9\} \([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\)).*$:\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: @@ -25,8 +39,8 @@ jobs: with: java-version: "11" distribution: "adopt" - - name: Install cargo-binstall - uses: taiki-e/install-action@cargo-binstall + - name: Install cargo-docs-rs + uses: dtolnay/install@cargo-docs-rs - name: Create a venv uses: ./.github/actions/create-venv - name: Install python dependencies @@ -39,6 +53,10 @@ jobs: run: mkdir -p public/apis/c_api - name: cp docs/apis/index.html run: cp docs/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/apis/c_api/doxygen/ - name: Generate doxygen document diff --git a/docs/apis/index.html b/docs/apis/index.html index 639602f9f..d1f5d09b2 100644 --- a/docs/apis/index.html +++ b/docs/apis/index.html @@ -6,6 +6,7 @@