this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

build: fiddle with the nix build and ci

+68 -34
+39 -12
.github/workflows/nix.yml
··· 9 9 jobs: 10 10 build: 11 11 runs-on: ubuntu-latest 12 - 13 12 steps: 14 13 - name: Checkout 15 14 uses: actions/checkout@v3 ··· 18 17 - name: Nix Cache 19 18 uses: DeterminateSystems/magic-nix-cache-action@main 20 19 21 - - name: Build Cmprss 22 - run: nix build 20 + - name: Format 21 + run: nix build .#fmt 22 + 23 + - name: Format non-Rust 24 + run: nix build .#checks.x86_64-linux.treefmt 25 + 26 + - name: Audit 27 + run: nix build .#audit 28 + 29 + - name: Clippy 30 + run: nix build .#clippy 31 + 32 + - name: Build docs 33 + run: nix build .#doc 34 + 35 + - name: Test 36 + run: nix build .#test 37 + 38 + - name: Build cmprss 39 + run: nix build .#cmprss 40 + 41 + # Run any nix checks that aren't covered by the above 42 + # This should evaluate the nix expression and then do nothing 43 + - name: Forgotten checks 44 + run: nix flake check 23 45 24 - # Runs all the other checks: formatting, building docs, clippy, etc. 25 - - name: Nix Flake Checks 26 - # Run 1 at a time and print all the log files 27 - run: nix flake check --max-jobs 1 -L 46 + # Run this separately since 47 + # 1) it uses a separate set of deps, so no shared cache with the other build 48 + # 2) failures here shouldn't block merging 49 + coverage: 50 + runs-on: ubuntu-latest 51 + needs: build 52 + steps: 53 + - name: Checkout 54 + uses: actions/checkout@v3 55 + - name: Install Nix 56 + uses: DeterminateSystems/nix-installer-action@main 57 + - name: Nix Cache 58 + uses: DeterminateSystems/magic-nix-cache-action@main 28 59 29 - # If everything is successful so far, build and run test coverage 30 60 - name: Build Coverage 61 + # Build and ensure the output is linked in result/ 31 62 run: nix build -L .#coverage 32 63 33 64 # Upload code coverage ··· 36 67 with: 37 68 token: ${{ secrets.CODECOV_TOKEN }} 38 69 file: ./result/lcov.info 39 - 40 - # Run the security audit 41 - - name: Security Audit 42 - run: nix build .#audit
+4
Taskfile.yml
··· 81 81 aliases: [cov] 82 82 # Many tools don't like the file references from `nix build .#coverage`, so we need to run this outside nix 83 83 cmd: cargo tarpaulin --skip-clean --include-tests --output-dir coverage --out lcov --no-default-features 84 + nix:coverage: 85 + desc: Create coverage using nix 86 + cmds: 87 + - nix build .#coverage --out-link coverage
+25 -22
flake.nix
··· 87 87 meta.mainProgram = "cmprss"; 88 88 }); 89 89 in { 90 - checks = { 91 - # Build the crate as part of `nix flake check` for convenience 92 - inherit cmprss; 90 + packages = { 91 + default = cmprss; 92 + cmprss = cmprss; 93 + 94 + # Check code coverage with tarpaulin 95 + coverage = craneLib.cargoTarpaulin (commonArgs 96 + // { 97 + # Use lcov output as thats far more widely supported 98 + cargoTarpaulinExtraArgs = "--skip-clean --include-tests --output-dir $out --out lcov"; 99 + }); 93 100 94 101 # Run clippy (and deny all warnings) on the crate source 95 102 clippy = craneLib.cargoClippy (commonArgs ··· 104 111 fmt = craneLib.cargoFmt commonArgs; 105 112 106 113 # Run tests with cargo-nextest 107 - nextest = craneLib.cargoNextest commonArgs; 114 + test = craneLib.cargoNextest commonArgs; 115 + 116 + # Audit dependencies 117 + # This only runs when Cargo.lock files change 118 + audit = craneLib.cargoAudit (commonArgs 119 + // { 120 + inherit (inputs) advisory-db; 121 + }); 122 + }; 123 + 124 + checks = { 125 + inherit cmprss; 126 + # Build almost every package in checks, with exceptions: 127 + # - coverage: It requires a full rebuild, and only needs to be run occasionally 128 + inherit (self.packages.${system}) clippy doc fmt test audit; 108 129 }; 109 130 110 131 # This also sets up `nix fmt` to run all formatters ··· 118 139 package = toolChain; 119 140 }; 120 141 }; 121 - }; 122 - 123 - packages = { 124 - default = cmprss; 125 - cmprss = cmprss; 126 - 127 - # Check code coverage with tarpaulin 128 - coverage = craneLib.cargoTarpaulin (commonArgs 129 - // { 130 - # Use lcov output as thats far more widely supported 131 - cargoTarpaulinExtraArgs = "--skip-clean --include-tests --output-dir $out --out lcov"; 132 - }); 133 - 134 - # Audit dependencies 135 - audit = craneLib.cargoAudit (commonArgs 136 - // { 137 - inherit (inputs) advisory-db; 138 - }); 139 142 }; 140 143 141 144 apps = rec {