Skip to content

Commit 620b432

Browse files
committed
[CI] Add a job to 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.
1 parent 7b452fb commit 620b432

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

.github/workflows/basic-checks.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Basic checks
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
jobs:
8+
basic-checks:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
- name: Check for duplicate files
14+
run: dev/tools/check-duplicate-files.sh

dev/tools/check-duplicate-files.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
3+
# Check for duplicate files
4+
# Those would yield ambiguity when doing "From Stdlib Require File.".
5+
# There are already a few in the prelude, let's not add more.
6+
7+
# Files that are already duplicate
8+
DUPLICATE_FILES=" \
9+
Byte.v \
10+
Tactics.v \
11+
Tauto.v \
12+
Wf.v \
13+
"
14+
15+
ALL_FILES=all_files__
16+
ALL_FILES_UNIQ=all_files_uniq__
17+
18+
rm -f ${ALL_FILES} ${ALL_FILES_UNIQ}
19+
(for f in $(find theories -name "*.v" -type f) ; do basename $f ; done) | sort > ${ALL_FILES}
20+
(uniq ${ALL_FILES} ; for f in ${DUPLICATE_FILES} ; do echo $f ; done) | sort > ${ALL_FILES_UNIQ}
21+
22+
if $(diff -q ${ALL_FILES_UNIQ} ${ALL_FILES} > /dev/null) ; then
23+
echo "No files with duplicate name."
24+
else
25+
echo "Error: Some files bear the same name:"
26+
diff ${ALL_FILES_UNIQ} ${ALL_FILES}
27+
exit 1
28+
fi
29+
30+
rm -f ${ALL_FILES} ${ALL_FILES_UNIQ}

0 commit comments

Comments
 (0)