1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-03 10:14:06 +02:00

add ci job to check if schema is up to date

This commit is contained in:
Robin Appelman 2024-05-06 15:34:49 +02:00
commit f8651c22ff
5 changed files with 26 additions and 5 deletions

View file

@ -91,3 +91,19 @@ jobs:
instance: https://cache.icewind.me instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}' authToken: '${{ secrets.ATTIC_TOKEN }}'
- run: nix build .#test - run: nix build .#test
check-schema:
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- run: nix run .#demostf-parser-schema > schema.json
- run: |
git diff
git diff-index --quiet HEAD --

View file

@ -87,6 +87,7 @@
}; };
}; };
}; };
overlayPackages = builtins.attrNames ((import ./nix/overlay.nix) {} {});
in rec { in rec {
packages = packages =
lib.attrsets.genAttrs targets (target: lib.attrsets.genAttrs targets (target:
@ -101,7 +102,7 @@
}; };
})) }))
// rec { // rec {
inherit (pkgs) demostf-parser demostf-parser-codegen demostf-parser-codegen-events demostf-parser-codegen-props; inherit (pkgs) demostf-parser demostf-parser-codegen demostf-parser-codegen-events demostf-parser-codegen-props demostf-parser-schema;
check = hostNaersk.buildPackage (nearskOpt check = hostNaersk.buildPackage (nearskOpt
// { // {
mode = "check"; mode = "check";

View file

@ -4,7 +4,6 @@
lib, lib,
}: let }: let
inherit (lib.sources) sourceByRegex; inherit (lib.sources) sourceByRegex;
src = sourceByRegex ../. ["Cargo.*" "(src|benches)(/.*)?"];
in in
rustPlatform.buildRustPackage { rustPlatform.buildRustPackage {
pname = "demostf-parser-codegen"; pname = "demostf-parser-codegen";
@ -14,7 +13,7 @@ in
--bin codegen --bin codegen
''; '';
src = lib.traceVal src; src = sourceByRegex ../. ["Cargo.*" "(src|benches)(/.*)?"];
buildType = "debug"; buildType = "debug";
buildFeatures = ["codegen"]; buildFeatures = ["codegen"];
@ -24,4 +23,6 @@ in
cargoLock = { cargoLock = {
lockFile = ../Cargo.lock; lockFile = ../Cargo.lock;
}; };
meta.mainProgram = "codegen";
} }

View file

@ -9,4 +9,6 @@ final: prev: {
${final.demostf-parser-codegen}/bin/codegen ${../test_data/short-2024.dem} props > $out ${final.demostf-parser-codegen}/bin/codegen ${../test_data/short-2024.dem} props > $out
${final.rustfmt}/bin/rustfmt $out ${final.rustfmt}/bin/rustfmt $out
''; '';
demostf-parser-schema = final.callPackage ./schema.nix {};
} }

View file

@ -4,7 +4,6 @@
lib, lib,
}: let }: let
inherit (lib.sources) sourceByRegex; inherit (lib.sources) sourceByRegex;
src = sourceByRegex ../. ["Cargo.*" "(src|benches)(/.*)?"];
in in
rustPlatform.buildRustPackage { rustPlatform.buildRustPackage {
pname = "demostf-parser-schema"; pname = "demostf-parser-schema";
@ -14,7 +13,7 @@ in
--bin schema --bin schema
''; '';
src = lib.traceVal src; src = sourceByRegex ../. ["Cargo.*" "(src|benches)(/.*)?"];
buildType = "debug"; buildType = "debug";
buildFeatures = ["schema"]; buildFeatures = ["schema"];
@ -24,4 +23,6 @@ in
cargoLock = { cargoLock = {
lockFile = ../Cargo.lock; lockFile = ../Cargo.lock;
}; };
meta.mainProgram = "schema";
} }