Skip to content

Commit

Permalink
[CI] Add a job to check for duplicate files
Browse files Browse the repository at this point in the history
Those would yield ambiguity when doing "From Stdlib Require File.".
There are already a few in the prelude, let's not add more.
  • Loading branch information
proux01 committed Feb 2, 2025
1 parent 7b452fb commit 620b432
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/basic-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Basic checks
on:
pull_request:
push:
branches:
- master
jobs:
basic-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for duplicate files
run: dev/tools/check-duplicate-files.sh
30 changes: 30 additions & 0 deletions dev/tools/check-duplicate-files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh

# Check for duplicate files
# Those would yield ambiguity when doing "From Stdlib Require File.".
# There are already a few in the prelude, let's not add more.

# Files that are already duplicate
DUPLICATE_FILES=" \
Byte.v \
Tactics.v \
Tauto.v \
Wf.v \
"

ALL_FILES=all_files__
ALL_FILES_UNIQ=all_files_uniq__

rm -f ${ALL_FILES} ${ALL_FILES_UNIQ}
(for f in $(find theories -name "*.v" -type f) ; do basename $f ; done) | sort > ${ALL_FILES}
(uniq ${ALL_FILES} ; for f in ${DUPLICATE_FILES} ; do echo $f ; done) | sort > ${ALL_FILES_UNIQ}

if $(diff -q ${ALL_FILES_UNIQ} ${ALL_FILES} > /dev/null) ; then
echo "No files with duplicate name."
else
echo "Error: Some files bear the same name:"
diff ${ALL_FILES_UNIQ} ${ALL_FILES}
exit 1
fi

rm -f ${ALL_FILES} ${ALL_FILES_UNIQ}

0 comments on commit 620b432

Please sign in to comment.