Skip to content

Commit 2195a0f

Browse files
committed
Separate integration tests
1 parent 06bac08 commit 2195a0f

File tree

3 files changed

+59
-8
lines changed

3 files changed

+59
-8
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,34 @@ jobs:
9191
run: dotnet run --project build -c release
9292

9393
- name: Test
94-
run: dotnet run --project build -c release -- test
94+
run: dotnet run --project build -c release -- unit-test
9595

9696
- name: Publish AOT
9797
run: dotnet run --project build -c release -- publishbinaries
98+
99+
integration:
100+
runs-on: ubuntu-latest
101+
strategy:
102+
fail-fast: false
103+
matrix:
104+
os:
105+
- ubuntu-latest
106+
- macos-latest
107+
- windows-latest
108+
steps:
109+
- uses: actions/checkout@v4
110+
111+
- name: Bootstrap Action Workspace
112+
id: bootstrap
113+
uses: ./.github/actions/bootstrap
114+
115+
- name: Free Disk Space
116+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
117+
with:
118+
tool-cache: false
119+
120+
- name: Install Aspire workload
121+
run: dotnet workload install aspire
122+
123+
- name: Integration Tests
124+
run: dotnet run --project build -c release -- integrate

build/CommandLine.fs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,22 @@ open Microsoft.FSharp.Reflection
99
open System
1010
open Bullseye
1111

12+
type TestSuite = All | Unit | Integration
13+
with
14+
member this.SuitName =
15+
match FSharpValue.GetUnionFields(this, typeof<TestSuite>) with
16+
| case, _ -> case.Name.ToLowerInvariant()
17+
1218
type Build =
1319
| [<CliPrefix(CliPrefix.None);SubCommand>] Clean
1420
| [<CliPrefix(CliPrefix.None);SubCommand>] Version
1521
| [<CliPrefix(CliPrefix.None);Hidden;SubCommand>] Compile
1622
| [<CliPrefix(CliPrefix.None);SubCommand>] Build
23+
1724
| [<CliPrefix(CliPrefix.None);SubCommand>] Test
18-
25+
| [<CliPrefix(CliPrefix.None);SubCommand>] Unit_Test
26+
| [<CliPrefix(CliPrefix.None);SubCommand>] Integrate
27+
1928
| [<CliPrefix(CliPrefix.None);SubCommand>] Format
2029
| [<CliPrefix(CliPrefix.None);SubCommand>] Watch
2130

@@ -33,6 +42,7 @@ type Build =
3342
| [<Inherit;AltCommandLine("-s")>] Single_Target
3443
| [<Inherit>] Token of string
3544
| [<Inherit;AltCommandLine("-c")>] Skip_Dirty_Check
45+
| [<Inherit;EqualsAssignment>] Test_Suite of TestSuite
3646
with
3747
interface IArgParserTemplate with
3848
member this.Usage =
@@ -41,8 +51,11 @@ with
4151
| Clean -> "clean known output locations"
4252
| Version -> "print version information"
4353
| Build -> "Run build"
44-
45-
| Test -> "runs a clean build and then runs all the tests "
54+
55+
| Unit_Test -> "alias to providing: test --test-suite=unit"
56+
| Integrate -> "alias to providing: test --test-suite=integration"
57+
| Test -> "runs a clean build and then runs all the tests unless --test-suite is provided"
58+
4659
| Release -> "runs build, tests, and create and validates the packages shy of publishing them"
4760
| Publish -> "Publishes artifacts"
4861
| Format -> "runs dotnet format"
@@ -62,6 +75,7 @@ with
6275
| Single_Target -> "Runs the provided sub command without running their dependencies"
6376
| Token _ -> "Token to be used to authenticate with github"
6477
| Skip_Dirty_Check -> "Skip the clean checkout check that guards the release/publish targets"
78+
| Test_Suite _ -> "Specify the test suite to run, defaults to all"
6579

6680
member this.StepName =
6781
match FSharpValue.GetUnionFields(this, typeof<Build>) with
@@ -87,4 +101,4 @@ with
87101
let dependsOn = if singleTarget then [] else dependsOn
88102

89103
let steps = dependsOn @ composedOf |> List.map _.StepName
90-
Targets.Target(target.StepName, steps, Action(fun _ -> action parsed))
104+
Targets.Target(target.StepName, steps, Action(fun _ -> action parsed))

build/Targets.fs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,17 @@ let private publishContainers _ =
107107
createImage "docs-builder"
108108
createImage "docs-assembler"
109109

110-
let private runTests _ =
110+
let private runTests (testSuite: TestSuite) _ =
111+
let testFilter =
112+
match testSuite with
113+
| All -> []
114+
| Unit -> ["--filter"; "FullyQualifiedName~.Tests"]
115+
| Integration -> ["--filter"; "FullyQualifiedName~.IntegrationTests"]
116+
111117
exec {
112118
run "dotnet" (
113119
["test"; "-c"; "release"; "--no-restore"; "--no-build"; "--logger"; "GitHubActions"]
120+
@ testFilter
114121
@ ["--"; "RunConfiguration.CollectSourceInformation=true"]
115122
)
116123
}
@@ -132,8 +139,10 @@ let Setup (parsed:ParseResults<Build>) =
132139
Build.Cmd
133140
[Clean; Lint; Compile] [] build
134141

135-
| Test -> Build.Cmd [Compile] [] runTests
136-
142+
| Test -> Build.Cmd [Compile] [] <| runTests TestSuite.All
143+
| Unit_Test -> Build.Cmd [Compile] [] <| runTests TestSuite.Unit
144+
| Integrate -> Build.Cmd [Compile] [] <| runTests TestSuite.Integration
145+
137146
| Release ->
138147
Build.Cmd
139148
[PristineCheck; Build]
@@ -159,6 +168,7 @@ let Setup (parsed:ParseResults<Build>) =
159168

160169
// flags
161170
| Single_Target
171+
| Test_Suite _
162172
| Token _
163173
| Skip_Dirty_Check -> Build.Ignore
164174

0 commit comments

Comments
 (0)