-
Notifications
You must be signed in to change notification settings - Fork 259
68 lines (62 loc) · 1.84 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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
- 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 }}"
})