Update workflow.yml #204
This file contains hidden or 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: pyinfraformat | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| jobs: | |
| pytest: | |
| name: Run tests | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ["3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --no-cache-dir --upgrade pip | |
| python -m pip install --no-cache-dir wheel | |
| python -m pip install --no-cache-dir -r requirements.txt | |
| - name: Show libraries | |
| run: | | |
| python -m pip freeze | |
| - name: Build wheel | |
| run: | | |
| python setup.py bdist_wheel | |
| - name: Install wheel | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| python -m pip install dist/*.whl | |
| - name: Install wheel [Windows] | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| $whl = Get-ChildItem -Path dist -Filter *.whl | Select-Object -First 1 | |
| python -m pip install "$whl" | |
| - name: Install dev dependencies | |
| run: | | |
| python -m pip install --no-cache-dir -r requirements-dev.txt | |
| - name: Run black | |
| run: | | |
| python -m black -l 100 --check pyinfraformat/ | |
| - name: Run pydocstyle | |
| run: | | |
| python -m pydocstyle --add-ignore=D105 --convention=numpy pyinfraformat/ | |
| - name: Run pylint | |
| run: | | |
| python -m pylint pyinfraformat/ | |
| - name: Run tests | |
| run: | | |
| mkdir testing_folder | |
| cd testing_folder | |
| python -m pytest -v --cov=../pyinfraformat --durations=0 ../tests | |
| mv .coverage .. | |
| - name: Upload coverage | |
| if: success() && matrix.os == 'ubuntu-latest' | |
| run: | | |
| bash <(curl -s https://codecov.io/bash) -n "${{ matrix.os }} ${{ matrix.python-version }}" | |
| - uses: actions/upload-artifact@v4 | |
| if: success() && matrix.os == 'ubuntu-latest' | |
| with: | |
| name: pyinfraformat_wheel | |
| path: dist/*.whl | |
| - name: Upload wheel to release | |
| uses: svenstaro/upload-release-action@v2 | |
| if: success() && startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest' | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: dist/*.whl | |
| tag: ${{ github.ref }} | |
| overwrite: true | |
| file_glob: true | |
| - name: Upload to pypi | |
| if: success() && startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest' | |
| env: | |
| TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
| TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
| run: | | |
| python -m pip install --no-cache-dir twine | |
| python -m twine upload -u ${TWINE_USERNAME} -p ${TWINE_PASSWORD} --skip-existing dist/* |