Skip to content

Commit 8dfb706

Browse files
author
Kareem Zidane
committed
Deploy with GitHub Actions
1 parent bd89efc commit 8dfb706

File tree

5 files changed

+50
-33
lines changed

5 files changed

+50
-33
lines changed

.github/workflows/main.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on: push
2+
jobs:
3+
deploy:
4+
runs-on: ubuntu-latest
5+
services:
6+
mysql:
7+
image: mysql
8+
env:
9+
MYSQL_DATABASE: test
10+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
11+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
12+
ports:
13+
- 3306:3306
14+
postgres:
15+
image: postgres
16+
env:
17+
POSTGRES_USER: postgres
18+
POSTGRES_PASSWORD: postgres
19+
POSTGRES_DB: test
20+
ports:
21+
- 5432:5432
22+
steps:
23+
- uses: actions/checkout@v2
24+
- uses: actions/setup-python@v2
25+
with:
26+
python-version: '3.6'
27+
- name: Setup databases
28+
run: |
29+
python setup.py install
30+
pip install mysqlclient
31+
pip install psycopg2-binary
32+
touch test.db test1.db
33+
- name: Run tests
34+
run: python tests/sql.py
35+
- name: Install pypa/build
36+
run: |
37+
python -m pip install build --user
38+
- name: Build a binary wheel and a source tarball
39+
run: |
40+
python -m build --sdist --wheel --outdir dist/ .
41+
- name: Deploy to PyPI
42+
if: ${{ github.ref == 'refs/heads/main' }}
43+
uses: pypa/gh-action-pypi-publish@release/v1
44+
with:
45+
user: __token__
46+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.*
2+
!.github
23
!.gitignore
34
!.travis.yml
45
*.db

.travis.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
package_dir={"": "src"},
1717
packages=["cs50"],
1818
url="https://github.com/cs50/python-cs50",
19-
version="6.0.4"
19+
version="6.0.5"
2020
)

tests/sql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def tearDownClass(self):
150150
class MySQLTests(SQLTests):
151151
@classmethod
152152
def setUpClass(self):
153-
self.db = SQL("mysql://root@localhost/test")
153+
self.db = SQL("mysql://root@127.0.0.1/test")
154154

155155
def setUp(self):
156156
self.db.execute("CREATE TABLE IF NOT EXISTS cs50 (id INTEGER NOT NULL AUTO_INCREMENT, val VARCHAR(16), bin BLOB, PRIMARY KEY (id))")
@@ -160,7 +160,7 @@ def setUp(self):
160160
class PostgresTests(SQLTests):
161161
@classmethod
162162
def setUpClass(self):
163-
self.db = SQL("postgresql://postgres@localhost/test")
163+
self.db = SQL("postgresql://postgres:[email protected]/test")
164164

165165
def setUp(self):
166166
self.db.execute("CREATE TABLE IF NOT EXISTS cs50 (id SERIAL PRIMARY KEY, val VARCHAR(16), bin BYTEA)")

0 commit comments

Comments
 (0)