fix: name ikt "Inuktut, Western" so it sorts next to Inuktitut #1556
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run all tests | |
on: | |
- pull_request | |
- push | |
- workflow_call | |
# Since we don't checkout the full history, we use a default version so certain tests | |
# (pep440, update_schema) will still function. The fake version is set in file | |
# .SETUPTOOLS_SCM_PRETEND_VERSION | |
env: | |
G2P_STUDIO_DEBUG: 1 | |
jobs: | |
test-all-on-linux: | |
# This is our main test job, exercising everything and uploading to coverage | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.8" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
SETUPTOOLS_SCM_PRETEND_VERSION=`cat .SETUPTOOLS_SCM_PRETEND_VERSION` pip install -e .[test] | |
pip install pip-licenses | |
if pip-licenses | grep -v 'Artistic License' | grep -v LGPL | grep GNU; then echo 'Please avoid introducing *GPL dependencies'; false; fi | |
pip install coverage | |
- name: Ensure browser is installed | |
run: python -m playwright install --with-deps chromium | |
- name: Launch the API | |
run: coverage run run_studio.py & | |
- name: Run dev suite | |
run: coverage run run_tests.py dev | |
- name: Run test-studio | |
run: coverage run g2p/tests/test_studio.py | |
- name: Run generate-mapping | |
shell: bash | |
run: | | |
coverage run $(which g2p) generate-mapping --from crg --to eng | |
git status --porcelain=v1 | grep 'M g2p/mappings/langs/generated/config-g2p.yaml' || { echo 'g2p generate-mapping did not update generated/config-g2p.yaml as expected'; false; } | |
- name: Post test analyses | |
run: | | |
pkill -INT coverage | |
sleep 10 | |
coverage combine | |
coverage report | |
coverage xml | |
if git status | grep -E 'static.*json|mapping.*pkl|mapping.*.json.gz'; then echo 'g2p databases out of date, please run "g2p update" and commit the results.'; false; else echo OK; fi | |
- name: Upload coverage information | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: false # too many upload errors to keep "true" | |
- name: Make sure the CLI stays fast | |
id: cli-load-time | |
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" > 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 a PR comment | |
if: github.event_name == 'pull_request' | |
continue-on-error: true | |
uses: mshick/add-pr-comment@v2 | |
with: | |
preformatted: true | |
message-path: import-message.txt | |
test-on-windows: | |
# Make sure stuff stays compatible with Windows by testing there too. | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
# Note: this is where we also test that the g2p library still works on 3.7 | |
python-version: "3.7" | |
- name: Install dependencies | |
shell: bash | |
run: | | |
python -m pip install --upgrade pip | |
SETUPTOOLS_SCM_PRETEND_VERSION=`cat .SETUPTOOLS_SCM_PRETEND_VERSION` pip install -e .[test] | |
- name: Run tests on Windows | |
run: python run_tests.py dev | |
- name: Make sure the CLI outputs utf8 on Windows | |
run: | | |
# Warning: This is PowerShell syntax, not bash! | |
g2p convert est fra fra-ipa > out | |
if (diff (echo ɛ) (cat out)) { throw "Output did not match reference" } | |
test-heroku-env: | |
# Replicate what heroku will run | |
runs-on: ubuntu-22.04 # https://devcenter.heroku.com/articles/heroku-22-stack | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Read the Heroku run time env and cmd | |
run: | | |
echo "PYTHON_VERSION=$(cat runtime.txt | sed 's/python-//')" >> $GITHUB_ENV | |
echo "RUNTIME_CMD=$(cat Procfile | sed 's/web: *//')" >> $GITHUB_ENV | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- run: python -m pip install --upgrade pip | |
- name: Start with requirements.txt | |
# This is for optimization purposes, so that .[test] below doesn't install wrong | |
# versions just to have them replaced by requirements.txt in the next step. | |
run: pip install -r requirements.txt | |
- name: Install all test dependencies | |
run: | | |
SETUPTOOLS_SCM_PRETEND_VERSION=`cat .SETUPTOOLS_SCM_PRETEND_VERSION` pip install -e .[test] | |
python -m playwright install --with-deps chromium | |
- name: Overwrite dependencies and g2p, the Heroku way, to replicate the production env | |
run: | | |
# Possibly redundant, but make sure .[test] did not override anything | |
pip install -r requirements.txt | |
bin/post_compile | |
- name: Launch the API | |
run: ${{ env.RUNTIME_CMD }} --bind localhost:5000 & | |
- name: Run the regular dev suite | |
run: python run_tests.py dev | |
- name: Run test-studio | |
run: python g2p/tests/test_studio.py |