replaced distutils with packaging #78
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
on: push | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql | |
env: | |
MYSQL_DATABASE: test | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
ports: | |
- 3306:3306 | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: test | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.7' | |
check-latest: true | |
- name: Setup databases | |
run: | | |
pip install . | |
pip install mysqlclient psycopg2-binary SQLAlchemy==1.4.46 | |
- name: Run tests | |
run: python tests/sql.py | |
env: | |
MYSQL_HOST: 127.0.0.1 | |
POSTGRESQL_HOST: 127.0.0.1 | |
- name: Install pypa/build | |
run: python -m pip install build --user | |
- name: Build a binary wheel and a source tarball | |
run: python -m build --sdist --wheel --outdir dist/ . | |
- name: Deploy to PyPI | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Get Version | |
id: py_version | |
run: | | |
echo ::set-output name=version::$(python3 setup.py --version) | |
- name: Create Release | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
github.rest.repos.createRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: "v${{ steps.py_version.outputs.version }}", | |
tag_commitish: "${{ github.sha }}" | |
}) |