Fix CI - MongoDB container action is only supported on Linux

This commit is contained in:
Rishat Fayzullin 2024-03-13 21:56:15 +03:00
parent ce48b825e8
commit a24327455a

View file

@ -44,8 +44,11 @@ jobs:
env:
# Windows has some limitations:
# Redis is not supported on GitHub Windows runners;
# Redis and MongoDB is not supported on GitHub Windows runners;
IS_WINDOWS: ${{ startswith(matrix.os, 'windows') }}
# MongoDB has some limitations:
# MongoDB container action is only supported on Linux;
IS_UBUNTU: ${{ startswith(matrix.os, 'ubuntu') }}
steps:
- name: Checkout code
@ -75,7 +78,7 @@ jobs:
redis-version: 6
- name: Setup mongodb
if: ${{ env.IS_WINDOWS == 'false' }}
if: ${{ env.IS_UBUNTU == 'true' }}
uses: supercharge/mongodb-github-action@1.10.0
with:
mongodb-version: '7.0'
@ -86,7 +89,8 @@ jobs:
- name: Run tests
run: |
flags="$flags --cov=aiogram --cov-config .coveragerc --cov-report=xml"
[[ "$IS_WINDOWS" == "false" ]] && flags="$flags --redis redis://localhost:6379/0 --mongo mongodb://mongo:mongo@localhost:27017"
[[ "$IS_WINDOWS" == "false" ]] && flags="$flags --redis redis://localhost:6379/0"
[[ "$IS_UBUNTU" == "true" ]] && flags="$flags --mongo mongodb://mongo:mongo@localhost:27017"
pytest $flags
- name: Upload coverage data
@ -104,7 +108,7 @@ jobs:
matrix:
os:
- ubuntu-latest
- macos-latest
# - macos-latest
# - windows-latest
python-version:
- 'pypy3.8'