Skip to content

Commit

Permalink
Merge branch 'release/v0.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mdbenito committed Sep 2, 2023
2 parents 0e929ae + 058c892 commit 8739d18
Show file tree
Hide file tree
Showing 150 changed files with 10,890 additions and 7,446 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.6.1
current_version = 0.7.0
commit = False
tag = False
allow_dirty = False
Expand Down
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
Thanks for making a contribution!
Please make sure you have read the contributing guide:
https://github.com/appliedAI-Initiative/pyDVL/blob/develop/CONTRIBUTING.md
https://github.com/aai-institute/pyDVL/blob/develop/CONTRIBUTING.md
-->

### Description
Expand All @@ -17,4 +17,4 @@ This PR closes #XXX
- [ ] Wrote Unit tests (if necessary)
- [ ] Updated Documentation (if necessary)
- [ ] Updated Changelog
- [ ] If notebooks were added/changed, added boilerplate cells are tagged with `"nbsphinx":"hidden"`
- [ ] If notebooks were added/changed, added boilerplate cells are tagged with `"tags": ["hide"]` or `"tags": ["hide-input"]`
43 changes: 43 additions & 0 deletions .github/actions/deploy-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy Docs
description: Deploy documentation from develop or master branch
inputs:
version:
description: Version number to use
required: true
alias:
description: Alias to use (latest or stable)
required: true
title:
description: Alternative title to use
required: false
default: ''
email:
description: Email to use for git config
required: true
username:
description: Username to use for git config
required: true
set-default:
description: Set alias as the default version
required: false
default: 'false'
runs:
using: "composite"
steps:
- run: |
# https://github.com/jimporter/mike#deploying-via-ci
git fetch origin gh-pages --depth=1
git config --local user.email ${{ inputs.email }}
git config --local user.name ${{ inputs.username }}
shell: bash
- run: |
if [ -z "${{ inputs.title }}" ]
then
mike deploy ${{ inputs.version }} ${{ inputs.alias }} --push --update-aliases
else
mike deploy ${{ inputs.version }} ${{ inputs.alias }} --title=${{ inputs.title }} --push --update-aliases
fi
shell: bash
- if: ${{ inputs.set-default == 'true' }}
run: mike set-default ${{ inputs.alias }}
shell: bash
20 changes: 20 additions & 0 deletions .github/actions/python/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Setup Python
description: Setup Python on GitHub Actions and install dev and docs requirements.
inputs:
python_version:
description: Python version to use
required: true
runs:
using: "composite"
steps:
- name: Set up Python ${{ inputs.python_version }}
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python_version }}
cache: 'pip'
cache-dependency-path: |
requirements-dev.txt
requirements-docs.txt
- name: Install Dev & Docs Requirements
run: pip install -r requirements-dev.txt -r requirements-docs.txt
shell: bash
54 changes: 35 additions & 19 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: Publish Python Package to PyPI

on:
push:
tags:
- "v*"
release:
types:
- published
workflow_dispatch:
inputs:
reason:
description: Why did you trigger the pipeline?
required: False
default: Check if it runs again due to external changes
tag:
description: Tag for which a package should be published
tag_name:
description: The name of the tag for which a package should be published
type: string
required: false

Expand All @@ -27,22 +27,24 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fail if manually triggered workflow does not have 'tag' input
if: github.event_name == 'workflow_dispatch' && inputs.tag == ''
- name: Fail if manually triggered workflow does not have 'tag_name' input
if: github.event_name == 'workflow_dispatch' && inputs.tag_name == ''
run: |
echo "Input 'tag' should not be empty"
echo "Input 'tag_name' should not be empty"
exit -1
- name: Extract branch name from input
id: get_branch_name_input
if: github.event_name == 'workflow_dispatch'
run: |
export BRANCH_NAME=$(git log -1 --format='%D' ${{ inputs.tag }} | sed -e 's/.*origin\/\(.*\).*/\1/')
export BRANCH_NAME=$(git log -1 --format='%D' ${{ inputs.tag_name }} | sed -e 's/.*origin\/\(.*\).*/\1/')
echo "$BRANCH_NAME"
echo "branch_name=${BRANCH_NAME}" >> $GITHUB_OUTPUT
- name: Extract branch name from tag
id: get_branch_name_tag
if: github.ref_type == 'tag'
if: github.release.tag_name != ''
run: |
export BRANCH_NAME=$(git log -1 --format='%D' $GITHUB_REF | sed -e 's/.*origin\/\(.*\).*/\1/')
export BRANCH_NAME=$(git log -1 --format='%D' ${{ github.release.tag_name }} | sed -e 's/.*origin\/\(.*\).*/\1/')
echo "$BRANCH_NAME"
echo "branch_name=${BRANCH_NAME}" >> $GITHUB_OUTPUT
shell: bash
- name: Fail if tag is not on 'master' branch
Expand All @@ -52,19 +54,33 @@ jobs:
echo "Should be on Master branch instead"
exit -1
- name: Fail if running locally
if: ${{ !github.event.act }} # skip during local actions testing
if: ${{ env.ACT }} # skip during local actions testing
run: |
echo "Running action locally. Failing"
exit -1
- name: Set up Python 3.8
uses: actions/setup-python@v4
- name: Setup Python 3.8
uses: ./.github/actions/python
with:
python-version: 3.8
cache: 'pip'
- name: Install Dev Requirements
run: pip install -r requirements-dev.txt
python_version: 3.8
- name: Get Current Version
run: |
export CURRENT_VERSION=$(python setup.py --version --quiet | awk -F. '{print $1"."$2"."$3}')
# Make the version available as env variable for next steps
echo CURRENT_VERSION=$CURRENT_VERSION >> $GITHUB_ENV
shell: bash
- name: Deploy Docs
uses: ./.github/actions/deploy-docs
with:
version: ${{ env.CURRENT_VERSION }}
alias: latest
title: Latest
email: ${{ env.GITHUB_BOT_EMAIL }}
username: ${{ env.GITHUB_BOT_USERNAME }}
set-default: 'true'
- name: Build and publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: tox -e publish-release-package
run: |
python setup.py sdist bdist_wheel
twine upload --verbose --non-interactive dist/*
9 changes: 3 additions & 6 deletions .github/workflows/run-tests-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ inputs.python_version }}
uses: actions/setup-python@v4
- name: Setup Python ${{ inputs.python_version }}
uses: ./.github/actions/python
with:
python-version: ${{ inputs.python_version }}
cache: 'pip'
- name: Install Dev Requirements
run: pip install -r requirements-dev.txt
python_version: ${{ inputs.python_version }}
- name: Cache Tox Directory for Tests
uses: actions/cache@v3
with:
Expand Down
100 changes: 40 additions & 60 deletions .github/workflows/tox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,60 +16,49 @@ env:
GITHUB_BOT_USERNAME: github-actions[bot]
GITHUB_BOT_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
PY_COLORS: 1
MYPY_FORCE_COLOR: 1
PANDOC_VERSION: '3.1.6.2'

jobs:
lint:
code-quality:
name: Lint code and check type hints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v4
- name: Setup Python 3.8
uses: ./.github/actions/python
with:
python-version: 3.8
cache: 'pip'
- name: Install Dev Requirements
run: pip install -r requirements-dev.txt
- name: Cache Tox Directory for Linting
uses: actions/cache@v3
python_version: 3.8
- uses: actions/cache@v3
with:
key: tox-${{ github.ref }}-${{ runner.os }}-${{ hashFiles('tox.ini') }}
path: .tox
path: ~/.cache/pre-commit
key: pre-commit-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Lint Code
run: tox -e linting
run: |
pre-commit run --all --show-diff-on-failure
python build_scripts/run_pylint.py | (pylint-json2html -f jsonextended -o pylint.html)
shell: bash
- name: Check Type Hints
run: tox -e type-checking
run: mypy src/
docs:
name: Build Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v4
- name: Setup Python 3.8
uses: ./.github/actions/python
with:
python-version: 3.8
cache: 'pip'
- name: Install Dev Requirements
run: pip install -r requirements-dev.txt
python_version: 3.8
- name: Install Pandoc
run: sudo apt-get install --no-install-recommends --yes pandoc
- name: Cache Tox Directory for Docs
uses: actions/cache@v3
uses: r-lib/actions/setup-pandoc@v2
with:
key: tox-${{ github.ref }}-${{ runner.os }}-${{ hashFiles('tox.ini') }}
path: .tox
pandoc-version: ${{ env.PANDOC_VERSION }}
- name: Build Docs
run: tox -e docs
- name: Save built docs
uses: actions/upload-artifact@v3
with:
name: docs
path: ./docs/_build
retention-days: 1
run: mkdocs build
base-tests:
strategy:
matrix:
Expand All @@ -79,7 +68,7 @@ jobs:
with:
tests_to_run: base
python_version: ${{ matrix.python_version }}
needs: [lint]
needs: [code-quality]
torch-tests:
strategy:
matrix:
Expand All @@ -89,7 +78,7 @@ jobs:
with:
tests_to_run: torch
python_version: ${{ matrix.python_version }}
needs: [lint]
needs: [code-quality]
notebook-tests:
strategy:
matrix:
Expand All @@ -99,50 +88,41 @@ jobs:
with:
tests_to_run: notebooks
python_version: ${{ matrix.python_version }}
needs: [lint]
needs: [code-quality]
push-docs-and-release-testpypi:
name: Push Docs and maybe release Package to TestPyPI
runs-on: ubuntu-latest
needs: [docs, base-tests, torch-tests, notebook-tests]
if: ${{ github.ref == 'refs/heads/develop' }}
concurrency:
group: push-docs-and-release-testpypi
group: publish
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: 'pip'
- name: Install Dev Requirements
run: pip install -r requirements-dev.txt
- name: Cache Tox Directory
uses: actions/cache@v3
- name: Setup Python 3.8
uses: ./.github/actions/python
with:
key: tox-${{ github.ref }}-${{ runner.os }}-${{ hashFiles('tox.ini') }}
path: .tox
- name: Download built docs
uses: actions/download-artifact@v3
python_version: 3.8
- name: Install Pandoc
uses: r-lib/actions/setup-pandoc@v2
with:
name: docs
path: ./docs/_build
pandoc-version: ${{ env.PANDOC_VERSION }}
- name: Deploy Docs
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/develop' }}
uses: ./.github/actions/deploy-docs
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
user_name: ${{ env.GITHUB_BOT_USERNAME }}
user_email: ${{ env.GITHUB_BOT_EMAIL }}
version: devel
alias: develop
title: Development
email: ${{ env.GITHUB_BOT_EMAIL }}
username: ${{ env.GITHUB_BOT_USERNAME }}
- name: Build and publish to TestPyPI
if: ${{ github.ref == 'refs/heads/develop' }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
set -x
export CURRENT_VERSION=$(python setup.py --version)
export BUILD_NUMBER=$GITHUB_RUN_NUMBER
tox -e bump-dev-version
tox -e publish-test-package
bump2version --no-tag --no-commit --verbose --serialize '\{major\}.\{minor\}.\{patch\}.\{release\}\{$BUILD_NUMBER\}' boguspart
python setup.py sdist bdist_wheel
twine upload -r testpypi --verbose --non-interactive dist/*
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,6 @@ pylint.html
# Saved data
runs/
data/models/

# Docs
docs_build
Loading

0 comments on commit 8739d18

Please sign in to comment.