Browse Source

feat: remove precommit use in ci

thesimplekid 5 months ago
parent
commit
f3be8fe393
5 changed files with 45 additions and 27 deletions
  1. 10 3
      .github/workflows/ci.yml
  2. 1 0
      .gitignore
  3. 0 1
      .pre-commit-config.yaml
  4. 9 9
      flake.lock
  5. 25 14
      flake.nix

+ 10 - 3
.github/workflows/ci.yml

@@ -21,7 +21,7 @@ jobs:
           fail-mode: true
 
   pre-commit-checks:
-    name: "Pre-commit checks: cargo fmt, typos"
+    name: "Cargo fmt, typos"
     runs-on: ubuntu-latest
     steps:
       - name: checkout
@@ -32,8 +32,15 @@ jobs:
         uses: DeterminateSystems/magic-nix-cache-action@v6
       - name: Rust Cache
         uses: Swatinem/rust-cache@v2
-      - name: Pre-commit checks
-        run: nix develop -i -L .#stable --command pre-commit run --all-files
+      - name: Cargo fmt
+        run: |
+          nix develop -i -L .#nightly --command bash -c '
+            # Force use of Nix-provided rustfmt
+            export RUSTFMT=$(command -v rustfmt)
+            cargo fmt --check
+          '
+      - name: typos
+        run: nix develop -i -L .#nightly --command typos    
 
   clippy:
     name: "Stable build, clippy and test"

+ 1 - 0
.gitignore

@@ -6,3 +6,4 @@
 *.redb
 *.sqlite*
 config.toml
+.pre-commit-config.yaml

+ 0 - 1
.pre-commit-config.yaml

@@ -1 +0,0 @@
-/nix/store/9bf8g8scpkrma0rwv05b4bd1qc81gihg-pre-commit-config.json

+ 9 - 9
flake.lock

@@ -57,11 +57,11 @@
     },
     "nixpkgs": {
       "locked": {
-        "lastModified": 1730963269,
-        "narHash": "sha256-rz30HrFYCHiWEBCKHMffHbMdWJ35hEkcRVU0h7ms3x0=",
+        "lastModified": 1731386116,
+        "narHash": "sha256-lKA770aUmjPHdTaJWnP3yQ9OI1TigenUqVC3wweqZuI=",
         "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "83fb6c028368e465cd19bb127b86f971a5e41ebc",
+        "rev": "689fed12a013f56d4c4d3f612489634267d86529",
         "type": "github"
       },
       "original": {
@@ -111,11 +111,11 @@
         "nixpkgs-stable": "nixpkgs-stable"
       },
       "locked": {
-        "lastModified": 1730814269,
-        "narHash": "sha256-fWPHyhYE6xvMI1eGY3pwBTq85wcy1YXqdzTZF+06nOg=",
+        "lastModified": 1731363552,
+        "narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=",
         "owner": "cachix",
         "repo": "pre-commit-hooks.nix",
-        "rev": "d70155fdc00df4628446352fc58adc640cd705c2",
+        "rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0",
         "type": "github"
       },
       "original": {
@@ -139,11 +139,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1731119076,
-        "narHash": "sha256-2eVhmocCZHJlFAz6Mt3EwPdFFVAtGgIySJc1EHQVxcc=",
+        "lastModified": 1731378398,
+        "narHash": "sha256-a0QWaiX8+AJ9/XBLGMDy6c90GD7HzpxKVdlFwCke5Pw=",
         "owner": "oxalica",
         "repo": "rust-overlay",
-        "rev": "23c4b3ba5f806fcf25d5a3b6b54fa0d07854c032",
+        "rev": "0ae9fc2f2fe5361837d59c0bdebbda176427111e",
         "type": "github"
       },
       "original": {

+ 25 - 14
flake.nix

@@ -53,7 +53,9 @@
         };
 
         # Nighly for creating lock files
-        nightly_toolchain = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default);
+        nightly_toolchain = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
+          extensions = [ "rustfmt" ];
+        });
 
         # Common inputs
         envVars = { };
@@ -71,6 +73,9 @@
           clightning
           bitcoind
           sqlx-cli
+
+          # Needed for github ci
+          libz
         ] ++ libsDarwin;
 
         # WASM deps
@@ -146,24 +151,24 @@
             } // envVars);
 
             stable = pkgs.mkShell ({
-              shellHook = "${_shellHook}";
+              shellHook = ''${_shellHook}'';
               buildInputs = buildInputs ++ WASMInputs ++ [ stable_toolchain ];
               inherit nativeBuildInputs;
             } // envVars);
 
 
             db_shell = pkgs.mkShell ({
-              shellHook = "
-              ${_shellHook}
-              cargo update -p half --precise 2.2.1
-              cargo update -p home --precise 0.5.5
-              cargo update -p tokio --precise 1.38.1
-              cargo update -p tokio-stream --precise 0.1.15
-              cargo update -p serde_with --precise 3.1.0
-              cargo update -p reqwest --precise 0.12.4
-              cargo update -p url --precise 2.5.2
-              cargo update -p allocator-api2 --precise 0.2.18
-              ";
+              shellHook = ''
+                ${_shellHook}
+                cargo update -p half --precise 2.2.1
+                cargo update -p home --precise 0.5.5
+                cargo update -p tokio --precise 1.38.1
+                cargo update -p tokio-stream --precise 0.1.15
+                cargo update -p serde_with --precise 3.1.0
+                cargo update -p reqwest --precise 0.12.4
+                cargo update -p url --precise 2.5.2
+                cargo update -p allocator-api2 --precise 0.2.18
+              '';
               buildInputs = buildInputs ++ WASMInputs ++ [ db_msrv_toolchain ];
               inherit nativeBuildInputs;
             } // envVars);
@@ -171,7 +176,13 @@
 
 
             nightly = pkgs.mkShell ({
-              shellHook = "${_shellHook}";
+              shellHook = ''
+                ${_shellHook}
+                # Needed for github ci
+                export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath [
+                  pkgs.zlib
+                  ]}:$LD_LIBRARY_PATH
+              '';
               buildInputs = buildInputs ++ [ nightly_toolchain ];
               inherit nativeBuildInputs;
             } // envVars);