From 99faa6ddb02987b3ddba070784d76d0028840fb3 Mon Sep 17 00:00:00 2001 From: Patrick Stevens <3138005+Smaug123@users.noreply.github.com> Date: Sun, 14 Jul 2024 12:45:33 +0100 Subject: [PATCH] Modernise CI (#2) --- .config/dotnet-tools.json | 2 +- .editorconfig | 3 +- .github/workflows/dotnetcore.yml | 5 +- Quine/Quine.fsproj | 4 +- flake.lock | 30 +++++++++--- flake.nix | 37 +++------------ nix/deps.nix | 78 ++------------------------------ 7 files changed, 43 insertions(+), 116 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index f5827b7..2dd9e88 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "fantomas": { - "version": "5.2.0-alpha-010", + "version": "6.3.10", "commands": [ "fantomas" ] diff --git a/.editorconfig b/.editorconfig index 48c07e5..e207c42 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,7 +2,6 @@ root=true [*] charset=utf-8 -end_of_line=crlf trim_trailing_whitespace=true insert_final_newline=true indent_style=space @@ -24,7 +23,7 @@ fsharp_space_before_class_constructor=true fsharp_space_before_member=true fsharp_space_before_colon=true fsharp_space_before_semicolon=true -fsharp_multiline_block_brackets_on_same_column=true +fsharp_multiline_bracket_style=aligned fsharp_newline_between_type_definition_and_members=true fsharp_align_function_signature_to_indentation=true fsharp_alternative_long_member_definitions=true diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 0a53168..5d79eca 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -103,7 +103,10 @@ jobs: run: nix develop --command markdown-link-check README.md all-required-checks-complete: + if: ${{ always() }} needs: [check-dotnet-format, check-nix-format, build, shellcheck, linkcheck, check-is-quine] runs-on: ubuntu-latest steps: - - run: echo "All required checks complete." + - uses: Smaug123/all-required-checks-complete-action@05b40a8c47ef0b175ea326e9abb09802cb67b44e + with: + needs-context: ${{ toJSON(needs) }} diff --git a/Quine/Quine.fsproj b/Quine/Quine.fsproj index 3ebc1bf..ed06986 100644 --- a/Quine/Quine.fsproj +++ b/Quine/Quine.fsproj @@ -1,8 +1,8 @@ - + Exe - net7.0 + net8.0 Quine diff --git a/flake.lock b/flake.lock index c123c17..b7878fa 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,15 @@ { "nodes": { "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -17,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1672350804, - "narHash": "sha256-jo6zkiCabUBn3ObuKXHGqqORUMH27gYDIFFfLq5P4wg=", + "lastModified": 1720768451, + "narHash": "sha256-EYekUHJE2gxeo2pM/zM9Wlqw1Uw2XTJXOSAO79ksc4Y=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "677ed08a50931e38382dbef01cba08a8f7eac8f6", + "rev": "7e7c39ea35c5cdd002cd4588b03a3fb9ece6fad9", "type": "github" }, "original": { @@ -35,6 +38,21 @@ "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 6c846e4..ee22acc 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,6 @@ flake-utils.url = "github:numtide/flake-utils"; }; outputs = { - self, nixpkgs, flake-utils, ... @@ -14,12 +13,11 @@ system: let pkgs = import nixpkgs {inherit system;}; projectFile = "./Quine/Quine.fsproj"; - testProjectFiles = []; pname = "Quine"; - dotnet-sdk = pkgs.dotnet-sdk_7; - dotnet-runtime = pkgs.dotnetCorePackages.runtime_7_0; + dotnet-sdk = pkgs.dotnet-sdk_8; + dotnet-runtime = pkgs.dotnetCorePackages.runtime_8_0; version = "0.0.1"; - dotnetTool = toolName: toolVersion: sha256: + dotnetTool = toolName: toolVersion: hash: pkgs.stdenvNoCC.mkDerivation rec { name = toolName; version = toolVersion; @@ -27,7 +25,7 @@ src = pkgs.fetchNuGet { pname = name; version = version; - sha256 = sha256; + hash = hash; installPhase = ''mkdir -p $out/bin && cp -r tools/net6.0/any/* $out/bin''; }; installPhase = '' @@ -40,34 +38,13 @@ }; in { packages = { - fantomas = dotnetTool "fantomas" "5.2.0-alpha-010" "sha256-CuoROZBBhaK0IFjbKNLvzgX4GXwuIybqIvCtuqROBMk="; - fetchDeps = let - flags = []; - runtimeIds = map (system: pkgs.dotnetCorePackages.systemToDotnetRid system) dotnet-sdk.meta.platforms; - in - pkgs.writeShellScript "fetch-${pname}-deps" (builtins.readFile (pkgs.substituteAll { - src = ./nix/fetchDeps.sh; - pname = pname; - binPath = pkgs.lib.makeBinPath [pkgs.coreutils dotnet-sdk (pkgs.nuget-to-nix.override {inherit dotnet-sdk;})]; - projectFiles = toString (pkgs.lib.toList projectFile); - testProjectFiles = - if testProjectFiles == [] - then "" - else toString testProjectFiles; - rids = pkgs.lib.concatStringsSep "\" \"" runtimeIds; - packages = dotnet-sdk.packages; - storeSrc = pkgs.srcOnly { - src = ./.; - pname = pname; - version = version; - }; - })); + fantomas = dotnetTool "fantomas" (builtins.fromJSON (builtins.readFile ./.config/dotnet-tools.json)).tools.fantomas.version (builtins.head (builtins.filter (elem: elem.pname == "fantomas") ((import ./nix/deps.nix) {fetchNuGet = x: x;}))).hash; default = pkgs.buildDotnetModule { pname = pname; version = version; src = ./.; projectFile = projectFile; - nugetDeps = ./nix/deps.nix; + nugetDeps = ./nix/deps.nix; # `nix build .#default.passthru.fetch-deps && ./result` and put the result here doCheck = true; dotnet-sdk = dotnet-sdk; dotnet-runtime = dotnet-runtime; @@ -75,7 +52,7 @@ }; devShells = { default = pkgs.mkShell { - buildInputs = [pkgs.dotnet-sdk_7 pkgs.git pkgs.alejandra pkgs.nodePackages.markdown-link-check]; + buildInputs = [dotnet-sdk pkgs.git pkgs.alejandra pkgs.nodePackages.markdown-link-check]; }; }; } diff --git a/nix/deps.nix b/nix/deps.nix index 65c7ab6..f426db5 100644 --- a/nix/deps.nix +++ b/nix/deps.nix @@ -1,79 +1,9 @@ # This file was automatically generated by passthru.fetch-deps. -# Please don't edit it manually, your changes might get overwritten! +# Please dont edit it manually, your changes might get overwritten! {fetchNuGet}: [ (fetchNuGet { - pname = "FSharp.Core"; - version = "7.0.0"; - sha256 = "1pgk3qk9p1s53wvja17744x4bf7zs3a3wf0dmxi66w1w06z7i85x"; - }) - (fetchNuGet { - pname = "Microsoft.AspNetCore.App.Ref"; - version = "6.0.11"; - sha256 = "15n8x52njzxs2cwzzswi0kawm673jkvf2yga87jaf7hr729bfmcr"; - }) - (fetchNuGet { - pname = "Microsoft.AspNetCore.App.Runtime.linux-arm64"; - version = "6.0.11"; - sha256 = "1pw25rnw5nm51wjdjbrhzhz9v0c8gjjqn2na2bam3c5xawvnqkqf"; - }) - (fetchNuGet { - pname = "Microsoft.AspNetCore.App.Runtime.linux-x64"; - version = "6.0.11"; - sha256 = "0vd5da34frm7avrc9d16d39s2k5sgzd260j5pkjsianhpjby5rbn"; - }) - (fetchNuGet { - pname = "Microsoft.AspNetCore.App.Runtime.osx-arm64"; - version = "6.0.11"; - sha256 = "066018q4cr20404gi6i4x6xmq2hcvmlszrx5nv1gr6rlhg7xw6vh"; - }) - (fetchNuGet { - pname = "Microsoft.AspNetCore.App.Runtime.osx-x64"; - version = "6.0.11"; - sha256 = "0gy7whqd7blj6k7zyv3bgfs2hhwxvkjvvdf4axvnq43w1sv8s92d"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Host.linux-arm64"; - version = "6.0.11"; - sha256 = "0k8nl3hnr8h0ljw185dyhavrz2f7x6wavyadyf7f1v289jzasj72"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Host.linux-x64"; - version = "6.0.11"; - sha256 = "0bnq4dj7s5mspi7f8ihpp2y4bncb229ihrcmxvifsbb15mlhh8g4"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Host.osx-arm64"; - version = "6.0.11"; - sha256 = "09laias011a3v854zc962lcddjkc3bif3jwsi0blyk6v1m2mf4kl"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Host.osx-x64"; - version = "6.0.11"; - sha256 = "12g1ynar2n1jrrwa98fcp76gidj227c8swc6c3yfq4v3lgsws9mx"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Ref"; - version = "6.0.11"; - sha256 = "1j64ppdvh5s3pqr6sm3sq9bmk3fzj7l4j3bx023zn3dyllibpv68"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Runtime.linux-arm64"; - version = "6.0.11"; - sha256 = "03kvh4l5j8i8263wz7fmznzf5rs1grgazrhi3ayhynvhdal04mdk"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Runtime.linux-x64"; - version = "6.0.11"; - sha256 = "1f60dyl8pnj067i7bvmsbazcvrjkgrz9943vjj0ym49cfyq98cnw"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Runtime.osx-arm64"; - version = "6.0.11"; - sha256 = "12a0fqnwsnd6q8vdkdxylrzmmdwn4hfh58j1bdsii1kgm50qwmqp"; - }) - (fetchNuGet { - pname = "Microsoft.NETCore.App.Runtime.osx-x64"; - version = "6.0.11"; - sha256 = "01bwpalzfw62qc708488aspyy8lpyjppj1ywfhswbqllaf00i5xs"; + pname = "fantomas"; + version = "6.3.10"; + hash = "sha256-2m4YevDp9CRm/Ci2hguDXd6DUMElRg3hNAne9LHntWM="; }) ]