Skip to content

Migration to v1.4.6

From v1.4.5 to v1.4.6.

This update:

  • Validates Rust workflow-only pull requests.
  • Fixes cargo doc & cargo clippy for cross-targets needing cc.

1. Run CI when the Rust workflow changes

Add the workflow path to the pull_request.paths list in .github/workflows/rust.yml:

  pull_request:
    branches: [main]
    paths:
+     - ".github/workflows/rust.yml"
      - "src/**"
      - "Cargo.toml"
      - "Cargo.lock"

2. Use Cross for cross-target documentation and linting

We found cargo doc would fail sometimes

So, cargo doc could fail for cross-targets, because rustdoc examples could use non-rust libraries that would require cc to compile.

We fix this by running cargo doc in cross-environment.

Replace the documentation and linter steps in .github/workflows/rust.yml.

  - name: Check documentation is valid
+   shell: bash
    env:
      RUSTDOCFLAGS: "-D warnings"
-   run: cargo doc --no-deps --workspace --all-features --document-private-items --target ${{ matrix.target }}
+   run: |
+     if [[ "${{ matrix.use-cross }}" == "true" ]]; then
+       cross doc --no-deps --workspace --all-features --document-private-items --target ${{ matrix.target }}
+     else
+       cargo doc --no-deps --workspace --all-features --document-private-items --target ${{ matrix.target }}
+     fi

  - name: Run linter
    if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/')
-   run: cargo clippy --workspace --all-features --target ${{ matrix.target }} -- -D warnings
+   shell: bash
+   run: |
+     if [[ "${{ matrix.use-cross }}" == "true" ]]; then
+       cross clippy --workspace --all-features --target ${{ matrix.target }} -- -D warnings
+     else
+       cargo clippy --workspace --all-features --target ${{ matrix.target }} -- -D warnings
+     fi

shell: bash keeps the conditional portable to Windows GitHub-hosted runners. Keep custom matrix entries and command flags unchanged.

3. Update the template version marker

-reloaded-templates-rust:1.4.5
+reloaded-templates-rust:1.4.6