|
1 | 1 | name: Unit test and coverage |
2 | 2 |
|
3 | | -on: |
4 | | - push: |
5 | | - paths-ignore: |
6 | | - - '**.md' |
7 | | - - 'docs/**' |
8 | | - pull_request: |
9 | | - branches: |
10 | | - - dev |
11 | | - paths-ignore: |
12 | | - - '**.md' |
13 | | - - 'docs/**' |
14 | | - |
15 | | -jobs: |
16 | | - unittest: |
17 | | - strategy: |
18 | | - fail-fast: false |
19 | | - matrix: |
20 | | - os: ["macos-latest", "ubuntu-latest", "windows-latest"] |
21 | | - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] |
22 | | - |
23 | | - runs-on: ${{ matrix.os }} |
24 | | - env: |
25 | | - PYICU_WIN_VER: 2.14 |
26 | | - INSTALL_PYICU_WIN: false |
27 | | - INSTALL_TORCH: false |
28 | | - INSTALL_FULL_DEPS: false |
29 | | - |
30 | | - steps: |
31 | | - - name: Checkout |
32 | | - uses: actions/checkout@v4 |
33 | | - - name: Set up Python ${{ matrix.python-version }} |
34 | | - uses: actions/setup-python@v5 |
35 | | - with: |
36 | | - python-version: ${{ matrix.python-version }} |
37 | | - cache: "pip" |
38 | | - - name: Install build tools |
39 | | - run: | |
40 | | - pip install --upgrade "pip<24.1" "setuptools>=65.0.2,<=73.0.1" |
41 | | - pip install coverage coveralls |
42 | | - # pip<24.1 because https://github.com/omry/omegaconf/pull/1195 |
43 | | - # setuptools>=65.0.2 because https://github.com/pypa/setuptools/commit/d03da04e024ad4289342077eef6de40013630a44#diff-9ea6e1e3dde6d4a7e08c7c88eceed69ca745d0d2c779f8f85219b22266efff7fR1 |
44 | | - # setuptools<=73.0.1 because https://github.com/pypa/setuptools/issues/4620 |
45 | | - - name: Install ICU (macOS) |
46 | | - if: startsWith(matrix.os, 'macos-') |
47 | | - run: | |
48 | | - brew install icu4c |
49 | | - PKG_CONFIG_PATH=$(brew --prefix)/opt/icu4c/lib/pkgconfig |
50 | | - echo "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}" >> "${GITHUB_ENV}" |
51 | | - ICU_VER=$(pkg-config --modversion icu-i18n) |
52 | | - echo "ICU_VER=${ICU_VER}" |
53 | | - echo "ICU_VER=${ICU_VER}" >> "${GITHUB_ENV}" |
54 | | - - name: Install PyICU (Windows) |
55 | | - if: startsWith(matrix.os, 'windows-') && env.INSTALL_PYICU_WIN == 'true' |
56 | | - shell: powershell |
57 | | - run: | |
58 | | - $PYTHON_WIN_VER = "${{ matrix.python-version }}" |
59 | | - $CP_VER = "cp" + $PYTHON_WIN_VER.Replace(".", "") |
60 | | - $WHEEL_URL = "https://github.com/cgohlke/pyicu-build/releases/download/v${{ env.PYICU_WIN_VER }}/PyICU-${{ env.PYICU_WIN_VER }}-${CP_VER}-${CP_VER}-win_amd64.whl" |
61 | | - pip install "$WHEEL_URL" |
62 | | - # Get wheel URL from https://github.com/cgohlke/pyicu-build/releases |
63 | | - - name: Install PyTorch |
64 | | - if: env.INSTALL_TORCH == 'true' |
65 | | - run: pip install torch |
66 | | - # If torch for the platform is not available in PyPI, use this command: |
67 | | - # pip install "<torch_wheel_url>" |
68 | | - # Get wheel URL from http://download.pytorch.org/whl/torch/ |
69 | | - - name: Install dependencies |
70 | | - if: env.INSTALL_FULL_DEPS == 'true' |
71 | | - env: |
72 | | - SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True |
73 | | - run: pip install -r docker_requirements.txt |
74 | | - - name: Install PyThaiNLP |
75 | | - run: pip install . |
76 | | -name: Unit test and coverage |
77 | | - |
78 | 3 | on: |
79 | 4 | push: |
80 | 5 | paths-ignore: |
@@ -165,14 +90,3 @@ jobs: |
165 | 90 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
166 | 91 | COVERALLS_SERVICE_NAME: github |
167 | 92 | run: coveralls |
168 | | - |
169 | | - - name: Unit test and code coverage |
170 | | - run: coverage run -m unittest tests |
171 | | - # Use 'unittest tests' instead of 'unittest discover' to avoid loading |
172 | | - # tests with external imports. |
173 | | - # Test cases loaded is defined in __init__.py in the tests directory. |
174 | | - - name: Coverage report |
175 | | - env: |
176 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
177 | | - COVERALLS_SERVICE_NAME: github |
178 | | - run: coveralls |
0 commit comments