Handle imports & re-exports of all kinds of macro items. (#666) #1643
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- rustdoc-v* | |
env: | |
RUST_BACKTRACE: 1 | |
CARGO_TERM_COLOR: always | |
jobs: | |
ci-everything: | |
name: All CI stages | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
- rust-tests | |
if: ${{ success() || failure() }} # Run this job even if a dependency has failed. | |
steps: | |
- name: Job outcomes | |
run: | | |
echo "lint: ${{ needs.lint.result }}" | |
echo "rust-tests: ${{ needs.rust-tests.result }}" | |
# Fail this required job if any of its dependent jobs have failed. | |
# | |
# Do not attempt to consolidate these steps into one step, it won't work. | |
# Multi-line `if` clauses are not evaluated properly: see the intermediate commits in | |
# https://github.com/obi1kenobi/cargo-semver-checks/pull/405 | |
- if: ${{ needs.lint.result != 'success' }} | |
run: exit 1 | |
- if: ${{ needs.rust-tests.result != 'success' }} | |
run: exit 1 | |
lint: | |
name: Check lint and rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Install rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
components: rustfmt, clippy | |
rustflags: "" | |
- name: cargo clippy | |
run: cargo clippy --workspace --all-features --all-targets -- -D warnings -Dclippy::print_stdout -Dclippy::print_stderr -Dclippy::dbg_macro --allow deprecated | |
- name: cargo fmt | |
run: cargo fmt -- --check | |
- name: cargo doc | |
env: | |
RUSTDOCFLAGS: -D warnings | |
run: cargo doc --workspace --all-features --no-deps --document-private-items | |
rust-tests: | |
name: Run tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
toolchain: ["beta"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Install rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
rustflags: "" | |
- name: Regenerate test data | |
run: ./scripts/regenerate_test_rustdocs.sh +${{ matrix.toolchain }} | |
- name: compile | |
run: cargo test --no-run | |
- name: test | |
run: cargo test | |
- name: compile with rayon | |
run: cargo test --no-run --features rayon | |
- name: test with rayon | |
run: cargo test --features rayon | |
publish: | |
name: Publish to crates.io | |
runs-on: ubuntu-latest | |
needs: | |
- should-publish | |
- ci-everything | |
- pre-publish-checks | |
if: needs.should-publish.outputs.is_new_version == 'yes' && startsWith(github.ref, 'refs/heads/rustdoc-v') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: true | |
- name: Install rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
cache: false | |
rustflags: "" | |
- name: Tag the version | |
run: | | |
set -euxo pipefail | |
export CURRENT_VERSION="$(./scripts/get_current_version.sh trustfall-rustdoc-adapter)" | |
git tag "v$CURRENT_VERSION" | |
git push origin "v$CURRENT_VERSION" | |
- name: Publish | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
run: cargo publish | |
should-publish: | |
name: Check if version changed | |
runs-on: ubuntu-latest | |
outputs: | |
is_new_version: ${{ steps.check.outputs.is_new_version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- id: check | |
run: | | |
set +e | |
./scripts/is_version_already_uploaded.sh trustfall-rustdoc-adapter | |
export EXIT_CODE="$?" | |
set -e | |
if [[ "$EXIT_CODE" == "7" ]]; then | |
echo "is_new_version=no" >> $GITHUB_OUTPUT | |
elif [[ "$EXIT_CODE" == "0" ]]; then | |
echo "is_new_version=yes" >> $GITHUB_OUTPUT | |
else | |
# Unexpected outcome, indicates a bug. | |
exit "$EXIT_CODE" | |
fi | |
pre-publish-checks: | |
name: Check for semver compliance | |
runs-on: ubuntu-latest | |
needs: | |
- ci-everything | |
- should-publish | |
if: needs.should-publish.outputs.is_new_version == 'yes' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Check semver | |
uses: obi1kenobi/cargo-semver-checks-action@v2 |