Skip to content

Commit

Permalink
ci: add build tests for cargo doc reading metadata from Cargo.toml (#…
Browse files Browse the repository at this point in the history
…1099)

* ci: add build tests for `cargo doc`

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

* read docrs metadata for runing `cargo doc`

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

* use jq

* read `no-default-features` metadata

---------

Signed-off-by: rhysd <[email protected]>
  • Loading branch information
rhysd authored Nov 29, 2023
1 parent a8c0d38 commit aa7802d
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: test

on: [pull_request]
on:
push:
branches:
- dev
pull_request:

jobs:
test:
Expand All @@ -17,7 +21,7 @@ jobs:
runs-on: ${{ matrix.platform.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: install stable
uses: dtolnay/rust-toolchain@stable
with:
Expand Down Expand Up @@ -59,3 +63,34 @@ jobs:
- name: Run tests with miri
if: (!contains(matrix.platform.target, 'android') && !contains(matrix.platform.target, 'ios'))
run: cargo +nightly miri test --verbose --target ${{ matrix.platform.target }} --features linux-body

doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install nightly
uses: dtolnay/rust-toolchain@nightly
- name: install webkit2gtk
run: |
sudo apt-get update -y -q
sudo apt-get install -y --no-install-recommends libwebkit2gtk-4.1-dev
- name: Run cargo doc with each targets
run: |
set -ex
md="$(cargo metadata --format-version=1 | jq '.packages[] | select(.name=="wry") | .metadata.docs.rs')"
export RUSTDOCFLAGS="$(echo "$md" | jq -r '.["rustdoc-args"] | join(" ")')"
export RUSTFLAGS="$(echo "$md" | jq -r '.["rustc-args"] | join(" ")')"
features="$(echo "$md" | jq -r '.features | join(",")')"
no_default_features=
if [ "$(echo "$md" | jq '.["no-default-features"]')" = true ]; then
no_default_features="--no-default-features"
fi
for target in $(echo "$md" | jq -r '.targets | join(" ")')
do
rustup target add "$target"
cargo doc -p wry "$no_default_features" "--features=$features" "--target=$target"
done

0 comments on commit aa7802d

Please sign in to comment.