Skip to content

Commit b96a4cb

Browse files
authored
chore(ci): split checkInitImports into its own test (#386)
Closes #380. This makes `CslibTests` the target for `lake test`, ensuring that the `--iofail --wfail` flags are propagated. The previous test runner is removed, with `lake exe checkInitImports` being moved into a check in CI. This seems to be the standard solution at the moment, but we should revisit in the future if multiple test targets are supported (as drafted in leanprover/lean4#10531).
1 parent 7460006 commit b96a4cb

5 files changed

Lines changed: 12 additions & 52 deletions

File tree

.github/workflows/lean_action_ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ jobs:
2626
# run: |
2727
# set -e
2828
# lake shake --add-public --keep-implied --keep-prefix Cslib
29+
- name: "checkInitImports"
30+
run: |
31+
set -e
32+
lake exe checkInitImports
2933
- uses: leanprover-community/lint-style-action@main
3034
with:
3135
mode: check

CONTRIBUTING.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,13 @@ parenthetical containing what area of the library the PR is working on.
103103

104104
## Testing
105105

106-
There is a [series of tests](/scripts/RunTests.lean) that runs for each PR. The components of this
107-
are
106+
There is a series of tests that runs for each PR. The components of this are
108107

109108
- running the tests found in [CslibTests](/CslibTests)
110109
- checking that all files import [Cslib.Init](/Cslib/Init.lean), which sets up some default linting
111110
and tactics
112111

113-
You can run these locally with `lake test`.
112+
You can run these locally with `lake test` and `lake exe checkInitImports` respectively.
114113

115114
## Linting
116115

@@ -125,6 +124,9 @@ CSLib uses a number of linters, mostly inherited from Batteries and Mathlib. The
125124
There is a also a test that [Cslib.lean](/Cslib.lean) imports all files. You can ensure this by
126125
running `lake exe mk_all --module` locally, which will make the required changes.
127126

127+
CSLib tests for minimized imports using `lake shake --add-public --keep-implied --keep-prefix`, which also comes with a `--fix` option.
128+
See `lake shake --help` for the special comment syntax used to preserve imports required for tactics or typeclasses.
129+
128130
# Getting started
129131

130132
CSLib is a community effort. To understand its scope and vision, please read the [CSLib whitepaper](https://arxiv.org/abs/2602.04846).
@@ -328,4 +330,4 @@ There are two primary areas where generative AI can help:
328330
- generating/refining specifications (at the front-end or Boole level)
329331
- helping to prove Lean conjectures
330332

331-
Other creative uses of AI are welcome, but contributions should remain reviewable and maintainable.
333+
Other creative uses of AI are welcome, but contributions should remain reviewable and maintainable.

lakefile.toml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "cslib"
22
version = "0.1.0"
33
defaultTargets = ["Cslib"]
4-
testDriver = "runTests"
4+
testDriver = "CslibTests"
55
lintDriver = "batteries/runLinter"
66

77
[leanOptions]
@@ -29,8 +29,3 @@ globs = ["CslibTests.+"]
2929
name = "checkInitImports"
3030
srcDir = "scripts"
3131
root = "CheckInitImports"
32-
33-
[[lean_exe]]
34-
name = "runTests"
35-
srcDir = "scripts"
36-
root = "RunTests"

scripts/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ to learn about it as well!
4444
- Optional: `zulip-send` CLI for automatic Zulip notifications
4545

4646
**Init Imports**
47-
- `CheckInitImports.lean` (usually run from `lake test`) checks that all files transitively import `Cslib.Init`.
47+
- `CheckInitImports.lean` (run by `lake exe checkInitImports`) checks that all files transitively import `Cslib.Init`.
4848

4949
**Linting**
5050
- `weekly_lint_report.sh`

scripts/RunTests.lean

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)