Merge pull request #63 from saichandrapandraju/interval-parser #181
This file contains hidden or 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: Python Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: "pip" | |
| - name: Install MariaDB and MariaDB Connector | |
| run: | | |
| sudo apt-get install | |
| sudo apt-get install -y libmariadb3 libmariadb-dev mariadb-server | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install uv | |
| python -m venv .venv | |
| source .venv/bin/activate | |
| if [ -f pyproject.toml ]; then | |
| uv pip install -e ".[dev,protobuf,mariadb]" | |
| else | |
| uv pip install pytest | |
| fi | |
| - name: Install protobuf compiler | |
| run: | | |
| sudo apt-get install -y protobuf-compiler | |
| - name: Generate protobuf stubs | |
| run: | | |
| source .venv/bin/activate | |
| bash scripts/generate_protos.sh | |
| - name: Shutdown Ubuntu MySQL | |
| run: sudo service mysql stop | |
| - name: Set up MariaDB | |
| uses: getong/[email protected] | |
| with: | |
| mysql user: 'trustyai' | |
| mysql password: 'trustyai' | |
| mysql root password: '' | |
| mysql database: 'trustyai-database' | |
| - name: Populate Database | |
| run: | | |
| mariadb -u trustyai --password=trustyai -D trustyai-database -h 127.0.0.1 < tests/resources/legacy_database_dump.sql | |
| - name: Run tests with pytest | |
| run: | | |
| source .venv/bin/activate | |
| pytest tests/ -v --cov=src --cov-report=xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.xml | |
| fail_ci_if_error: false |