Refactoring of unit tests helper #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8.3 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: ccdb_test | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' # Choose the Python version as per your requirement | |
- name: Install Python dependencies | |
run: | | |
pip install -r python/requirements.txt | |
ls | |
- name: Set up environment | |
run: | | |
sudo apt-get update | |
sudo apt-get install build-essential cmake mysql-client | |
# Add any other dependencies for C++ here | |
# For example, if you use CMake: | |
# - name: Install CMake | |
# run: sudo apt-get install cmake | |
- name: Create MySQL Database | |
run: | | |
mysql -h 127.0.0.1 -u root --password=root -e 'CREATE USER `ccdb_user`@`%`;' | |
mysql -h 127.0.0.1 -u root --password=root -e 'CREATE SCHEMA IF NOT EXISTS `ccdb_test`;' | |
mysql -h 127.0.0.1 -u root --password=root -e 'GRANT ALL PRIVILEGES ON ccdb_test.* TO `ccdb_user`@`%`;' | |
mysql -h 127.0.0.1 -u root --password=root ccdb_test < sql/ccdb.mysql.sql | |
- name: Run tests | |
env: | |
MYSQL_HOST: 127.0.0.1 | |
MYSQL_USER: root | |
MYSQL_PASSWORD: root | |
MYSQL_DB: testdb | |
CCDB_TEST_MYSQL_CONNECTION: mysql://ccdb_user@localhost/ccdb_test | |
CCDB_TEST_SQLITE_CONNECTION: sqlite:///sql/ccdb.sqlite | |
run: | | |
# Command to run your Python tests | |
# For example, if you use pytest: | |
#python -m pytest | |
source environment.bash | |
chmod +x ./bin/test_ccdb_python3 | |
./bin/test_ccdb_python3 | |
# Command to compile and run your C++ tests | |
# Adjust these commands according to your build system and test framework | |
#g++ -o test_program source_code.cpp | |
#./test_program |