Git check patch #86
Workflow file for this run
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: Python Application | |
on: | |
push: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip virtualenv wheel setuptools | |
- name: Lint with pycodestyle | |
run: | | |
python3 -m pip install flake8 | |
python3 -m flake8 . --count --ignore=E125,E126,E127,E128,E203,E226,E402,E741,E731,W503,F401,W504,F841 --show-source --statistics --max-line-length=120 --exclude=__pycache__,.tox,.git/,doc/ | |
linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.x | |
- name: Make sdist | |
run: python3 setup.py sdist --formats=gztar | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip virtualenv wheel setuptools pytest | |
python3 -m pip install torch torchvision -f https://download.pytorch.org/whl/cpu/torch_stable.html | |
- name: Install project | |
run: python3 -m pip install -e .[dev] | |
- name: Make wheel | |
run: python3 setup.py bdist_wheel --universal | |
- name: Upload wheels as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: wheels | |
path: dist | |
- name: Upload to GitHub Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: dist/* | |
draft: true | |
- name: Pytest | |
run: | | |
cd sapicore | |
python3 -m pytest -m "not functional" | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip virtualenv wheel setuptools m2r2 | |
python3 -m pip install torch torchvision -f https://download.pytorch.org/whl/cpu/torch_stable.html | |
python3 -m pip install -e .[dev] | |
- name: Generate docs | |
run: | | |
cd docs | |
make html | |
- name: Upload docs as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: docs | |
path: docs/build/html | |
- name: gh-pages upload | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cp -r docs/build/html ~/docs_temp | |
git config --global user.email "cplab@cornell.edu" | |
git config --global user.name "CPLab" | |
git remote rm origin || true | |
git remote add origin "https://x-access-token:${GITHUB_TOKEN}@github.com/cplab/sapicore.git" | |
git checkout --orphan gh-pages | |
cp -r .git ~/docs_git | |
cd .. | |
rm -rf sapicore | |
mkdir sapicore | |
cd sapicore | |
cp -r ~/docs_git .git | |
cp -r ~/docs_temp/* . | |
touch .nojekyll | |
git add . | |
git commit -a -m "Docs for git-$GITHUB_SHA" | |
git push origin gh-pages -f |