Skip to content

Add unit+integration+graph tests Github action #2

Add unit+integration+graph tests Github action

Add unit+integration+graph tests Github action #2

Workflow file for this run

name: General
on:
push:
branches:
- master
pull_request:
branches:
- "**"
concurrency:
group: tests-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
unit-tests:
name: Unit Tests / ${{ matrix.python-version }} (${{ matrix.group }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10" ]
group: [ 1, 2, 3, 4, 5 ]
fail-fast: false
defaults:
run:
shell: bash
env:
TESTS_RESULT_FILE_NAME: "unit-tests-results"
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Tests setup for python ${{ matrix.python-version }}
uses: ./.github/actions/tests_setup
- name: Run pytest
run: |
source "$(poetry env info --path)/bin/activate"
echo $(echo '{"node_version": "'$(node --version)'","npm_list":'$(npm list --json)'}') > node_versions_info.json
# Due to race conditions in the tests bringing up and down the node server, have the server available
# For all the tests.
node demisto_sdk/commands/common/markdown_server/mdx-parse-server.js &
node_pid=$!
# poetry run pytest --ignore={demisto_sdk/commands/init/templates,demisto_sdk/tests/integration_tests,demisto_sdk/commands/content_graph/tests} --store-durations
mkdir $TESTS_RESULT_FILE_NAME
poetry run pytest -v --ignore={demisto_sdk/commands/init/templates,demisto_sdk/tests/integration_tests,demisto_sdk/commands/content_graph/tests} --cov=demisto_sdk --cov-report=html --junitxml=$TESTS_RESULT_FILE_NAME/junit.xml --splits 5 --group ${{ matrix.group }} || pytest_exit_code=$?
echo "PYTEST_EXIT_CODE=$pytest_exit_code" >> $GITHUB_ENV
kill $node_pid
exit $pytest_exit_code
- name: Upload and check tests results
run: ./.github/actions/upload_and_check_tests
integration-tests:
name: Integration Tests / ${{ matrix.python-version }} (${{ matrix.group }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10" ]
fail-fast: false
defaults:
run:
shell: bash
env:
TESTS_RESULT_FILE_NAME: "integration-tests-results"
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Tests setup for python ${{ matrix.python-version }}
uses: ./.github/actions/tests_setup
- name: Run pytest
run: |
source "$(poetry env info --path)/bin/activate"
mkdir $TESTS_RESULT_FILE_NAME
poetry run pytest -v demisto_sdk/tests/integration_tests --cov=demisto_sdk --cov-report=html --junitxml=integration-test-results/junit.xml || pytest_exit_code=$?
echo "PYTEST_EXIT_CODE=$pytest_exit_code" >> $GITHUB_ENV
exit $pytest_exit_code
- name: Upload and check tests results
run: ./.github/actions/upload_and_check_tests