Skip to content

Commit 19aa9d2

Browse files
committed
feat(ci): self check the solution
1 parent a88aef2 commit 19aa9d2

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

.github/workflows/build+test+deploy.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,25 @@ jobs:
3939
CI: true
4040
CONFIGURATION: ${{ matrix.configuration }}
4141
ENABLE_COVERAGE: true
42+
43+
# Run SelfCheck once on Linux to check for lint warnings
44+
selfcheck:
45+
runs-on: ubuntu-latest
46+
needs: build
47+
steps:
48+
- uses: actions/checkout@v4
49+
- name: Setup necessary dotnet SDKs
50+
uses: actions/setup-dotnet@v4
51+
with:
52+
global-json-file: global.json
53+
54+
- name: Run SelfCheck
55+
run: |
56+
chmod +x ./build.sh
57+
./build.sh SelfCheck
58+
env:
59+
CI: true
60+
4261
# Builds the project in a dev container
4362
build-devcontainer:
4463
runs-on: ubuntu-latest

build/Properties/launchSettings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
"commandName": "Project",
1717
"commandLineArgs": "--target BuildDocs"
1818
},
19+
"SelfCheck": {
20+
"commandName": "Project",
21+
"commandLineArgs": "--target SelfCheck"
22+
},
1923
"Release": {
2024
"commandName": "Project",
2125
"commandLineArgs": "--target Release 0.24.2"

build/build.fs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ let releaseBranch = "main"
6969
let readme = "README.md"
7070
let changelogFile = "CHANGELOG.md"
7171

72+
// fsharplint:disable FL0046
7273
let READMElink = Uri (Uri (gitHubRepoUrl), $"blob/{releaseBranch}/{readme}")
7374
let CHANGELOGlink = Uri (Uri (gitHubRepoUrl), $"blob/{releaseBranch}/{changelogFile}")
75+
// fsharplint:enable FL0046
7476

7577
let changelogPath = rootDirectory </> changelogFile
7678

@@ -155,12 +157,14 @@ module dotnet =
155157
let fantomas args = DotNet.exec id "fantomas" args
156158

157159
module FSharpAnalyzers =
160+
// fsharplint:disable FL0041
158161
type Arguments =
159162
| Project of string
160163
| Analyzers_Path of string
161164
| Fail_On_Warnings of string list
162165
| Ignore_Files of string list
163166
| Verbose
167+
// fsharplint:enable FL0041
164168

165169
interface IArgParserTemplate with
166170
member s.Usage = ""
@@ -563,6 +567,16 @@ let watchDocs ctx =
563567
let configuration = configuration (ctx.Context.AllExecutingTargets)
564568
DocsTool.watch (string configuration)
565569

570+
let selfCheck _ =
571+
let srcDir = rootDirectory </> "src"
572+
let consoleProj = srcDir </> "FSharpLint.Console"
573+
let sol = sln
574+
575+
DotNet.exec
576+
(fun opts -> { opts with WorkingDirectory = consoleProj })
577+
"run"
578+
$"lint %s{sol}"
579+
|> failOnBadExitAndPrint
566580

567581
let initTargets (ctx : Context.FakeExecutionContext) =
568582
BuildServer.install [ GitHubActions.Installer ]
@@ -614,6 +628,7 @@ let initTargets (ctx : Context.FakeExecutionContext) =
614628
Target.create "CleanDocsCache" cleanDocsCache
615629
Target.create "BuildDocs" buildDocs
616630
Target.create "WatchDocs" watchDocs
631+
Target.create "SelfCheck" selfCheck
617632

618633
//-----------------------------------------------------------------------------
619634
// Target Dependencies

0 commit comments

Comments
 (0)