1+ # This is a basic workflow to help you get started with Actions
2+
3+ name : Publish Python 🐍 distributions 📦 to PyPI
4+
5+ on :
6+ push :
7+ tags :
8+ - ' **'
9+
10+ jobs :
11+ ciPython37 :
12+ runs-on : ubuntu-latest
13+ strategy :
14+ matrix :
15+ python-version : [ 3.7 ]
16+ services :
17+ postgres :
18+ image : postgres:11
19+ env :
20+ POSTGRES_USER : postgres
21+ POSTGRES_PASSWORD : postgres
22+ POSTGRES_DB : ci_db_test
23+ ports :
24+ - 5432:5432
25+ options : --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
26+ steps :
27+ - uses : actions/checkout@v3
28+ - name : Set up Python ${{ matrix.python-version }}
29+ uses : actions/setup-python@v1
30+ with :
31+ python-version : ${{ matrix.python-version }}
32+ - name : Install dependencies
33+ run : |
34+ python -m pip install --upgrade pip
35+ pip install -r requirements.txt
36+ - name : Enable Postgres Trigram Extension
37+ run : |
38+ PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
39+ - name : Test with unittest
40+ env :
41+ TEST_DATABASE_URL : postgresql://postgres:postgres@localhost/ci_db_test
42+ TEST_DATABASE_ASYNC_URL : postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
43+ run : |
44+ python -m unittest discover -s ./tests/test_implementations
45+ ciPython38 :
46+ runs-on : ubuntu-latest
47+ strategy :
48+ matrix :
49+ python-version : [ 3.8 ]
50+ services :
51+ postgres :
52+ image : postgres:11
53+ env :
54+ POSTGRES_USER : postgres
55+ POSTGRES_PASSWORD : postgres
56+ POSTGRES_DB : ci_db_test
57+ ports :
58+ - 5432:5432
59+ options : --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
60+ steps :
61+ - uses : actions/checkout@v3
62+ - name : Set up Python ${{ matrix.python-version }}
63+ uses : actions/setup-python@v1
64+ with :
65+ python-version : ${{ matrix.python-version }}
66+ - name : Install dependencies
67+ run : |
68+ python -m pip install --upgrade pip
69+ pip install -r requirements.txt
70+ - name : Enable Postgres Trigram Extension
71+ run : |
72+ PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
73+ - name : Test with unittest
74+ env :
75+ TEST_DATABASE_URL : postgresql://postgres:postgres@localhost/ci_db_test
76+ TEST_DATABASE_ASYNC_URL : postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
77+ run : |
78+ python -m unittest discover -s ./tests/test_implementations
79+ ciPython39 :
80+ runs-on : ubuntu-latest
81+ strategy :
82+ matrix :
83+ python-version : [ 3.9 ]
84+ services :
85+ postgres :
86+ image : postgres:11
87+ env :
88+ POSTGRES_USER : postgres
89+ POSTGRES_PASSWORD : postgres
90+ POSTGRES_DB : ci_db_test
91+ ports :
92+ - 5432:5432
93+ options : --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
94+ steps :
95+ - uses : actions/checkout@v3
96+ - name : Set up Python ${{ matrix.python-version }}
97+ uses : actions/setup-python@v1
98+ with :
99+ python-version : ${{ matrix.python-version }}
100+ - name : Install dependencies
101+ run : |
102+ python -m pip install --upgrade pip
103+ pip install -r requirements.txt
104+ - name : Enable Postgres Trigram Extension
105+ run : |
106+ PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
107+ - name : Test with unittest
108+ env :
109+ TEST_DATABASE_URL : postgresql://postgres:postgres@localhost/ci_db_test
110+ TEST_DATABASE_ASYNC_URL : postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
111+ run : |
112+ python -m unittest discover -s ./tests/test_implementations
113+ ciPython310 :
114+ runs-on : ubuntu-latest
115+ strategy :
116+ matrix :
117+ python-version : [ '3.10' ]
118+ services :
119+ postgres :
120+ image : postgres:11
121+ env :
122+ POSTGRES_USER : postgres
123+ POSTGRES_PASSWORD : postgres
124+ POSTGRES_DB : ci_db_test
125+ ports :
126+ - 5432:5432
127+ options : --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
128+ steps :
129+ - uses : actions/checkout@v3
130+ - name : Set up Python ${{ matrix.python-version }}
131+ uses : actions/setup-python@v1
132+ with :
133+ python-version : ${{ matrix.python-version }}
134+ - name : Install dependencies
135+ run : |
136+ python -m pip install --upgrade pip
137+ pip install -r requirements.txt
138+ - name : Enable Postgres Trigram Extension
139+ run : |
140+ PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
141+ - name : Test with unittest
142+ env :
143+ TEST_DATABASE_URL : postgresql://postgres:postgres@localhost/ci_db_test
144+ TEST_DATABASE_ASYNC_URL : postgresql+asyncpg://postgres:postgres@localhost/ci_db_test
145+ run : |
146+ python -m unittest discover -s ./tests/test_implementations
147+ build-n-publish :
148+ needs : [ciPython37, ciPython38, ciPython39,ciPython310]
149+ name : Build and publish Python 🐍 distributions 📦 to PyPI
150+ runs-on : ubuntu-latest
151+ steps :
152+ - uses : actions/checkout@master
153+ - name : Set up Python 3.7
154+ uses : actions/setup-python@v3
155+ with :
156+ python-version : " 3.7"
157+ - name : Set release version env
158+ run : echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
159+ - name : Release version
160+ run : |
161+ echo $RELEASE_VERSION
162+ echo ${{ env.RELEASE_VERSION }}
163+ - name : Install pypa/build
164+ run : >-
165+ python -m
166+ pip install
167+ build
168+ --user
169+ - name : Build a binary wheel and a source tarball
170+ run : >-
171+ python -m
172+ build
173+ --sdist
174+ --wheel
175+ --outdir dist/
176+ .
177+ - name : Publish distribution 📦 to PyPI
178+ if : startsWith(github.ref, 'refs/tags')
179+ uses : pypa/gh-action-pypi-publish@release/v1
180+ with :
181+ user : __token__
182+ password : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments