Skip to content

Commit 30736d5

Browse files
authored
build: add repository taskfile (#68)
2 parents 9b5d604 + 79604ca commit 30736d5

5 files changed

Lines changed: 135 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ obj/
1818
*.dump
1919
*.mdmp
2020
*.core
21+
/scripts/__pycache__
22+
/scripts/dependencies/__pycache__

Docs/Home.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,19 @@ dotnet tool update -g docfx
3535
dotnet build ModularityKit.Mutator.slnx -c Release
3636
docfx docfx.json
3737
```
38+
39+
## Common local workflows
40+
41+
The repository root includes a [`Taskfile.yml`](../Taskfile.yml) for use with
42+
[`task`](https://taskfile.dev/) and covers the most common build, test, docs, and verification
43+
commands.
44+
45+
Typical usage:
46+
47+
```bash
48+
task build
49+
task test
50+
task test:smoke
51+
task docs
52+
task verify
53+
```

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@
2121
- [`Docs`](Docs/)
2222
- [`Tests`](Tests/)
2323

24+
## Common workflows
25+
26+
Use the root [`Taskfile.yml`](Taskfile.yml) with [`task`](https://taskfile.dev/) as the preferred
27+
entrypoint for repeated local workflows:
28+
29+
```bash
30+
task build
31+
task test
32+
task test:smoke
33+
task docs
34+
task verify
35+
```
36+
37+
Run `task --list-all` from the repository root to see the full task surface.
38+
2439
## Build
2540

2641
```bash

Taskfile.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
version: '3'
2+
3+
vars:
4+
SOLUTION: ModularityKit.Mutator.slnx
5+
CONFIGURATION: '{{default "Release" .CONFIGURATION}}'
6+
CORE_TEST_PROJECT: Tests/ModularityKit.Mutator.Tests/ModularityKit.Mutator.Tests.csproj
7+
GOVERNANCE_TEST_PROJECT: Tests/ModularityKit.Mutator.Governance.Tests/ModularityKit.Mutator.Governance.Tests.csproj
8+
GOVERNANCE_REDIS_TEST_PROJECT: Tests/ModularityKit.Mutator.Governance.Redis.Tests/ModularityKit.Mutator.Governance.Redis.Tests.csproj
9+
SMOKE_TEST_PROJECT: Tests/ModularityKit.Mutator.Examples.SmokeTests/ModularityKit.Mutator.Examples.SmokeTests.csproj
10+
11+
tasks:
12+
default:
13+
desc: List available repository tasks
14+
cmds:
15+
- task --list-all
16+
silent: true
17+
18+
restore:
19+
desc: Restore the solution
20+
cmds:
21+
- dotnet restore {{.SOLUTION}}
22+
23+
clean:
24+
desc: Clean the solution
25+
cmds:
26+
- dotnet clean {{.SOLUTION}} -c {{.CONFIGURATION}}
27+
28+
build:
29+
desc: Build the solution
30+
deps: [restore]
31+
cmds:
32+
- dotnet build {{.SOLUTION}} -c {{.CONFIGURATION}} --no-restore
33+
34+
test:
35+
desc: Run the main test packages and smoke tests
36+
deps:
37+
- test:core
38+
- test:governance
39+
- test:governance:redis
40+
- test:smoke
41+
42+
test:core:
43+
desc: Run core runtime tests
44+
deps: [restore]
45+
cmds:
46+
- dotnet test {{.CORE_TEST_PROJECT}} -c {{.CONFIGURATION}} --no-restore
47+
48+
test:governance:
49+
desc: Run governance tests
50+
deps: [restore]
51+
cmds:
52+
- dotnet test {{.GOVERNANCE_TEST_PROJECT}} -c {{.CONFIGURATION}} --no-restore
53+
54+
test:governance:redis:
55+
desc: Run Redis governance tests
56+
deps: [restore]
57+
cmds:
58+
- dotnet test {{.GOVERNANCE_REDIS_TEST_PROJECT}} -c {{.CONFIGURATION}} --no-restore
59+
60+
test:smoke:
61+
desc: Run example smoke tests
62+
deps: [restore]
63+
cmds:
64+
- dotnet test {{.SMOKE_TEST_PROJECT}} -c {{.CONFIGURATION}} --no-restore
65+
66+
test:project:
67+
desc: Run a specific test project with an optional filter
68+
deps: [restore]
69+
preconditions:
70+
- sh: test -n "{{.PROJECT}}"
71+
msg: 'PROJECT is required. Example: task test:project PROJECT=Tests/ModularityKit.Mutator.Tests/ModularityKit.Mutator.Tests.csproj'
72+
cmds:
73+
- >
74+
dotnet test {{.PROJECT}} -c {{.CONFIGURATION}} --no-restore{{if .FILTER}} --filter "{{.FILTER}}"{{end}}
75+
76+
format:
77+
desc: Format the solution
78+
deps: [restore]
79+
cmds:
80+
- dotnet format {{.SOLUTION}}
81+
82+
deps:
83+
desc: Run dependency health checks
84+
deps: [restore]
85+
cmds:
86+
- python3 -m scripts.dependencies.check_package_health --solution {{.SOLUTION}}
87+
88+
docs:
89+
desc: Build the DocFX site
90+
cmds:
91+
- dotnet tool update -g docfx
92+
- dotnet build {{.SOLUTION}} -c {{.CONFIGURATION}}
93+
- docfx docfx.json
94+
95+
verify:
96+
desc: Run the common local verification workflow
97+
deps:
98+
- build
99+
- deps
100+
- test

src/ModularityKit.Mutator.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
<ItemGroup>
2626
<Compile Remove="Governance/**/*.cs" />
2727
<Compile Remove="Redis/**/*.cs" />
28+
<Compile Remove="obj/**/*.cs" />
29+
<Compile Remove="bin/**/*.cs" />
2830
</ItemGroup>
2931

3032
<ItemGroup>

0 commit comments

Comments
 (0)