Skip to content

Commit

Permalink
ci: tweak output of CLI speed check
Browse files Browse the repository at this point in the history
  • Loading branch information
joanise committed Jul 11, 2024
1 parent 9f4ab1a commit 55b80de
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,20 @@ jobs:
run: |
PYTHONPROFILEIMPORTTIME=1 g2p -h 2> importtime.txt > /dev/null
CLI_LOAD_TIME="$((/usr/bin/time --format=%E g2p -h > /dev/null) 2>&1)"
echo "CLI load time: $CLI_LOAD_TIME"
cat importtime.txt
echo "CLI load time: $CLI_LOAD_TIME" > import-message.txt
echo "PR head ${{ github.event.pull_request.head.sha }}" >> import-message.txt
PR_HEAD="${{ github.event.pull_request.head.sha }}"
[[ $PR_HEAD ]] && echo "Pull Request HEAD: $PR_HEAD" >> import-message.txt
echo "Imports that take more than 0.1 s:" >> import-message.txt
grep -E 'cumulative|[0-9]{6} ' importtime.txt >> import-message.txt
cat import-message.txt
echo "Full import time log:"
cat importtime.txt
if [[ "$CLI_LOAD_TIME" > "0:01.00" ]]; then \
echo "ERROR: g2p --help is too slow."; \
echo "Please run 'PYTHONPROFILEIMPORTTIME=1 g2p -h 2> importtime.txt; tuna importtime.txt' and tuck away expensive imports so that the CLI doesn't load them until it uses them."; \
false; \
fi
- name: Report help speed in PR
- name: Report help speed in a PR comment
if: github.event_name == 'pull_request'
continue-on-error: true
uses: mshick/add-pr-comment@v2
Expand Down

0 comments on commit 55b80de

Please sign in to comment.