Skip to content

Commit

Permalink
Merge PR #86 from realmarv/ymlSameVersions-squashed
Browse files Browse the repository at this point in the history
Detect inconsistent (e.g. pulumi) versions in GitHubCI
and (e.g. nuget pkgs versions) in fsx scripts.
  • Loading branch information
knocte authored Jun 27, 2023
2 parents e77df4a + 553065d commit 0a953cb
Show file tree
Hide file tree
Showing 22 changed files with 581 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ jobs:
- name: Check if gitPush1by1 was used
if: github.event_name == 'pull_request'
run: dotnet fsi scripts/detectNotUsingGitPush1by1.fsx
- name: Check there are no inconsistent versions GitHubCI files
run: dotnet fsi scripts/inconsistentVersionsInGitHubCI.fsx
- name: Check there are no inconsistent versions in nuget package references of F# scripts
run: dotnet fsi scripts/inconsistentVersionsInFSharpScripts.fsx
- name: Install prettier
run: npm install [email protected]
- name: Change file permissions
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ TestResult.xml
TestResults.xml

# Visual Studio cache files
.vs/
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
Expand Down
3 changes: 3 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ This is a repository that contains several useful things that other `nblockchain
* [Use of asterisk (*) in `PackageReference` items of .NET projects](scripts/unpinnedDotnetPackageVersions.fsx).
* [Missing the version number in `#r "nuget: ` refs of F# scripts](scripts/unpinnedNugetPackageReferenceVersions.fsx).
* [Missing the `--version` flag in `dotnet tool install foo` invocations](scripts/unpinnedDotnetToolInstallVersions.fsx).
* 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).

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

Expand Down
16 changes: 16 additions & 0 deletions scripts/inconsistentVersionsInFSharpScripts.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env -S dotnet fsi

open System.IO

#load "../src/FileConventions/Library.fs"
#load "../src/FileConventions/Helpers.fs"

let rootDir = Path.Combine(__SOURCE_DIRECTORY__, "..") |> DirectoryInfo

let inconsistentVersionsInFsharpScripts =
Helpers.GetFiles rootDir "*.fsx"
|> FileConventions.DetectInconsistentVersionsInNugetRefsInFSharpScripts

if inconsistentVersionsInFsharpScripts then
failwith
"You shouldn't use inconsistent versions in nuget package references of F# scripts."
15 changes: 15 additions & 0 deletions scripts/inconsistentVersionsInGitHubCI.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env -S dotnet fsi

open System.IO

#load "../src/FileConventions/Library.fs"

let githubWorkflowsDir =
Path.Combine(__SOURCE_DIRECTORY__, "../.github/workflows") |> DirectoryInfo

let inconsistentVersionsInGitHubCI =
FileConventions.DetectInconsistentVersionsInGitHubCI githubWorkflowsDir

if inconsistentVersionsInGitHubCI then
failwith
"You shouldn't use inconsistent versions in `uses: foo@bar` or `with: foo-version: bar` statements in GitHubCI files."
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on: [push, pull_request]

jobs:
jobA:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
uses: pulumi/[email protected]
with:
pulumi-version: 3.40.0
- name: Print "Hello World!"
run: echo "Hello World!"
jobB:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
uses: pulumi/[email protected]
with:
pulumi-version: 3.40.0
- name: Print "Hello World!"
run: echo "Hello World!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on: [push, pull_request]

jobs:
jobA:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
uses: pulumi/[email protected]
with:
pulumi-version: 3.40.0
- name: Print "Hello World!"
run: echo "Hello World!"
jobB:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
uses: pulumi/[email protected]
with:
pulumi-version: 3.40.0
- name: Print "Hello World!"
run: echo "Hello World!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CI

on: [push, pull_request]

jobs:
jobA:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
uses: pulumi/[email protected]
with:
pulumi-version: 3.40.0
- name: Print "Hello World!"
run: echo "Hello World!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CI

on: [push, pull_request]

jobs:
jobA:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
uses: pulumi/[email protected]
with:
pulumi-version: 3.40.0
- name: Print "Hello World!"
run: echo "Hello World!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CI

on: [push, pull_request]

jobs:
jobA:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- name: Print "Hello World!"
run: echo "Hello World!"
jobB:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Print "Hello World!"
run: echo "Hello World!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CI

on: [push, pull_request]

jobs:
jobA:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "14"
- name: Print "Hello World!"
run: echo "Hello World!"
jobB:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16"
- name: Print "Hello World!"
run: echo "Hello World!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on: [push, pull_request]

jobs:
jobA:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
uses: pulumi/[email protected]
with:
pulumi-version: 3.40.0
- name: Print "Hello World!"
run: echo "Hello World!"
jobB:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
uses: pulumi/[email protected]
with:
pulumi-version: 3.41.0
- name: Print "Hello World!"
run: echo "Hello World!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on: [push, pull_request]

jobs:
jobA:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
uses: pulumi/[email protected]
with:
pulumi-version: 3.40.0
- name: Print "Hello World!"
run: echo "Hello World!"
jobB:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
uses: pulumi/[email protected]
with:
pulumi-version: 3.40.0
- name: Print "Hello World!"
run: echo "Hello World!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env -S dotnet fsi

open System
open System.IO

#r "nuget: Fsdk, Version=0.6.0"

printfn "Hello World!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env -S dotnet fsi

open System
open System.IO

#r "nuget: Fsdk, Version=0.6.1"

printfn "Hello World!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env -S dotnet fsi

open System
open System.IO

#r "nuget: Fsdk, Version=0.6.0"

printfn "Hello World!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env -S dotnet fsi

open System
open System.IO

#r "nuget: Fsdk, Version=0.6.1"

printfn "Hello World!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CI

on: [push, pull_request]

jobs:
jobA:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
uses: pulumi/[email protected]
with:
pulumi-version: 3.40.0
- name: Print "Hello World!"
run: echo "Hello World!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CI

on: [push, pull_request]

jobs:
jobA:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup Pulumi CLI
uses: pulumi/[email protected]
with:
pulumi-version: 3.40.0
- name: Print "Hello World!"
run: echo "Hello World!"
Loading

0 comments on commit 0a953cb

Please sign in to comment.