Skip to content

Commit

Permalink
scripts: add nuget sanity check
Browse files Browse the repository at this point in the history
This script requires the packages directory, so a NuGet.config
file had to be created to set it, otherwise the following
would occur:

```
Run dotnet fsi scripts/sanitycheck.fsx
8 nuget packages found for solution conventions.sln
System.Exception: 'packages' subdir under solution dir /__w/conventions/conventions/packages doesn't exist, run `make` first
   at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1439.Invoke(String message) in /build/dotnet6-FDnqMS/dotnet6-6.0.123/src/fsharp/artifacts/source-build/self/src/src/fsharp/FSharp.Core/printf.fs:line 1439
   at FSI_0007.findMissingPackageDirs@244(DirectoryInfo solDir, FSharpMap`2 idealPackageDirs)
   at FSI_0007.sanityCheckNugetPackagesFromSolution@120(FileInfo sol)
   at FSI_0007.SanityCheckNugetPackages()
   at <StartupCode$FSI_0007>.$FSI_0007.main@()
Stopped due to error
Error: Process completed with exit code 1.
```

NOTE: This code comes originally from geewallet at the time
of writing [1] (and so it will be removed from there soon),
but we have discarded the parts of it that deal with legacy
.NET4.x (such as packages.config files).

[1] https://github.com/nblockchain/geewallet/blob/master/scripts/sanitycheck.fsx
  • Loading branch information
Mersho authored and knocte committed Nov 24, 2023
1 parent b32e017 commit 8f93cb4
Show file tree
Hide file tree
Showing 4 changed files with 590 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ jobs:
run: dotnet fsi scripts/inconsistentVersionsInFSharpScripts.fsx
- name: Check there are no non-verbose flags in scripts and CI YML files
run: dotnet fsi scripts/nonVerboseFlagsInGitHubCIAndScripts.fsx
- name: Sanity check nuget packages of .NET projects
run: |
dotnet restore
dotnet fsi scripts/sanityCheckNuget.fsx
- name: Install prettier
run: npm install prettier@2.8.3
- name: Change file permissions
Expand Down
7 changes: 7 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<!-- TODO: file a VS4Mac bug about this below setting making the tests disappear from the Tests view -->
<add key="globalPackagesFolder" value="packages" />
</config>
</configuration>
1 change: 1 addition & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This is a repository that contains several useful things that other `nblockchain
* Use of inconsistent versions:
* [Use of inconsistent version numbers in `uses:` and `with:` GitHubCI tags](scripts/inconsistentVersionsInGitHubCI.fsx).
* [Use of inconsistent version numbers in `#r "nuget: ` refs of F# scripts](scripts/inconsistentVersionsInFSharpScripts.fsx).
* [Use of inconsistent version numbers in nuget packages of .NET projects](scripts/sanityCheckNuget.fsx).

All in all, this is mainly documentation, and some tooling to detect bad practices.

Expand Down
Loading

0 comments on commit 8f93cb4

Please sign in to comment.