feat: English ITN with full rule coverage #162
Workflow file for this run
This file contains hidden or 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: UnitTest | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| paths: | |
| - '**.py' | |
| - '**.tsv' | |
| - '**.toml' | |
| - '**.yml' | |
| jobs: | |
| unit-test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: ${{ github.event_name == 'pull_request' && fromJSON('["ubuntu-latest"]') || fromJSON('["ubuntu-latest", "macos-latest", "windows-latest"]') }} | |
| python-version: ['3.9'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ matrix.python-version }} (non-Windows) | |
| if: runner.os != 'Windows' | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache Homebrew (macOS) | |
| if: runner.os == 'macOS' | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| /opt/homebrew/Cellar/openfst | |
| /opt/homebrew/include/fst | |
| /opt/homebrew/lib/libfst* | |
| key: brew-openfst-${{ runner.os }} | |
| - name: Install openfst (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install openfst || true | |
| echo "CPLUS_INCLUDE_PATH=/opt/homebrew/include:$CPLUS_INCLUDE_PATH" >> $GITHUB_ENV | |
| echo "LIBRARY_PATH=/opt/homebrew/lib:$LIBRARY_PATH" >> $GITHUB_ENV | |
| - name: Cache pip (non-Windows) | |
| if: runner.os != 'Windows' | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: pip-${{ runner.os }}-${{ hashFiles('pyproject.toml') }} | |
| - name: Install dependencies (non-Windows) | |
| if: runner.os != 'Windows' | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install .[test] | |
| - name: Set up Conda (Windows) | |
| if: runner.os == 'Windows' | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| activate-environment: test | |
| use-only-tar-bz2: true | |
| - name: Cache Conda (Windows) | |
| if: runner.os == 'Windows' | |
| uses: actions/cache@v4 | |
| with: | |
| path: C:\Miniconda\envs\test | |
| key: conda-${{ runner.os }}-${{ hashFiles('pyproject.toml') }} | |
| - name: Install dependencies (Windows) | |
| if: runner.os == 'Windows' | |
| shell: bash -el {0} | |
| run: | | |
| conda install -c conda-forge pynini | |
| python -m pip install --upgrade pip | |
| pip install .[test] --no-deps | |
| pip install flake8 pytest importlib_resources | |
| - name: Lint with flake8 | |
| shell: bash -el {0} | |
| run: | | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| - name: Test with pytest | |
| shell: bash -el {0} | |
| run: pytest |