Skip to content

Commit

Permalink
Merge pull request #19 from VCTLabs/auto-docs
Browse files Browse the repository at this point in the history
New docs and automation, more modernization
  • Loading branch information
bakert authored Sep 20, 2022
2 parents c4239ce + 52f72a0 commit 4498b36
Show file tree
Hide file tree
Showing 61 changed files with 1,142 additions and 2,043 deletions.
38 changes: 0 additions & 38 deletions .coveragerc

This file was deleted.

18 changes: 9 additions & 9 deletions .gitchangelog.rc
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,18 @@ subject_process = (strip |
##
## Tags that will be used for the changelog must match this regexp.
##
#tag_filter_regexp = r'^v?[0-9]+\.[0-9]+(\.[0-9]+)?$'
tag_filter_regexp = r'^[0-9]+\.[0-9]+(\.[0-9]+)?$'
tag_filter_regexp = r'^v?[0-9]+\.[0-9]+(\.[0-9]+)?$'
#tag_filter_regexp = r'^[0-9]+\.[0-9]+(\.[0-9]+)?$'


## ``unreleased_version_label`` is a string or a callable that outputs a string
##
## This label will be used as the changelog Title of the last set of changes
## between last valid tag and HEAD if any.
unreleased_version_label = "(unreleased)"
#unreleased_version_label = lambda: swrap(
# ["git", "describe", "--tags"],
#shell=False)
#unreleased_version_label = "(unreleased)"
unreleased_version_label = lambda: swrap(
["git", "describe", "--tags"],
shell=False)


## ``output_engine`` is a callable
Expand Down Expand Up @@ -194,17 +194,17 @@ unreleased_version_label = "(unreleased)"
## Examples:
## - makotemplate("restructuredtext")
##
#output_engine = rest_py
output_engine = rest_py
#output_engine = mustache("restructuredtext")
output_engine = mustache("markdown")
#output_engine = mustache("markdown")
#output_engine = makotemplate("restructuredtext")


## ``include_merge`` is a boolean
##
## This option tells git-log whether to include merge commits in the log.
## The default is to include them.
include_merge = True
include_merge = False


## ``log_encoding`` is a string identifier
Expand Down
17 changes: 1 addition & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: True
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
Expand All @@ -49,18 +49,3 @@ jobs:
tox
env:
PLATFORM: ${{ matrix.os }}

- name: Test with specs and pystache-test
run: |
tox -e setup ext/spec/specs
- name: Check pkg builds
run: |
tox -e deploy,check
- name: Check docs
if: runner.os == 'Linux'
run: |
sudo apt-get -qq update
sudo apt-get install -y pandoc
tox -e docs
4 changes: 2 additions & 2 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-18.04, windows-latest, macos-latest]
platform: [ubuntu-20.04, windows-latest, macos-latest]
python-version: [3.7, 3.9]

runs-on: ${{ matrix.platform }}
Expand Down Expand Up @@ -52,4 +52,4 @@ jobs:
run: conda install -c ${CONDA_PREFIX}/conda-bld/ pystache

- name: Test
run: python test_pystache.py
run: pystache-test
6 changes: 3 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:
tox -e py
- name: Code Coverage Summary Report (data)
uses: irongut/CodeCoverageSummary@v1.1.0
uses: irongut/CodeCoverageSummary@v1.2.0
with:
filename: coverage.xml
output: 'both'
Expand All @@ -176,7 +176,7 @@ jobs:
echo "Current coverage is: ${COVERAGE}%"
- name: Code Coverage Summary Report
uses: irongut/CodeCoverageSummary@v1.1.0
uses: irongut/CodeCoverageSummary@v1.2.0
if: ${{ github.event_name == 'pull_request' }}
with:
filename: coverage.xml
Expand Down Expand Up @@ -274,7 +274,7 @@ jobs:
- name: Comment PR with test coverage delta
uses: marocchino/sticky-pull-request-comment@v2.2.0
if: env.HAVE_BASE_COVERAGE == 'true'
if: env.HAVE_BASE_COVERAGE == 'true' && github.actor == github.repository_owner
with:
header: delta
recreate: true
Expand Down
115 changes: 115 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Pylint

on:
workflow_dispatch:
pull_request:
push:
branches: [ master ]

jobs:
pylint:

runs-on: ubuntu-20.04
defaults:
run:
shell: bash
outputs:
branch: ${{ steps.extract_branch.outputs.branch }}
rating: ${{ steps.analyze.outputs.rating }}
path: ${{ steps.analyze.outputs.path }}

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Extract base branch name
id: extract_branch
shell: bash
run: |
TMP_PULL_BASE_REF="${{ github.base_ref }}"
TMP_GITHUB_REF="${GITHUB_REF#refs/heads/}"
EXPORT_VALUE=""
if [ "${TMP_PULL_BASE_REF}" != "" ]
then
EXPORT_VALUE="${TMP_PULL_BASE_REF}"
else
EXPORT_VALUE="${TMP_GITHUB_REF}"
fi
echo "##[set-output name=branch;]${EXPORT_VALUE}"
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install tox
run: |
python -m pip install --upgrade pip wheel
pip install tox tox-gh-actions
#- name: Run tox
#run: |
#bash -c 'tox -e lint'

- name: Run pylint
id: analyze
env:
BADGE_PATH: badges/pylint-score.svg
run: |
rating=$(bash -c 'tox -e lint' | grep 'Your code has been rated at' | cut -f7 -d " ")
echo "Pylint score: ${rating}"
echo "##[set-output name=rating;]${rating}"
echo "##[set-output name=path;]${BADGE_PATH}"
badge:
# Only generate and publish if these conditions are met:
# - The previous job/analyze step ended successfully
# - At least one of these is true:
# - This is a push event and the push event is on branch 'master' or 'develop'
# Note: if this repo is personal (ie, not an org repo) then you can
# use the following to change the scope of the next 2 jobs
# instead of running on branch push as shown below:
# - This is a pull request event and the pull actor is the same as the repo owner
# if: ${{ ( github.event_name == 'pull_request' && github.actor == github.repository_owner ) || github.ref == 'refs/heads/master' }}
name: Generate badge image with pylint score
runs-on: ubuntu-20.04
needs: [pylint]
if: ${{ github.event_name == 'push' }}

steps:
- uses: actions/checkout@v2
with:
ref: badges
path: badges

# Use the output from the `analyze` step
- name: Create pylint badge
uses: emibcn/badge-action@v1
id: badge
with:
label: 'Pylint score'
status: ${{ needs.pylint.outputs.rating }}
color: 'green'
path: ${{ needs.pylint.outputs.path }}

- name: Commit badge
env:
BRANCH: ${{ needs.pylint.outputs.branch }}
FILE: 'pylint-score.svg'
working-directory: ./badges
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
mkdir -p "${BRANCH}"
mv "${FILE}" "${BRANCH}"
git add "${BRANCH}/${FILE}"
# Will give error if badge has not changed
git commit -m "Add/Update badge" || true
- name: Push badge commit
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: badges
directory: badges
35 changes: 28 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- '*'

jobs:
wheels:
packaging:

runs-on: ${{ matrix.os }}
defaults:
Expand Down Expand Up @@ -49,13 +49,13 @@ jobs:
if: matrix.python-version == 3.7 && runner.os == 'Linux'
uses: actions/upload-artifact@v2
with:
name: wheels
path: ./dist/*.whl
name: packages
path: ./dist/pystache-*

create_release:
name: Create Release
needs: [wheels]
runs-on: ubuntu-18.04
needs: [packaging]
runs-on: ubuntu-20.04

steps:
- name: Get version
Expand Down Expand Up @@ -83,9 +83,30 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
name: Release v${{ env.VERSION }}
name: Release ${{ env.VERSION }}
body_path: CHANGES.md
draft: false
prerelease: false
files: |
wheels/pystache*.whl
packages/pystache-*
# When a GitHub release is made, upload the artifacts to PyPI
upload:
name: Upload to PyPI
runs-on: ubuntu-20.04
needs: [packaging]

steps:
- uses: actions/setup-python@v2

- uses: actions/download-artifact@v2

- name: check artifacts
run: find . -maxdepth 2 -name pystache-\* -type f

# - name: Publish bdist and sdist packages
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# password: ${{ secrets.PYPI_API_TOKEN }}
# packages_dir: packages/
# print_hash: true
48 changes: 48 additions & 0 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Docs
on:
workflow_dispatch:
pull_request:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Add python requirements
run: |
python -m pip install --upgrade pip
pip install tox
- name: Build docs
run: |
#tox -e docs-lint
tox -e docs
- uses: actions/upload-artifact@v2
with:
name: ApiDocsHTML
path: "docs/_build/html/"

- name: set nojekyll for github
run: |
sudo touch docs/_build/html/.nojekyll
- name: Deploy docs to gh-pages
if: ${{ github.event_name == 'push' }}
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: docs/_build/html/
SINGLE_COMMIT: true
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
# TextMate project file
*.tmproj
# Distribution-related folders and files.
pystache/_version.py
pystache.egg-info
docs/_build
docs/source/api
build
dist
MANIFEST
pystache.egg-info
coverage.xml
.coverage
Loading

0 comments on commit 4498b36

Please sign in to comment.