Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automations #16

Merged
merged 10 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
name: Run Build Tests
on:
push:
branches:
- master
pull_request:
branches:
- dev
workflow_dispatch:

jobs:
build_tests:
strategy:
max-parallel: 2
matrix:
python-version: [ 3.7, 3.8, 3.9, "3.10" ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
JarbasAl marked this conversation as resolved.
Show resolved Hide resolved
with:
ref: ${{ github.head_ref }}
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: ${{ matrix.python-version }}
- name: Install Build Tools
run: |
python -m pip install build wheel
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt install python3-dev swig libssl-dev libfann-dev portaudio19-dev libpulse-dev
sudo apt install python3-dev swig libssl-dev
- name: Build Source Packages
run: |
python setup.py sdist
- name: Build Distribution Packages
run: |
python setup.py bdist_wheel
- name: Install tflite_runtime workaround tflit bug
run: |
pip3 install numpy
pip3 install --extra-index-url https://google-coral.github.io/py-repo/ tflite_runtime
- name: Install core repo
- name: Install skill
run: |
pip install .[audio-backend,mark1,stt,tts,skills_minimal,skills,gui,bus,all]
pip install .
- uses: pypa/[email protected]
builderjer marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 10 additions & 0 deletions .github/workflows/conventional-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# auto add labels to PRs
on:
pull_request_target:
types: [ opened, edited ]
name: conventional-release-labels
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: bcoe/conventional-release-labels@v1
20 changes: 20 additions & 0 deletions .github/workflows/dev2master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This workflow will generate a distribution and upload it to PyPI

name: Push dev -> master
on:
workflow_dispatch:

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
ref: dev
builderjer marked this conversation as resolved.
Show resolved Hide resolved
- name: Push dev -> master
uses: ad-m/github-push-action@master

with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master
26 changes: 15 additions & 11 deletions .github/workflows/license_tests.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
name: Run License Tests
on:
push:
branches:
- master
pull_request:
branches:
- dev
workflow_dispatch:

jobs:
license_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Setup Python
uses: actions/setup-python@v1
with:
Expand All @@ -24,12 +27,13 @@ jobs:
- name: Install core repo
run: |
pip install .
- name: Install licheck
run: |
pip install git+https://github.com/NeonJarbas/lichecker
- name: Install test dependencies
run: |
pip install pytest pytest-timeout pytest-cov
- name: Test Licenses
run: |
pytest test/license_tests.py
- name: Check python
id: license_check_report
uses: pilosus/[email protected]
with:
fail: 'Copyleft,Other,Error'
fails-only: true
exclude-license: '^(Mozilla).*$'
- name: Print report
if: ${{ always() }}
run: echo "${{ steps.license_check_report.outputs.report }}"
137 changes: 137 additions & 0 deletions .github/workflows/publish_alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# This workflow will generate an ALPHA release distribution and upload it to PyPI
name: Publish Alpha Build
on:
pull_request:
types: [closed]
branches:
- dev
paths-ignore:
- 'version.py'
- 'test/**'
- 'examples/**'
- '.github/**'
- '.gitignore'
- 'LICENSE'
- 'CHANGELOG.md'
- 'MANIFEST.in'
- 'README.md'
- 'scripts/**'

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
JarbasAl marked this conversation as resolved.
Show resolved Hide resolved
with:
ref: dev
fetch-depth: 0 # Avoid errors when pushing refs to the destination repository

- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Install Build Tools
run: |
python -m pip install build wheel

- name: Debug GitHub Labels
run: |
echo "Labels in Pull Request:"
echo "${{ toJson(github.event.pull_request.labels) }}"

# Convert the labels array into text using jq
LABELS=$(echo '${{ toJson(github.event.pull_request.labels) }}' | jq -r '.[].name')

# Handle the case where there are no labels
if [ -z "$LABELS" ]; then
echo "No labels found on the pull request."
else
echo "Labels: $LABELS"
fi

- name: Determine version bump
id: version_bump
run: |
# Convert the labels array into text using jq
LABELS=$(echo '${{ toJson(github.event.pull_request.labels) }}' | jq -r '.[].name')

# Handle the case where there are no labels
if [ -z "$LABELS" ]; then
echo "No labels found on the pull request."
LABELS=""
fi

echo "Labels: $LABELS"

MAJOR=0
MINOR=0
BUILD=0

# Loop over the labels and determine the version bump
for label in $LABELS; do
echo "Processing label: $label"
if [ "$label" == "breaking" ]; then
MAJOR=1
elif [ "$label" == "feature" ]; then
MINOR=1
elif [ "$label" == "fix" ]; then
BUILD=1
fi
done

# Set the output based on the labels found
if [ $MAJOR -eq 1 ]; then
echo "::set-output name=part::major"
elif [ $MINOR -eq 1 ]; then
echo "::set-output name=part::minor"
elif [ $BUILD -eq 1 ]; then
echo "::set-output name=part::build"
else
echo "::set-output name=part::alpha"
fi

- name: Update version in version.py
run: |
python scripts/update_version.py ${{ steps.version_bump.outputs.part }} --version-file $GITHUB_WORKSPACE/version.py
JarbasAl marked this conversation as resolved.
Show resolved Hide resolved

- name: "Generate release changelog"
uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
maxIssues: 50
id: changelog

- name: Commit to dev
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Increment Version
branch: dev

- name: version
run: echo "::set-output name=version::$(python setup.py --version)"
id: version

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: V${{ steps.version.outputs.version }}
release_name: Release ${{ steps.version.outputs.version }}
body: |
Changes in this Release
${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: true
commitish: dev

- name: Build Distribution Packages
run: |
python setup.py sdist bdist_wheel

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{secrets.PYPI_TOKEN}}
45 changes: 0 additions & 45 deletions .github/workflows/publish_pypi.yml

This file was deleted.

77 changes: 77 additions & 0 deletions .github/workflows/publish_stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# This workflow will generate a STABLE distribution and upload it to PyPI

name: Publish Stable Release
on:
push:
branches:
- master
paths-ignore:
- 'test/**'
- 'examples/**'
- '.github/**'
- '.gitignore'
- 'CHANGELOG.md'
- 'MANIFEST.in'
- 'scripts/**'
workflow_dispatch:

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
builderjer marked this conversation as resolved.
Show resolved Hide resolved
with:
ref: master
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install Build Tools
run: |
python -m pip install build wheel
- name: Remove Alpha tag
run: |
python scripts/remove_alpha.py --version-file $GITHUB_WORKSPACE/version.py
JarbasAl marked this conversation as resolved.
Show resolved Hide resolved
- name: "Generate release changelog"
uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
maxIssues: 50
id: changelog
- name: Commit to master
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Increment Version
branch: master
- name: Rebase dev on master
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git checkout dev
git rebase origin/master
git push origin dev --force-with-lease
- name: version
run: echo "::set-output name=version::$(python setup.py --version)"
JarbasAl marked this conversation as resolved.
Show resolved Hide resolved
id: version
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: V${{ steps.version.outputs.version }}
release_name: Release ${{ steps.version.outputs.version }}
body: |
Changes in this Release
${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: false
commitish: master
- name: Build Distribution Packages
run: |
python setup.py sdist bdist_wheel
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{secrets.PYPI_TOKEN}}
Loading
Loading