Skip to content

Commit

Permalink
Name files for better sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
WeetHet committed Aug 1, 2024
1 parent aeb0ff0 commit 64b7cb7
Show file tree
Hide file tree
Showing 19 changed files with 28 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/test-dafny.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ jobs:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v20
- name: Run Dafny Tests
run: nix run
- name: Test if all dafny files are named correctly
run: nix run .#dafny-namecheck
- name: Run Dafny on all files
run: nix run .#dafny-check
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 24 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,34 @@
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
perSystem = { pkgs, ... }: {
packages.default = pkgs.writeShellScriptBin "dafny-test-all" ''
for f in *.dfy
packages = rec {
dafny-check = pkgs.writeShellScriptBin "dafny-check" ''
DIR=''${1:-.}
for f in DIR/*.dfy
do
echo "Testing $f"
${pkgs.dafny}/bin/dafny verify --allow-warnings --verification-time-limit 10 $f
done
'';
'';

dafny-namecheck = pkgs.writeShellScriptBin "dafny-namecheck" ''
# Directory to check, use current directory if not specified
DIR=''${1:-.}
for file in "$DIR"/*.dfy; do
if [[ -e $file ]]; then
filename=$(basename "$file")
if ! [[ $filename =~ ^[0-9]{3} ]]; then
echo "File $file does not start with three digits. (this is needed for better sorting)"
exit 1
fi
fi
done
echo "All dafny files start with three digits."
'';
};
};
};
}

0 comments on commit 64b7cb7

Please sign in to comment.