Skip to content

Commit

Permalink
Try MySQL Service
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulhuq811 committed Feb 21, 2024
1 parent 019cb75 commit bca4d7b
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 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,11 +59,11 @@ 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
mysql --host 127.0.0.1 --port 3306 -uroot -proot -e "GRANT ALL ON *.* TO 'root'@'localhost'; FLUSH PRIVILEGES;"
# - 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
# mysql --host 127.0.0.1 --port 3306 -uroot -proot -e "GRANT ALL ON *.* TO 'root'@'localhost'; FLUSH PRIVILEGES;"
- name: Install package
run: |
poetry config virtualenvs.create false && poetry install -E mysql
Expand All @@ -58,7 +72,7 @@ jobs:
- name: Run Test and generate coverate 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 bca4d7b

Please sign in to comment.