diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..f0a04ba --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,64 @@ +name: CI + +on: + push: + branches: + - main + tags: + - '*' + pull_request: + +jobs: + tests: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ["3.8", "3.9", "3.10", "3.11", "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 nox + run: | + python -m pip install --upgrade pip + pip install nox + + - name: Lint and typing + run: | + nox -rs lint typing + + - name: Tests + run: | + nox -rs tests -- -v + + build_publish: + runs-on: ubuntu-latest + needs: tests + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: 3.12 + + - name: Install tools + run: | + python -m pip install --upgrade pip + pip install twine wheel setuptools + + - name: Build + run: | + python setup.py sdist bdist_wheel + + - name: Publish + run: | + export TWINE_USERNAME=${{ secrets.TWINE_USERNAME }} + export TWINE_PASSWORD=${{ secrets.TWINE_PASSWORD }} + twine upload dist/*