updated Redis config #211
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: Test | |
on: [ pull_request ] | |
env: | |
MODULE_NAME: bev | |
CI: true | |
jobs: | |
test: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Build the package | |
run: | | |
python setup.py sdist | |
- name: Install | |
run: | | |
pip install dist/* | |
pip install -r tests/requirements.txt | |
cd tests | |
export MODULE_PARENT=$(python -c "import $MODULE_NAME, os; print(os.path.dirname($MODULE_NAME.__path__[0]))") | |
export MODULE_PARENT=${MODULE_PARENT%"/"} | |
cd .. | |
echo $MODULE_PARENT | |
echo "MODULE_PARENT=$(echo $MODULE_PARENT)" >> $GITHUB_ENV | |
- name: Test with pytest | |
run: | | |
pytest tests --junitxml=reports/junit-${{ matrix.python-version }}.xml --cov="$MODULE_PARENT/$MODULE_NAME" --cov-report=xml --cov-branch | |
- name: Generate coverage report | |
run: | | |
coverage xml -o reports/coverage-${{ matrix.python-version }}.xml | |
sed -i -e "s|$MODULE_PARENT/||g" reports/coverage-${{ matrix.python-version }}.xml | |
sed -i -e "s|$(echo $MODULE_PARENT/ | tr "/" .)||g" reports/coverage-${{ matrix.python-version }}.xml | |
- name: Test with pydantic v1 | |
run: | | |
pip install --upgrade "pydantic<2.0.0" | |
pytest tests --junitxml=reports/junit-${{ matrix.python-version }}-pydantic1.xml --cov="$MODULE_PARENT/$MODULE_NAME" --cov-report=xml --cov-branch | |
coverage xml -o reports/coverage-${{ matrix.python-version }}-pydantic1.xml | |
sed -i -e "s|$MODULE_PARENT/||g" reports/coverage-${{ matrix.python-version }}-pydantic1.xml | |
sed -i -e "s|$(echo $MODULE_PARENT/ | tr "/" .)||g" reports/coverage-${{ matrix.python-version }}-pydantic1.xml | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: reports-${{ matrix.python-version }} | |
path: reports/*.xml | |
if: ${{ always() }} | |
- name: Upload coverage results | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: true | |
files: reports/coverage-*.xml | |
verbose: true |