Skip to content

remove code-analysis #55

remove code-analysis

remove code-analysis #55

Workflow file for this run

name: Python pytest
# do not change name
on:
push:
branches:
- master
- dev
pull_request:
branches:
- master
- dev
release:
types: [edited, created]
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ['3.7','3.8','3.9']
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r requirements_dev.txt
pip install -e .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: test create shinx docs
# create shpinx api autodocs of rlskyjo and move them to docs
# makefile: make html build the the docs/_build/html/
run: |
sphinx-apidoc -o ./docs ./rlskyjo
cp README.md ./docs
cd docs
make html
- name: Generate Report
run: |
coverage run -m --source=./rlskyjo pytest tests
coverage xml
- name: Upload coverage to Codecov for python 3.8
if: ${{ matrix.python == '3.8' }}
uses: codecov/codecov-action@v2
deploy_docs:
if: ${{ success() && github.event_name == 'release' }}
needs: build-linux
runs-on: ubuntu-latest
# only run if pytest successfull
steps:
- name: Checkout current branch
uses: actions/checkout@v2
with:
path: 'branch-dir'
- name: Checkout gh-pages branch
uses: actions/checkout@v2
with:
ref: 'refs/heads/gh-pages'
path: 'gh-pages-dir'
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install dependencies from current branch
run: |
cd branch-dir
pip install -r requirements.txt
pip install -r requirements_dev.txt
pip install -e .
- name: create shinx docs from current branch
# create shpinx api autodocs of opensentiment and move them to docs
# makefile: make html build the the docs/_build/html/
run: |
cd branch-dir
sphinx-apidoc -o ./docs ./rlskyjo
cp README.md ./docs
cd docs
make html
- name: merge /docs/_build/ files into gh-pages branch
run: |
# move all files to gh-pages branch
cp -r branch-dir/docs/_build/html/* gh-pages-dir/
cp -r branch-dir/.gitignore gh-pages-dir/
# configure gh-pages-dir / gh-pages branch
ls -a
cd gh-pages-dir
ls -a
# create nojekyll file
touch .nojekyll
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
# add local files and untrack
git add .
git commit -m "Update documentation" -a || true
# The above command will fail if no changes were present, so we ignore
# that.
- name: Push changes to github repo/gh-pages
uses: ad-m/github-push-action@master
with:
branch: refs/heads/gh-pages
directory: gh-pages-dir/
deploy_pypi:
needs: deploy_docs
runs-on: ubuntu-latest
name: Build and publish Python 🐍 distributions 📦 to PyPI
steps:
- uses: actions/checkout@master
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install pypa/build
run: |
pip install build --user
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN}}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}