CI: Add lint to check UUID validity

This commit is contained in:
Jack Grigg 2023-09-25 11:49:40 +00:00
parent 478b5d1858
commit a3332c4267
1 changed files with 32 additions and 0 deletions

View File

@ -159,3 +159,35 @@ jobs:
- uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt --all -- --check
uuid:
name: UUID validity
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract UUIDs
id: extract
run: |
{
echo 'UUIDS<<EOF'
git grep -h "Uuid::from_u128" zcash_client_sqlite/ |
sed -e "s,.*Uuid::from_u128(0x,," -e "s,_,-,g" -e "s,);,,"
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Check UUID validity
env:
UUIDS: ${{ steps.extract.outputs.UUIDS }}
run: uuidparse -n -o type $UUIDS | xargs -L 1 test "invalid" !=
- name: Check UUID type
env:
UUIDS: ${{ steps.extract.outputs.UUIDS }}
run: uuidparse -n -o type $UUIDS | xargs -L 1 test "random" =
- name: Check UUID uniqueness
env:
UUIDS: ${{ steps.extract.outputs.UUIDS }}
run: >
test $(
uuidparse -n -o uuid $U4 | wc -l
) -eq $(
uuidparse -n -o uuid $U4 | sort | uniq | wc -l
)