Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run doctests as part of CI pipeline #9939

Merged
merged 1 commit into from
Feb 12, 2024
Merged

Run doctests as part of CI pipeline #9939

merged 1 commit into from
Feb 12, 2024

Conversation

MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Feb 12, 2024

Summary

Add explicit command to run doctest. Run tests for all features.

Fixes #9938

Test Plan

See CI pipeline

@@ -120,7 +120,10 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: "Run tests"
shell: bash
run: cargo nextest run --workspace --status-level skip --failure-output immediate-final --no-fail-fast -j 12
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the -j 12. It gives us minimal speedup but has the downside that it requires manual updating (that likely doesn't happen) when any properties about the runners change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you benchmark it? It seemed like it was about 30s faster for WIndows (#9921 (comment)).

Copy link
Member Author

@MichaReiser MichaReiser Feb 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not but you mentioned on your PR that it is minimal 😆

Basically no difference:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol you got me

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up keeping it because the Windows difference was kinda big though...

@@ -0,0 +1,8 @@
[profile.ci]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cargo insta doesn't support passing custom test runner flags. Luckily, nextest supports setting the profile via environment flag..

@MichaReiser MichaReiser merged commit 341c269 into main Feb 12, 2024
17 checks passed
@MichaReiser MichaReiser deleted the doctests- branch February 12, 2024 09:18
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

run: cargo nextest run --workspace --status-level skip --failure-output immediate-final --no-fail-fast -j 12
env:
NEXTEST_PROFILE: "ci"
run: cargo insta test --all-features --unreferenced reject --test-runner nextest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I didn't know about this, huh. Did you know about this @zanieb?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I talked about this in my earlier pull request I linked :p I think the key here is setting the profile via environment variable? Nice work @MichaReiser

@charliermarsh
Copy link
Member

It looks like this PR also re-adds --unreferenced reject.

run: cargo nextest run --workspace --status-level skip --failure-output immediate-final --no-fail-fast -j 12
run: |
cargo nextest run --all-features --profile ci
cargo test --all-features --doc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this on the Windows tests? If anything, shouldn't it only be on the Linux tests, since doctests add so much overhead, and Windows is the bottleneck?

Copy link
Member Author

@MichaReiser MichaReiser Feb 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cargo insta uses nextest to run the "normal" test but calls cargo test --doc for doctests.

So the doctests run on both Windows and Linux.

However, we never used the unreferenced-snapshots feature on Windows, so it felt useless to use cargo insta on Windows for a feature that we don't need. That's why it makes the call directly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that makes sense, thanks! Doctests are so slow, honestly I'm tempted not to run them on Windows.

@MichaReiser MichaReiser mentioned this pull request Feb 12, 2024
nkxxll pushed a commit to nkxxll/ruff that referenced this pull request Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Related to internal CI tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Doctests no longer run as part of CI
3 participants