diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..0eb0e2c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,46 @@ +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@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.6' + - name: Setup databases + run: | + python setup.py install + pip install mysqlclient + pip install psycopg2-binary + touch test.db test1.db + - name: Run tests + run: python tests/sql.py + - 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 }} diff --git a/.gitignore b/.gitignore index 65f1e1f..0a2a684 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .* +!.github !.gitignore !.travis.yml *.db diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0433f6a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: python -python: '3.6' -branches: - except: "/^v\\d/" -services: - - mysql - - postgresql -install: - - python setup.py install - - pip install mysqlclient - - pip install psycopg2-binary -before_script: - - mysql -e 'CREATE DATABASE IF NOT EXISTS test;' - - psql -c 'create database test;' -U postgres - - touch test.db test1.db -script: python tests/sql.py -deploy: - - provider: script - script: 'curl --fail --data "{ \"tag_name\": \"v$(python setup.py --version)\", - \"target_commitish\": \"$TRAVIS_COMMIT\", \"name\": \"v$(python setup.py --version)\" - }" --user bot50:$GITHUB_TOKEN https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases' - on: - branch: main - - provider: pypi - user: "$PYPI_USERNAME" - password: "$PYPI_PASSWORD" - on: main -notifications: - slack: - secure: lJklhcBVjDT6KzUNa3RFHXdXSeH7ytuuGrkZ5ZcR72CXMoTf2pMJTzPwRLWOp6lCSdDC9Y8MWLrcg/e33dJga4Jlp9alOmWqeqesaFjfee4st8vAsgNbv8/RajPH1gD2bnkt8oIwUzdHItdb5AucKFYjbH2g0d8ndoqYqUeBLrnsT1AP5G/Vi9OHC9OWNpR0FKaZIJE0Wt52vkPMH3sV2mFeIskByPB+56U5y547mualKxn61IVR/dhYBEtZQJuSvnwKHPOn9Pkk7cCa+SSSeTJ4w5LboY8T17otaYNauXo46i1bKIoGiBcCcrJyQHHiPQmcq/YU540MC5Wzt9YXUycmJzRi347oyQeDee27wV3XJlWMXuuhbtJiKCFny7BTQ160VATlj/dbwIzN99Ra6/BtTumv/6LyTdKIuVjdAkcN8dtdDW1nlrQ29zuPNCcXXzJ7zX7kQaOCUV1c2OrsbiH/0fE9nknUORn97txqhlYVi0QMS7764wFo6kg0vpmFQRkkQySsJl+TmgcZ01AlsJc2EMMWVuaj9Af9JU4/4yalqDiXIh1fOYYUZnLfOfWS+MsnI+/oLfqJFyMbrsQQTIjs+kTzbiEdhd2R4EZgusU/xRFWokS2NAvahexrRhRQ6tpAI+LezPrkNOR3aHiykBf+P9BkUa0wPp6V2Ayc6q0= diff --git a/setup.py b/setup.py index 550e65d..c96cf23 100644 --- a/setup.py +++ b/setup.py @@ -16,5 +16,5 @@ package_dir={"": "src"}, packages=["cs50"], url="https://github.com/cs50/python-cs50", - version="6.0.4" + version="6.0.5" ) diff --git a/tests/sql.py b/tests/sql.py index e4757c7..89853a7 100644 --- a/tests/sql.py +++ b/tests/sql.py @@ -150,7 +150,7 @@ def tearDownClass(self): class MySQLTests(SQLTests): @classmethod def setUpClass(self): - self.db = SQL("mysql://root@localhost/test") + self.db = SQL("mysql://root@127.0.0.1/test") def setUp(self): 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): class PostgresTests(SQLTests): @classmethod def setUpClass(self): - self.db = SQL("postgresql://postgres@localhost/test") + self.db = SQL("postgresql://postgres:postgres@127.0.0.1/test") def setUp(self): self.db.execute("CREATE TABLE IF NOT EXISTS cs50 (id SERIAL PRIMARY KEY, val VARCHAR(16), bin BYTEA)")