-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
79 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Python package | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [ 3.6, 3.7 ] | ||
torch-version: [ 1.0.1, 1.1.0, 1.2.0, 1.3.0, 1.4.0] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Cache pip | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
${{ runner.os }}- | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --progress-bar off --upgrade pip | ||
pip install --progress-bar off torch==${{ matrix.python-version }} | ||
pip install --progress-bar off .[extras] | ||
if [[ ${{ matrix.python-version }} == "1.4.0" ]]; then pip install pylint==2.4.4 flake8==3.7.9; fi | ||
if [[ ${{ matrix.python-version }} != "1.0.1" ]]; then pip install mypy==0.761; fi | ||
pip install pytest | ||
pip install --progress-bar off coverage codecov | ||
- name: Linting | ||
run: | | ||
if [[ ${{ matrix.python-version }} == "1.4.0" ]]; then pylint texar/ examples/; fi | ||
if [[ ${{ matrix.python-version }} == "1.4.0" ]]; then flake8 texar/ examples/; fi | ||
if [[ ${{ matrix.python-version }} != "1.0.1" ]]; then mypy .; fi | ||
if [[ ${{ matrix.python-version }} != "1.0.1" ]]; then _rc=0; for dir in `echo examples/**/`; do mypy $dir || _rc=$?; done && [[ $_rc == 0 ]]; fi | ||
- name: Test with pytest and run coverage | ||
run: | | ||
coverage run -m pytest | ||
- name: Upload to codecov | ||
run: | | ||
codecov | ||
docs: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
env: | ||
python-version: 3.7 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ env.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.python-version }} | ||
- name: Cache pip | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
${{ runner.os }}- | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --progress-bar off --upgrade pip | ||
pip install --progress-bar off -r requirements.txt | ||
pip install --progress-bar off .[extras] | ||
pip install --progress-bar off -r docs/requirements.txt | ||
- name: Build Docs | ||
run: | | ||
cd docs | ||
sphinx-build -W -b html -d _build/doctrees . _build/html | ||
sphinx-build -W -b spelling -d _build/doctrees . _build/spelling |