Merge pull request #795 from HRNPH/dev #1301
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: macOS Unit test and code coverage | |
on: | |
push: | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
# - '**.yml' | |
pull_request: | |
branches: | |
- dev | |
paths-ignore: | |
- '**.md' | |
- '**.yml' | |
- 'docs/**' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, self-hosted] | |
python-version: [3.8] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
auto-activate-base: false | |
auto-update-conda: true | |
if: matrix.os == 'macos-latest' | |
# - name: Install mac m1 | |
# run: | | |
# mkdir -p ~/miniconda3 | |
# wget https://repo.anaconda.com/miniconda/Miniconda3-py38_4.12.0-MacOSX-arm64.sh | |
# chmod +x Miniconda3-py38_4.12.0-MacOSX-arm64.sh | |
# bash Miniconda3-py38_4.12.0-MacOSX-arm64.sh -b -u -p ~/miniconda3 | |
# ~/miniconda3/bin/conda init bash | |
# ~/miniconda3/bin/conda init zsh | |
# if: matrix.os == 'self-hosted' | |
- name: Test PyThaiNLP - M1 | |
shell: bash -l {0} | |
run: | | |
source ~/miniconda3/etc/profile.d/conda.sh | |
conda activate pythainlp38 | |
conda info | |
conda list | |
python -m pip install --upgrade pip | |
pip uninstall --y pythainlp | |
pip install --no-deps fastai==1.0.61 | |
pip install PyYAML attacut emoji epitran gensim nltk numpy pandas sacremoses sentencepiece ssg bpemb transformers sefr_cut phunspell spylls symspellpy tltk oskut nlpo3 onnxruntime thai_nner wunsen spacy_thai ufal.chu-liu-edmonds | |
pip install -e . | |
python -m nltk.downloader omw-1.4 | |
python -m unittest discover | |
if: matrix.os == 'self-hosted' | |
- shell: bash -l {0} | |
run: | | |
conda info | |
conda list | |
if: matrix.os == 'self-hosted' | |
- name: Install PyTorch | |
shell: bash -l {0} | |
run: | | |
pip install torch==1.10.0 | |
if: matrix.os != 'self-hosted' | |
- name: Install dependencies | |
shell: bash -l {0} | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest coverage coveralls | |
conda install -c conda-forge icu | |
conda install -c conda-forge pyicu | |
if [ -f docker_requirements.txt ]; then pip install -r docker_requirements.txt; fi | |
pip install deepcut tltk | |
pip install .[full] | |
python -m nltk.downloader omw-1.4 | |
if: matrix.os != 'self-hosted' | |
- name: Test | |
shell: bash -l {0} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_SERVICE_NAME: github | |
run: | | |
coverage run -m unittest discover | |
coveralls | |
if: matrix.os != 'self-hosted' |