ci: Merge all doc builders into one (#2934)

Also move the gh-pages pushing step from the `publish` phase to just
this singular doc builder.

The motivation for this is to eventually remove the `publish` step since
it interacts badly with GitHub's scheduling of actions. This is
hopefully the first step towards that by removing the doc publish part
of the phase.
This commit is contained in:
Alex Crichton
2021-05-24 18:26:05 -05:00
committed by GitHub
parent 8c2413e009
commit beaa07eb96

View File

@@ -45,35 +45,11 @@ jobs:
echo `pwd` >> $GITHUB_PATH echo `pwd` >> $GITHUB_PATH
- run: cargo deny check - run: cargo deny check
# Build `mdBook` documentation for `wasmtime`, and upload it as a temporary doc:
# build artifact name: Doc build
doc_book:
name: Doc - build the book
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- run: rustup update stable && rustup default stable
- run: |
set -e
curl -L https://github.com/rust-lang-nursery/mdBook/releases/download/v0.4.4/mdbook-v0.4.4-x86_64-unknown-linux-gnu.tar.gz | tar xzf -
echo `pwd` >> $GITHUB_PATH
- run: (cd docs && mdbook build)
- run: cargo build -p wasmtime
- run: (cd docs && mdbook test -L ../target/debug/deps)
- uses: actions/upload-artifact@v1
with:
name: doc-book
path: docs/book
# Build rustdoc API documentation for `wasmtime*` crates. Note that we don't
# want to document all our transitive dependencies, hence `--no-deps`. This is
# a temporary build artifact we upload to consume later.
doc_api:
name: Doc - build the API documentation
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
CARGO_MDBOOK_VERSION: 0.4.8
RUSTDOCFLAGS: -Dbroken_intra_doc_links --cfg nightlydoc RUSTDOCFLAGS: -Dbroken_intra_doc_links --cfg nightlydoc
OPENVINO_SKIP_LINKING: 1 OPENVINO_SKIP_LINKING: 1
steps: steps:
@@ -83,6 +59,24 @@ jobs:
- uses: ./.github/actions/install-rust - uses: ./.github/actions/install-rust
with: with:
toolchain: nightly-2021-04-11 toolchain: nightly-2021-04-11
# Build C API documentation
- run: sudo apt-get update && sudo apt-get install -y doxygen git
- run: cd crates/c-api && doxygen doxygen.conf
# install mdbook, build the docs, and test the docs
- uses: actions/cache@v2
with:
path: ${{ runner.tool_cache }}/mdbook
key: cargo-mdbook-bin-${{ env.CARGO_MDBOOK_VERSION }}
- run: |
echo "${{ runner.tool_cache }}/mdbook/bin" >> $GITHUB_PATH
cargo install --root ${{ runner.tool_cache }}/mdbook --version ${{ env.CARGO_MDBOOK_VERSION }} mdbook
- run: (cd docs && mdbook build)
- run: cargo build -p wasmtime
- run: (cd docs && mdbook test -L ../target/debug/deps)
# Build Rust API documentation
- run: | - run: |
cargo doc --no-deps --workspace \ cargo doc --no-deps --workspace \
--exclude wasmtime-cli \ --exclude wasmtime-cli \
@@ -90,26 +84,30 @@ jobs:
--exclude cranelift-codegen-meta \ --exclude cranelift-codegen-meta \
--exclude 'peepmatic*' --exclude 'peepmatic*'
- run: cargo doc --package cranelift-codegen-meta --document-private-items - run: cargo doc --package cranelift-codegen-meta --document-private-items
- run: tar czf doc-api.tar.gz -C target/doc .
# Assemble the documentation, and always upload it as an artifact for
# inspection on PRs and such.
- run: |
mv docs/book gh-pages
mv crates/c-api/html gh-pages/c-api
mv target/doc gh-pages/api
tar czf gh-pages.tar.gz gh-pages
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: doc-api name: gh-pages
path: doc-api.tar.gz path: gh-pages.tar.gz
doc_capi: # If this is a push to the main branch push to the `gh-pages` using a
name: Doc - build the C API documentation # deploy key. Note that a deploy key is necessary for now because otherwise
runs-on: ubuntu-latest # using the default token for github actions doesn't actually trigger a page
container: ubuntu:20.04 # rebuild.
steps: - name: Push to gh-pages
- run: apt-get update && apt-get install -y doxygen git run: curl -LsSf https://git.io/fhJ8n | rustc - && (cd gh-pages && ../rust_out)
- uses: actions/checkout@v2 env:
with: GITHUB_DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
submodules: true BUILD_REPOSITORY_ID: ${{ github.repository }}
- run: cd crates/c-api && doxygen doxygen.conf BUILD_SOURCEVERSION: ${{ github.sha }}
- uses: actions/upload-artifact@v1 if: github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
name: doc-c-api
path: crates/c-api/html
# Quick checks of various feature combinations and whether things # Quick checks of various feature combinations and whether things
# compile. The goal here isn't to run tests, mostly just serve as a # compile. The goal here isn't to run tests, mostly just serve as a
@@ -541,7 +539,7 @@ jobs:
# github releases and/or tags for pushes. # github releases and/or tags for pushes.
publish: publish:
name: Publish name: Publish
needs: [doc_book, doc_api, build] needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@@ -549,21 +547,6 @@ jobs:
submodules: true submodules: true
- run: rustup update stable && rustup default stable - run: rustup update stable && rustup default stable
# Download all the artifacts that we'll be publishing. Should keep an eye on
# the `download-artifact` repository to see if we can ever get something
# like "download all artifacts" or "download this list of artifacts"
- name: Download book
uses: actions/download-artifact@v1
with:
name: doc-book
- name: Download API docs
uses: actions/download-artifact@v2
with:
name: doc-api
- name: Download C API docs
uses: actions/download-artifact@v1
with:
name: doc-c-api
- name: Download x86_64 macOS binaries - name: Download x86_64 macOS binaries
uses: actions/download-artifact@v1 uses: actions/download-artifact@v1
with: with:
@@ -585,26 +568,6 @@ jobs:
with: with:
name: bins-x86_64-mingw name: bins-x86_64-mingw
- name: Assemble gh-pages
run: |
mv doc-book gh-pages
mv doc-c-api gh-pages/c-api
mkdir gh-pages/api
cd gh-pages/api
tar xf ../../doc-api.tar.gz
# If this is a push to the main branch push to the `gh-pages` using a
# deploy key. Note that a deploy key is necessary for now because otherwise
# using the default token for github actions doesn't actually trigger a page
# rebuild.
- name: Push to gh-pages
run: curl -LsSf https://git.io/fhJ8n | rustc - && (cd gh-pages && ../rust_out)
env:
GITHUB_DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
BUILD_REPOSITORY_ID: ${{ github.repository }}
BUILD_SOURCEVERSION: ${{ github.sha }}
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
- name: Calculate tag name - name: Calculate tag name
run: | run: |
name=dev name=dev