Skip to content

Commit

Permalink
Deploy scripts using GitHub Actions (#331)
Browse files Browse the repository at this point in the history
* deploy to aiqm/torchani-test-docs for testing

* Deploy to test PyPI on PR

* update

* fix tag version

* fix docs deploy format

* test

* fix

* deploy docs on release

* update

* deploy pypi

* update readme
  • Loading branch information
zasdfgbnm authored and farhadrgh committed Oct 14, 2019
1 parent 4bacf40 commit 9624bba
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 5 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: deploy-docs

on:
release:
types: [published]

jobs:
build:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.7]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
ci/install_dependencies.sh
pip install h5py pytorch-ignite tb-nightly sphinx sphinx_rtd_theme matplotlib pillow sphinx-gallery
pip install .
- name: Download data files
run: ./download.sh
# double check that this is indeed run under a release
- name: Fail build on non-release commits
run: git describe --exact-match --tags HEAD
# build docs
- name: Build documents
run: sphinx-build docs build
# try deploying
- name: Set up environments
run: |
mkdir -p ~/.ssh
echo ${{secrets.zasdfgbnm_bot_private_key}} | base64 -d > ~/.ssh/id_rsa
chmod 0600 ~/.ssh/id_rsa
echo ${{secrets.zasdfgbnm_bot_public_key}} > ~/.ssh/id_rsa.pub
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
git config --global user.email "zasdfgbnm-bot@example.com"
git config --global user.name "zasdfgbnm-bot"
- name: Deploy
run: |
git clone git@github.com:aiqm/torchani.git deploy_dir -b gh-pages
rm -rf deploy_dir/*
touch deploy_dir/.nojekyll
cp -r build/* deploy_dir
cd deploy_dir
git add .
git commit -m "update"
git push
33 changes: 33 additions & 0 deletions .github/workflows/deploy-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: deploy-pypi

on:
release:
types: [published]

jobs:
build:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.7]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Fail build on non-release commits
run: git describe --exact-match --tags HEAD
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install twine wheel
- name: Deploy
run: |
rm -rf dist/*
git tag $(date +'v%Y.%m.%d.%H.%M.%S')
python setup.py bdist bdist_wheel
twine upload -u zasdfgbnm-bot -p ${{secrets.zasdfgbnm_bot_pypi_password}} dist/*
29 changes: 29 additions & 0 deletions .github/workflows/deploy-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: deploy-test-pypi

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.7]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install twine wheel
- name: Deploy
run: |
rm -rf dist/*
git tag $(date +'v%Y.%m.%d.%H.%M.%S')
python setup.py bdist bdist_wheel
twine upload --repository-url https://test.pypi.org/legacy/ -u zasdfgbnm-bot -p ${{secrets.zasdfgbnm_bot_test_pypi_password}} dist/*
22 changes: 22 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,27 @@ jobs:
pip install .
- name: Download data files
run: ./download.sh
# build docs
- name: Build documents
run: sphinx-build docs build
# try deploying to aiqm/torchani-test-docs
- name: Set up environments
run: |
mkdir -p ~/.ssh
echo ${{secrets.zasdfgbnm_bot_private_key}} | base64 -d > ~/.ssh/id_rsa
chmod 0600 ~/.ssh/id_rsa
echo ${{secrets.zasdfgbnm_bot_public_key}} > ~/.ssh/id_rsa.pub
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
git config --global user.email "zasdfgbnm-bot@example.com"
git config --global user.name "zasdfgbnm-bot"
- name: Deploy
run: |
git clone git@github.com:aiqm/torchani-test-docs.git deploy_dir -b gh-pages
rm -rf deploy_dir/*
touch deploy_dir/.nojekyll
cp -r build/* deploy_dir
cd deploy_dir
git add .
git commit -m "update"
git push
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# <img src=https://raw.githubusercontent.com/aiqm/torchani/master/logo1.png width=180/> Accurate Neural Network Potential on PyTorch

Build:
Metrics:

![PyPI](https://img.shields.io/pypi/v/torchani.svg)
![PyPI - Downloads](https://img.shields.io/pypi/dm/torchani.svg)

Checks:

[![Actions Status](https://github.com/aiqm/torchani/workflows/docs/badge.svg)](https://github.com/aiqm/torchani/actions)
[![Actions Status](https://github.com/aiqm/torchani/workflows/flake8/badge.svg)](https://github.com/aiqm/torchani/actions)
[![Actions Status](https://github.com/aiqm/torchani/workflows/python2/badge.svg)](https://github.com/aiqm/torchani/actions)
[![Actions Status](https://github.com/aiqm/torchani/workflows/runnable%20submodules/badge.svg)](https://github.com/aiqm/torchani/actions)
[![Actions Status](https://github.com/aiqm/torchani/workflows/tools/badge.svg)](https://github.com/aiqm/torchani/actions)
[![Actions Status](https://github.com/aiqm/torchani/workflows/unit%20tests/badge.svg)](https://github.com/aiqm/torchani/actions)

Checks:

[![CodeFactor](https://www.codefactor.io/repository/github/aiqm/torchani/badge/master)](https://www.codefactor.io/repository/github/aiqm/torchani/overview/master)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/aiqm/torchani.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/aiqm/torchani/alerts/)

Deploy (these builds only succeed on tagged commits):
Deploy:

[![Build Status](https://zasdfgbnm.visualstudio.com/torchani/_apis/build/status/Deploy%20docs?branchName=master)](https://zasdfgbnm.visualstudio.com/torchani/_build/latest?definitionId=9?branchName=master)
[![Build Status](https://zasdfgbnm.visualstudio.com/torchani/_apis/build/status/Deploy%20PYPI?branchName=master)](https://zasdfgbnm.visualstudio.com/torchani/_build/latest?definitionId=10?branchName=master)
Expand Down Expand Up @@ -82,6 +84,10 @@ pip install sphinx sphinx-gallery pillow matplotlib sphinx_rtd_theme

To manually run unit tests, do `python setup.py nosetests`

If you opened a pull request, you could see your generated documents at https://aiqm.github.io/torchani-test-docs/ after you `docs` check succeed.
Keep in mind that this repository is only for the purpose of convenience of development, and only keeps the latest push.
The CI runing for other pull requests might overwrite this repository. You could rerun the `docs` check to overwrite this repo to your build.

# Note to TorchANI developers

Never commit to the master branch directly. If you need to change something, create a new branch, submit a PR on GitHub.
Expand Down

0 comments on commit 9624bba

Please sign in to comment.