Merge pull request #2535 from sebix/fix-perms-tests-exc #1246
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
#Github Workflow to run unit tests with pytest | |
# | |
#SPDX-FileCopyrightText: 2020 IntelMQ Team <[email protected]>, 2022 Sebastian Wagner <[email protected]> | |
#SPDX-License-Identifier: AGPL-3.0-or-later | |
# | |
name: "Unit tests" | |
on: | |
push: | |
pull_request: | |
branches: [develop, maintenance] | |
paths-ignore: | |
- '.github/**' | |
jobs: | |
unittests: | |
runs-on: ubuntu-latest | |
name: Run unit tests with pytest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] | |
type: ['full', 'basic'] | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: intelmq | |
POSTGRES_PASSWORD: intelmq | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
rabbitmq: | |
image: rabbitmq:management | |
ports: | |
- 5672:5672 | |
- 15672:15672 | |
mongo: | |
image: mongo | |
ports: | |
- 27017:27017 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies for full run | |
if: ${{ matrix.type == 'full' }} | |
env: | |
PGHOST: localhost | |
PGPORT: 5432 | |
PGUSER: intelmq | |
PGPASSWORD: intelmq | |
run: bash .github/workflows/scripts/setup-full.sh | |
- name: Install test dependencies | |
run: pip install pytest-cov Cerberus requests_mock coverage | |
- name: Install dependencies | |
if: ${{ matrix.type == 'basic' }} | |
run: pip install -e . | |
- name: Run basic testsuite | |
if: ${{ matrix.type == 'basic' }} | |
run: pytest --cov intelmq/ --cov-report=xml --cov-branch intelmq/ | |
- name: Run full testsuite | |
if: ${{ matrix.type == 'full' }} | |
run: pytest --cov intelmq/ --cov-report=xml --cov-branch intelmq/ contrib/ | |
env: | |
TZ: utz | |
INTELMQ_TEST_DATABASES: 1 | |
INTELMQ_TEST_EXOTIC: 1 | |
INTELMQ_TEST_INSTALLATION: 1 |