Release 0.0.16 #34
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: Python CI | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- README.md | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:16 | |
env: | |
POSTGRES_USER: mybatis | |
POSTGRES_PASSWORD: mybatis | |
POSTGRES_DB: mybatis | |
ports: | |
- 5432:5432 | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: mybatis | |
MYSQL_DATABASE: mybatis | |
MYSQL_USER: mybatis | |
MYSQL_PASSWORD: mybatis | |
ports: | |
- 3306:3306 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Install dependencies | |
run: | | |
pip install pytest pytest-cov mysql-connector-python Pympler orjson psycopg2-binary | |
- name: Wait for PostgreSQL to be ready | |
run: | | |
until pg_isready -h localhost -p 5432 -U mybatis; do | |
echo "Waiting for PostgreSQL..." | |
sleep 2 | |
done | |
echo 'PostgreSQL is ready!' | |
- name: Set up MySQL client | |
run: sudo apt-get install mysql-client | |
- name: Wait for MySQL to be ready | |
run: | | |
until mysql -h 127.0.0.1 -u mybatis -pmybatis -e "SELECT 1"; do | |
echo "Waiting for MySQL..." | |
sleep 2 | |
done | |
echo "MySQL is ready!" | |
- name: Run tests with coverage | |
run: | | |
pytest --cov=mybatis --cov-report=xml test # 生成xml格式的报告 | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
file: ./coverage.xml # 提交报告到 Codecov | |
token: ${{ secrets.CODECOV_TOKEN }} | |