Update github actions #59
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 upload a Python Package using Twine when a release is created | |
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
name: Test & Publish | |
on: | |
push: | |
paths-ignore: | |
- '**/README.md' | |
- 'doc/*' | |
pull_request: | |
paths-ignore: | |
- '**/README.md' | |
- 'doc/*' | |
jobs: | |
test-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install mne flake8 pytest twine pymatreader | |
pip install -r requirements.txt | |
pip install -e . | |
mne sys_info -d | |
shell: bash -el {0} | |
- name: Lint | |
run: | | |
flake8 . | |
- name: Test | |
run: | | |
pytest | |
- name: Build Package | |
run: | | |
pip install setuptools wheel twine | |
python setup.py sdist bdist_wheel | |
shell: bash -el {0} | |
- name: Test sdist | |
run: | | |
twine check dist/* | |
ls dist/*.tar.gz | wc -l | grep "^1$" | |
pip install dist/*.tar.gz | |
shell: bash -el {0} | |
- name: Publish to Test PyPI | |
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
run: | | |
twine upload --repository testpypi dist/* | |
- name: Publish to PyPI (release) | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
twine upload dist/* |