add to __init__.py #426
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
name: CI | |
on: | |
push: | |
pull_request: | |
release: | |
types: [created] | |
jobs: | |
lint: | |
if: github.ref == 'refs/heads/master' | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Lint with pylint | |
run: | | |
pylint --exit-zero py3gpp/*.py | tee pylint.txt | |
score=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' pylint.txt) | |
echo "Pylint score was $score" | |
mkdir badge | |
anybadge --value=$score --file=badge/pylint.svg pylint | |
- name: upload pylint badge | |
uses: actions/configure-pages@v1 | |
continue-on-error: true | |
- name: Deploy to GitHub Pages | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: 'badge' | |
continue-on-error: true | |
- id: deployment | |
uses: actions/deploy-pages@master | |
continue-on-error: true | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install build | |
python3 -m build | |
pip install -e . | |
- name: Test with pytest | |
run: | | |
pytest --ignore=tests/matlab tests/ -n auto | |
pypi: | |
if: github.event_name == 'release' && github.event.action == 'created' | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build twine | |
- name: build package | |
run: | | |
python3 -m build | |
- name: upload package to pypi | |
run: | | |
cat >> ~/.pypirc << EOF | |
[pypi] | |
username = __token__ | |
password = ${{ secrets.PYPI }} | |
EOF | |
cat ~/.pypirc | |
twine upload --skip-existing dist/* |