Unverified Commit 8ba35f6a authored by Daiki Nishikawa's avatar Daiki Nishikawa Committed by GitHub
Browse files

Merge pull request #2294 from nd-02110114/migrate-github-actions

Migrate GitHub Actions
parents e57fa410 0d943d7c
Loading
Loading
Loading
Loading
+98 −0
Original line number Diff line number Diff line
name: Test for build scripts
on:
  push: # ci work when pushing master branch
    branches:
      - master
  pull_request: # ci work when creating a PR to master branch
    branches:
      - master
jobs:
  bash-build:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
        python-version: [3.7]
    steps:
    - uses: actions/checkout@v2
    - name: Cache pip modules for Linux
      if: runner.os == 'Linux'
      uses: actions/cache@v2
      with:
        path: ~/.cache/pip
        key: ${{ runner.os }}-pip-${{ hashFiles('env.*.yml') }}
        restore-keys: |
          ${{ runner.os }}-pip-
    - name: Cache pip modules for MacOS
      if: runner.os == 'macOS'
      uses: actions/cache@v2
      with:
        path: ~/Library/Caches/pip
        key: ${{ matrix.os }}-pip-${{ hashFiles('env.*.yml') }}
        restore-keys: |
          ${{ runner.os }}-pip-
    - name: Install miniconda
      uses: conda-incubator/setup-miniconda@v2
      with:
        miniconda-version: "latest"
        auto-update-conda: true
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies (failure check)
      continue-on-error: true
      shell: bash -l {0}
      run: |
        source scripts/install_deepchem_conda.sh
    - name: Install all dependencies
      shell: bash -l {0}
      run: |
        source scripts/install_deepchem_conda.sh ${{ matrix.python-version }} cpu
    - name: Build DeepChem from source
      shell: bash -l {0}
      run: |
        conda activate deepchem
        pip install -e .
        python -V
        python -c 'import deepchem; print(deepchem.__version__)'
        python -c 'import rdkit; print(rdkit.__version__)'
        python -c 'import torch; print(torch.__version__)'
        python -c 'import tensorflow; print(tensorflow.__version__)'

  powershell-build:
    runs-on: windows-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: [3.7]
    steps:
    - uses: actions/checkout@v2
    - name: Cache pip packages for Windows
      uses: actions/cache@v2
      with:
        path: ~\AppData\Local\pip\Cache
        key: ${{ matrix.os }}-pip-${{ hashFiles('env.*.yml') }}
    - name: Install miniconda
      uses: conda-incubator/setup-miniconda@v2
      with:
        miniconda-version: "latest"
        auto-update-conda: true
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies (failure check)
      continue-on-error: true
      shell: pwsh
      run: |
        . .\scripts\install_deepchem_conda.ps1
    - name: Install dependencies
      shell: pwsh
      run: |
        . .\scripts\install_deepchem_conda.ps1 ${{ matrix.python-version }} cpu
    - name: Build DeepChem from source
      shell: pwsh
      run: |
        conda activate deepchem
        pip install -e .
        python -V
        python -c 'import deepchem; print(deepchem.__version__)'
        python -c 'import rdkit; print(rdkit.__version__)'
        python -c 'import torch; print(torch.__version__)'
        python -c 'import tensorflow; print(tensorflow.__version__)'
+57 −0
Original line number Diff line number Diff line
name: Test for documents
on:
  push: # ci work when pushing master branch
    branches:
      - master
  pull_request: # ci work when creating a PR to master branch
    branches:
      - master
jobs:
  linux:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: [3.7]
    steps:
    - uses: actions/checkout@v2
    - name: Cache pip packages for Linux
      uses: actions/cache@v2
      with:
        path: ~/.cache/pip
        key: ${{ runner.os }}-pip-${{ hashFiles('env.*.yml') }}
        restore-keys: |
          ${{ runner.os }}-pip-
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Create env.yml
      run: |
        python -m pip install --upgrade pip
        pip install conda-merge
        conda-merge env.common.yml env.cpu.yml env.test.yml > env.yml
    - uses: conda-incubator/setup-miniconda@v2
      with:
        miniconda-version: "latest"
        auto-update-conda: true
        activate-environment: deepchem
        channels: omnia,conda-forge,defaults
        python-version: ${{ matrix.python-version }}
        environment-file: env.yml
    - name: Install dependencies (docs)
      shell: bash -l {0}
      working-directory: ./docs
      run: pip install -r requirements.txt
    - name: Build docs
      shell: bash -l {0}
      working-directory: ./docs
      run: make clean html
    - name: DocTest (Tutorials)
      shell: bash -l {0}
      working-directory: ./docs
      run: make doctest_tutorials
    - name: DocTest (Examples)
      shell: bash -l {0}
      working-directory: ./docs
      run: make doctest_examples
+166 −0
Original line number Diff line number Diff line
name: Test for DeepChem Core
on:
  push: # ci work when pushing master branch
    branches:
      - master
  pull_request: # ci work when creating a PR to master branch
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: [3.7]
    steps:
    - uses: actions/checkout@v2
    - name: Cache pip modules for Linux
      uses: actions/cache@v2
      with:
        path: ~/.cache/pip
        key: ${{ runner.os }}-pip-${{ hashFiles('env.*.yml') }}
        restore-keys: |
          ${{ runner.os }}-pip-
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Build DeepChem
      run: |
        python -m pip install --upgrade pip
        pip install tensorflow'>=2.3,<2.4'
        pip install -e .
    - name: Import checking
      run: python -c "import deepchem"

  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest]
        python-version: [3.7]
        include:
          - os: ubuntu-latest
            python-version: 3.6
    env:
      OS: ${{ matrix.os }}
      PYTHON_VERSION: ${{ matrix.python-version }}
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0
    # https://github.com/galaxyproject/tools-iuc/blob/master/.github/workflows/pr.yaml 
    # The range of commits to check for changes is:
    # - for events on the master branch we compare against the sha before the event
    #   (note that this does not work for feature branch events since we want all
    #   commits on the feature branch and not just the commits of the last event)
    # - for pull requests we compare against the 1st ancestor, given the current
    #   HEAD is the merge between the PR branch and the base branch
    - name: Set commit range (push to the master branch, e.g. merge)
      if: github.ref == 'refs/heads/master' && github.event_name == 'push'
      run: echo "COMMIT_RANGE=${{ github.event.before }}.." >> $GITHUB_ENV
    - name: Set commit range (pull request)
      if: github.event_name == 'pull_request'
      run: |
        git fetch origin master
        echo "COMMIT_RANGE=origin/master..." >> $GITHUB_ENV
    - name: Cache pip packages for Linux
      if: runner.os == 'Linux' 
      uses: actions/cache@v2
      with:
        path: ~/.cache/pip
        key: ${{ runner.os }}-pip-${{ hashFiles('env.*.yml') }}
        restore-keys: |
          ${{ runner.os }}-pip-
    - name: Cache pip packages for MacOS
      if: runner.os == 'macOS'
      uses: actions/cache@v2
      with:
        path: ~/Library/Caches/pip
        key: ${{ matrix.os }}-pip-${{ hashFiles('env.*.yml') }}
        restore-keys: |
          ${{ runner.os }}-pip-
    - name: Cache pip packages for Windows
      if: runner.os == 'Windows'
      uses: actions/cache@v2
      with:
        path: ~\AppData\Local\pip\Cache
        key: ${{ matrix.os }}-pip-${{ hashFiles('env.*.yml') }}
        restore-keys: |
          ${{ runner.os }}-pip-
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install prerequisites for XGBoost and LightGBM (MacOS)
      if: startsWith(runner.os, 'macOS')
      run: brew update && brew install libomp
    - name: Create env.yml
      shell: bash
      run: |
        python -m pip install --upgrade pip;
        pip install conda-merge;
        if [ "$(uname)" == 'Darwin' ]; then
          conda-merge env.common.yml env.cpu.mac.yml env.test.yml > env.yml
        else
          conda-merge env.common.yml env.cpu.yml env.test.yml > env.yml
        fi;
    - name: Install all dependencies
      uses: conda-incubator/setup-miniconda@v2
      with:
        miniconda-version: "latest"
        auto-update-conda: true
        activate-environment: deepchem
        channels: omnia,conda-forge,defaults
        python-version: ${{ matrix.python-version }}
        environment-file: env.yml
    - name: Install DeepChem
      shell: bash -l {0}
      run: pip install -e .
    - name: Yapf (version 0.22.0)
      # on Windows, yapf raise the strange error..., so ignore
      if: runner.os == 'Linux' || runner.os == 'macOS'
      shell: bash -l {0}
      run: |
        CHANGED_FILES=`git diff --name-only $COMMIT_RANGE | grep .py$ | grep -v contrib/`
        yapf -d $CHANGED_FILES
    - name: Flake8
      shell: bash -l {0}
      run: source scripts/flake8_for_ci.sh
    - name: Mypy
      shell: bash -l {0}
      run: mypy -p deepchem
    - name: Doctest
      shell: bash -l {0}
      run: DGLBACKEND=pytorch pytest -v --ignore-glob='deepchem/**/test*.py' --doctest-modules deepchem
    - name: PyTest
      shell: bash -l {0}
      run: pytest -v -m "not slow" --cov=deepchem --cov-report=xml deepchem
    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v1
      with:
        file: ./coverage.xml

  deploy:
    if: ${{ github.ref == 'master' }}
    needs: [build]
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python
      uses: actions/setup-python@v1
      with:
        python-version: '3.7'
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install setuptools wheel twine
    - name: Publish (Nightly)
      env:
        TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
        TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
      run: |
        python setup.py sdist bdist_wheel
        twine upload dist/*
+43 −0
Original line number Diff line number Diff line
name: Release PyPI packages
on:
  push:
    tags:
      - '*' # ci work when pushing a tag
jobs:
  release:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: [3.7]
    steps:
    - uses: actions/checkout@v2
    - name: Cache pip modules for Linux
      uses: actions/cache@v2
      with:
        path: ~/.cache/pip
        key: ${{ runner.os }}-pip-${{ hashFiles('env.*.yml') }}
        restore-keys: |
          ${{ runner.os }}-pip-
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Build DeepChem
      run: |
        python -m pip install --upgrade pip
        pip install tensorflow'>=2.3,<2.4'
        pip install -e .
    - name: Import checking
      run: python -c "import deepchem"
    - name: Prepare for publishing
      run: |
        rm -rf ./build ./dist ./*egg-info
        pip install setuptools wheel twine
    - name: Publish (Stable)
      env:
        TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
        TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
      run: |
        python setup.py sdist bdist_wheel --release
        twine upload dist/*
+1 −0
Original line number Diff line number Diff line
@@ -101,4 +101,5 @@ datasets/pdbbind_v2019_refined.tar.gz
datasets/qm8.csv

.vscode/
env.yml
.python-version
Loading