ci: Rename main workflow to ci. #4
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] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- 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 --upgrade pip | |
pip install flake8 pytest yapf | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: lint with flake8 | |
run: flake8 . --exit-zero | |
- name: formatting with yapf | |
continue-on-error: true | |
run: yapf -r -d . | |
- name: test with pytest | |
run: pytest | |
- name: collect code coverage | |
run: | | |
coverage run -m pytest | |
coverage report | |
package: | |
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- 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 setuptools wheel twine | |
- name: build and publish package | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
python setup.py sdist bdist_wheel | |
twine upload dist/* | |
install: | |
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') | |
needs: package | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: set up python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: install package | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest | |
pip install --pre ddsmt | |
- name: test package | |
run: | | |
pytest --pyargs ddsmt |