Skip to content

Commit

Permalink
feat(): include tests collection action
Browse files Browse the repository at this point in the history
  • Loading branch information
Rebits committed Feb 21, 2023
1 parent 9e25b39 commit 84909f3
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/pytest_tests_collection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Tests collection

on:
pull_request:
paths:
- tests/**

jobs:
matrix_prep:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]

- id: set-matrix
run: |
files_changed="${{ steps.changed-files.outputs.all_changed_files }}"
DIRECTORIES=$(echo $files_changed | tr ' ' '\n' | grep ^tests | grep -v pytest.ini | cut -d/ -f2 | uniq | tr -d ' ')
echo "matrix={\"include\":$(echo $DIRECTORIES)}" >> $GITHUB_OUTPUT
run-pytest:
strategy:
matrix:
directory: ${{(needs.matrix_prep.outputs.matrix)}}

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: pip install -r requirements.txt

- name: Install dependencies
run: python3 setup install
working-directory: deps/wazuh_testing

- name: Run pytest
run: |
pytest --collect-only tests/${{ matrix.directory[1] }}

0 comments on commit 84909f3

Please sign in to comment.