From 03b4fa1793630edc23268d9d77205861441f4e2a Mon Sep 17 00:00:00 2001 From: thesimplekid Date: Tue, 12 Nov 2024 18:54:43 +0000 Subject: [PATCH] feat: remove precommit use in ci --- .github/workflows/ci.yml | 13 ++++++++++--- .gitignore | 1 + .pre-commit-config.yaml | 1 - flake.lock | 18 +++++++++--------- flake.nix | 39 +++++++++++++++++++++++++-------------- 5 files changed, 45 insertions(+), 27 deletions(-) delete mode 120000 .pre-commit-config.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ed515c43..d79aebe9f 100644 --- a/.github/workflows/ci.yml +++ b/.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" diff --git a/.gitignore b/.gitignore index b76ac9536..23265c5a3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ *.redb *.sqlite* config.toml +.pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 120000 index e7bdaccfc..000000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1 +0,0 @@ -/nix/store/9bf8g8scpkrma0rwv05b4bd1qc81gihg-pre-commit-config.json \ No newline at end of file diff --git a/flake.lock b/flake.lock index b40547bae..f01519d10 100644 --- a/flake.lock +++ b/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": { diff --git a/flake.nix b/flake.nix index d65bc2687..493337b54 100644 --- a/flake.nix +++ b/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);