Skip to content

Commit

Permalink
Use MySQL Service instead of Default
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulhuq811 committed Feb 21, 2024
1 parent fb43b15 commit c18ca92
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/python-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ jobs:
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
# Setup MySQL service
mysql:
image: mysql:8.3.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
# Set health checks to wait until mysql has started
options:
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 3306 on service container to the host
- 3306:3306
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
Expand All @@ -45,19 +59,15 @@ jobs:
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Start MySQL service
# MySQL needs to be started manually (https://github.blog/changelog/2020-02-21-github-actions-breaking-change-ubuntu-virtual-environments-will-no-longer-start-the-mysql-service-automatically/)
run: |
sudo /etc/init.d/mysql start
- name: Install package
run: |
poetry config virtualenvs.create false && poetry install -E mysql
env:
PIP_DEFAULT_TIMEOUT: "60"
- name: Run Test and generate coverate report
- name: Run Test and generate coverage report
run: poetry run pytest --cov=./ --cov-report=xml
env:
TEST_MYSQL_URL: mysql+pymysql://root:root@localhost:3306/mysql
TEST_MYSQL_URL: mysql+pymysql://root@localhost:3306/mysql
- name: Upload Coverage to CodeCov
uses: codecov/codecov-action@v4
with:
Expand Down

0 comments on commit c18ca92

Please sign in to comment.