I have a fairly simple job that looks like this:
jobs:
test:
name: Ubuntu / Py3.11
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:latest
ports:
- 3307:3306
env:
MARIADB_ROOT_HOST: 127.0.0.1
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: mydatabase
MYSQL_USER: root
MYSQL_PASSWORD: mydatabasepass
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install the project dependencies
run: poetry install
- name: Create dummy user
run: poetry run python ./scripts/testdb.py
- name: Run tests
run: poetry run pytest -vv
# ./scripts/testdb.py
import pymysql
connection = pymysql.connect(
host="127.0.0.1",
port=3307,
user="root",
password="mydatabasepass",
database="mydatabase",
)
This however, raises pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1' ([Errno 111] Connection refused)"). I'm unsure as to what's wrong here.
@fading path I made a repo over at https://github.com/Ravencentric/mariadbtest/actions for demonstration and it seems to succeed. The exact same thing fails in gitea