From fb75f7418cd40eda4ba7a2c13dc811e6fabb4e46 Mon Sep 17 00:00:00 2001 From: ulic-youthlic Date: Thu, 6 Feb 2025 23:56:09 +0800 Subject: [PATCH] feat: add typo check in ci --- .github/workflows/check.yml | 18 ++++++++++++++++++ .ignore | 1 + flake.nix | 12 ++++++++++++ typos.toml | 5 +++++ 4 files changed, 36 insertions(+) create mode 100644 .ignore create mode 100644 typos.toml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e0db358..bb15a05 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -136,3 +136,21 @@ jobs: - name: Check test run: | nix build .#checks.x86_64-linux.audit 2>&1 + check-typo: + runs-on: ubuntu-latest + needs: build-nixpkg + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: nixbuild/nix-quick-install-action@v27 + + - name: Restore Nix Cache + uses: nix-community/cache-nix-action@v5 + with: + primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.nix') }} + + - name: Check test + run: | + nix build .#checks.x86_64-linux.typo 2>&1 diff --git a/.ignore b/.ignore new file mode 100644 index 0000000..c3fba8c --- /dev/null +++ b/.ignore @@ -0,0 +1 @@ +/.git diff --git a/flake.nix b/flake.nix index ff90394..db5cb14 100644 --- a/flake.nix +++ b/flake.nix @@ -102,6 +102,17 @@ }; }; cargoArtifacts = craneLib.buildDepsOnly commonArgs; + checkTypo = + pkgs.runCommandNoCCLocal "check-typo" + { + src = ./.; + nativeBuildInputs = with pkgs; [ typos ]; + } + '' + mkdir -p $out + + cd $src && typos -c $src/typos.toml + ''; in { packages = { @@ -123,6 +134,7 @@ }; checks = { inherit (self.packages."${system}") mania; + typo = checkTypo; audit = craneLib.cargoAudit ( commonArgs // { diff --git a/typos.toml b/typos.toml new file mode 100644 index 0000000..86992ac --- /dev/null +++ b/typos.toml @@ -0,0 +1,5 @@ +[files] +ignore-hidden = false +[default] +check-filename = true +check-file = true