Skip to content

Commit

Permalink
feat(taskfile): auto-download e2e-data repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Elijas committed Oct 13, 2023
1 parent 486df3a commit 8d96954
Showing 1 changed file with 43 additions and 7 deletions.
50 changes: 43 additions & 7 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ tasks:
cmds:
- task unit
- task lint
- task e2e-verify

######################
### Run Unit Tests ###
Expand Down Expand Up @@ -66,23 +67,58 @@ tasks:
desc: Generate the end-to-end dataset snapshots with the latest parser results.
silent: true
cmds:
# Check if the sec-parser-e2e-data directory exists.
- if [ ! -d "{{.ROOT_DIR}}/../sec-parser-e2e-data" ]; then echo "Directory ../sec-parser-e2e-data does not exist. Please use \"git clone\" to download it from https://github.com/alphanome-ai/sec-parser-e2e-data. Aborting."; exit 1; fi
# Check if the sec-parser-e2e-data directory exists. If not, download it.
- >
[ -d "{{.ROOT_DIR}}/../sec-parser-e2e-data" ] || {
git clone https://github.com/alphanome-ai/sec-parser-e2e-data "{{.ROOT_DIR}}/../sec-parser-e2e-data" || {
echo "Directory ../sec-parser-e2e-data does not exist and git clone failed. Please use \"git clone\" to download it from https://github.com/alphanome-ai/sec-parser-e2e-data. Aborting.";
exit 1;
}
}
# Abort if there are any changes in the working tree or index.
- if git diff --exit-code > /dev/null 2>&1 && git diff --cached --exit-code > /dev/null 2>&1; then :; else echo "Changes detected in the working tree or index. Please commit or stash them before proceeding."; exit 1; fi
- >
if git diff --exit-code > /dev/null 2>&1 && git diff --cached --exit-code > /dev/null 2>&1;
then :;
else
echo "Changes detected in the working tree or index. Please commit or stash them before proceeding.";
exit 1;
fi
# Generate snapshots.
- poetry run python -m tests.e2e generate {{.CLI_ARGS}}
# Print a message for manual review of the snapshot and get the current commit hash of the repository.
- echo "Success!" && echo && echo "Now, please manually review the generated snapshot in sec-parser-e2e-data." && echo "If it appears correct, commit it to the sec-parser-e2e-data repository." && echo "Remember to include the sec-parser hash in the commit message:" && echo && echo "Generated by sec-parser, commit hash $(git rev-parse HEAD)"
- >
echo "Success!" &&
echo &&
echo "Now, please manually review the generated snapshot in sec-parser-e2e-data." &&
echo "If it appears correct, commit it to the sec-parser-e2e-data repository." &&
echo "Remember to include the sec-parser hash in the commit message:" &&
echo &&
echo "Generated by sec-parser, commit hash $(git rev-parse HEAD)"
e2e-verify:
desc: Verify the end-to-end dataset snapshots against the latest parser results.
silent: true
cmds:
# Check if the sec-parser-e2e-data directory exists.
- if [ ! -d "{{.ROOT_DIR}}/../sec-parser-e2e-data" ]; then echo "Directory ../sec-parser-e2e-data does not exist. Please use \"git clone\" to download it from https://github.com/alphanome-ai/sec-parser-e2e-data. Aborting."; exit 1; fi
# Check if the sec-parser-e2e-data directory exists. If not, download it.
- >
if [ -d "{{.ROOT_DIR}}/../sec-parser-e2e-data" ]; then
:
else
git clone https://github.com/alphanome-ai/sec-parser-e2e-data "{{.ROOT_DIR}}/../sec-parser-e2e-data" || {
echo "Directory ../sec-parser-e2e-data does not exist and git clone failed. Please use \"git clone\" to download it from https://github.com/alphanome-ai/sec-parser-e2e-data. Aborting.";
exit 1;
}
fi
# Abort if there are any changes in the working tree (or index) of the sec-parser-e2e-data repository.
- cd "{{.ROOT_DIR}}/../sec-parser-e2e-data" && if git diff --exit-code > /dev/null 2>&1 && git diff --cached --exit-code > /dev/null 2>&1; then :; else echo "Changes detected in the working tree or index of the sec-parser-e2e-data repository. Please commit or stash them before proceeding."; exit 1; fi
- >
cd "{{.ROOT_DIR}}/../sec-parser-e2e-data" &&
if git diff --exit-code > /dev/null 2>&1 && git diff --cached --exit-code > /dev/null 2>&1;
then
:;
else
echo "Changes detected in the working tree or index of the sec-parser-e2e-data repository. Please commit or stash them before proceeding.";
exit 1;
fi
# Verify the snapshots.
- poetry run python -m tests.e2e verify {{.CLI_ARGS}}

Expand Down

0 comments on commit 8d96954

Please sign in to comment.