Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
Start using github actions for CI.
  • Loading branch information
hunterhector committed Mar 25, 2021
1 parent 426bae9 commit 66a76c6
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/main.yml
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

0 comments on commit 66a76c6

Please sign in to comment.