Merge pull request #96 from Avivsalem/bugfix/deploy #402
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
# This workflow runs the tests and linters | |
name: tests | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ dev, staging, main ] | |
pull_request: | |
branches: [ dev, staging, main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
test: | |
strategy: | |
matrix: | |
platform: [ ubuntu-latest, windows-latest ] | |
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
# Checkout the latest code from the repo | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
# Setup which version of Python to use | |
- name: Set Up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Display the Python version being used | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
# Install any basic dependencies required to run the tests | |
- name: Install dependencies | |
run: | | |
python -m pip install pip -U | |
pip install .[all] | |
- name: Run Mypy | |
run: | | |
pip install mypy | |
mypy messageflux | |
- name: Run Flake8 | |
run: | | |
pip install flake8 | |
flake8 messageflux tests -v | |
- name: Run Tests | |
env: | |
RABBITMQ_PASSWORD: ${{ secrets.RABBITMQ_PASSWORD }} | |
run: | | |
pip install pytest pytest-cov | |
pytest --cov=./messageflux --cov-report term-missing --cov-report=html:./reports/coverage/html_results --cov-report xml:./reports/coverage/coverage-results.xml --junitxml=./reports/test-results.xml tests | |
- name: Publish Test Report | |
uses: mikepenz/action-junit-report@v3 | |
if: always() # always run even if the previous step fails | |
with: | |
report_paths: ./reports/test-results.xml | |
detailed_summary: true | |
include_passed: true | |
check_name: ${{ matrix.python-version }}-${{ matrix.platform }} JUnit Test Report | |
# Upload mypy artifact | |
- name: Upload mypy artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mypy-report | |
path: reports/mypy.xml | |