Making the python installer work in a Windows environment. (#158) #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
# In addition it will tag a release if setup.py is updated with a new version | |
# and publish a release to pypi from the tag | |
name: Python package | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.6, 3.7, 3.8, 3.9, 2.7] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python setup.py install | |
python -m pip install -r test-requirements.txt | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
# Code style checks disabled until the style of the project is set. | |
./run_tests.sh lint | |
- name: Test with pytest | |
run: | | |
./run_tests.sh test | |
tag-release-if-needed: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.tag.outputs.version }} | |
steps: | |
- uses: actions/checkout@v2 | |
- id: tag | |
name: Tag release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
git remote add tag_target "https://[email protected]/MycroftAI/adapt.git" | |
VERSION=$(python setup.py --version) | |
git tag -f release/v$VERSION || exit 0 | |
if git push tag_target --tags; then | |
echo "New tag published on github, push to PyPI as well." | |
pip install twine wheel | |
python setup.py sdist bdist_wheel | |
twine check dist/* | |
twine upload dist/* | |
echo "Package pushed to PyPI. Prepare for mycroft-core PR." | |
echo "::set-output name=version::$VERSION" | |
fi | |
update-mycroft-core: | |
runs-on: ubuntu-latest | |
needs: tag-release-if-needed | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
repository: MycroftAI/mycroft-core | |
- name: Update mycroft-core | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
VERSION=${{needs.tag-release-if-needed.outputs.version}} | |
if [[ $VERSION != *"."* ]]; then | |
echo "Not a valid version number." | |
exit 1 | |
elif [[ $VERSION == *"-"* ]]; then | |
echo "Pre-release suffix detected. Not pushing to mycroft-core." | |
else | |
sed -E "s/adapt-parser==[0-9]+\.[0-9]+\.[0-9]+/adapt-parser==$VERSION/" requirements/requirements.txt > tmp-requirements.txt | |
mv tmp-requirements.txt requirements/requirements.txt | |
echo "ADAPT_VERSION=$VERSION" >> $GITHUB_ENV | |
fi | |
- name: Create Pull Request | |
if: ${{ env.ADAPT_VERSION }} | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
token: ${{ secrets.BOT_TOKEN }} | |
push-to-fork: mycroft-adapt-bot/mycroft-core | |
commit-message: Update Adapt to v${{ env.ADAPT_VERSION }} | |
branch: feature/update-adapt | |
delete-branch: true | |
title: Update Adapt to v${{ env.ADAPT_VERSION }} | |
body: Automated update from mycroftai/adapt. |