|
7 | 7 | - 'develop' |
8 | 8 |
|
9 | 9 | jobs: |
| 10 | + # This job finds all test files and creates a JSON array for the matrix |
| 11 | + list-tests: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + timeout-minutes: 120 |
| 14 | + outputs: |
| 15 | + test_files: ${{ steps.list.outputs.test_files }} |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v5 |
| 18 | + - id: list |
| 19 | + uses: ./.github/actions/list-tests-dir |
| 20 | + with: |
| 21 | + test_dir: tests/unit |
10 | 22 |
|
11 | 23 | unit-tests: |
| 24 | + needs: list-tests |
12 | 25 | runs-on: ubuntu-22.04 |
13 | 26 | timeout-minutes: 120 |
14 | 27 |
|
| 28 | + # Do not stop other tests if one file fails |
| 29 | + strategy: |
| 30 | + fail-fast: false |
| 31 | + matrix: |
| 32 | + test_file: ${{ fromJson(needs.list-tests.outputs.test_files) }} |
| 33 | + |
15 | 34 | container: |
16 | 35 | image: stratosphereips/slips_dependencies |
17 | 36 | # TensorFlow + multiprocessing + pytest -n can hit /dev/shm limits. |
18 | 37 | options: --shm-size=2g |
19 | 38 |
|
20 | | - |
21 | 39 | env: |
22 | 40 | TF_CPP_MIN_LOG_LEVEL: 3 |
23 | 41 | TF_ENABLE_ONEDNN_OPTS: 0 |
24 | 42 |
|
25 | | - strategy: |
26 | | - matrix: |
27 | | - test_file: |
28 | | - - test_input.py |
29 | | - - test_main.py |
30 | | - - test_conn.py |
31 | | - - test_downloaded_file.py |
32 | | - - test_ssl.py |
33 | | - - test_tunnel.py |
34 | | - - test_ssh.py |
35 | | - - test_dns.py |
36 | | - - test_notice.py |
37 | | - - test_software.py |
38 | | - - test_smtp.py |
39 | | - - test_whitelist.py |
40 | | - - test_arp.py |
41 | | - - test_arp_poisoner.py |
42 | | - - test_arp_filter.py |
43 | | - - test_blocking.py |
44 | | - - test_unblocker.py |
45 | | - - test_flow_handler.py |
46 | | - - test_horizontal_portscans.py |
47 | | - - test_http_analyzer.py |
48 | | - - test_vertical_portscans.py |
49 | | - - test_network_discovery.py |
50 | | - - test_virustotal.py |
51 | | - - test_update_file_manager.py |
52 | | - - test_threat_intelligence.py |
53 | | - - test_slips_utils.py |
54 | | - - test_slips.py |
55 | | - - test_profiler.py |
56 | | - - test_profiler_worker.py |
57 | | - - test_profilers_manager.py |
58 | | - - test_leak_detector.py |
59 | | - - test_ip_info.py |
60 | | - - test_evidence.py |
61 | | - - test_asn_info.py |
62 | | - - test_urlhaus.py |
63 | | - - test_markov_chain.py |
64 | | - - test_daemon.py |
65 | | - - test_go_director.py |
66 | | - - test_notify.py |
67 | | - - test_checker.py |
68 | | - - test_base_model.py |
69 | | - - test_set_evidence.py |
70 | | - - test_trustdb.py |
71 | | - - test_cesnet.py |
72 | | - - test_output.py |
73 | | - - test_riskiq.py |
74 | | - - test_spamhaus.py |
75 | | - - test_scan_detections_db.py |
76 | | - - test_circllu.py |
77 | | - - test_evidence_handler.py |
78 | | - - test_evidence_logger.py |
79 | | - - test_evidence_formatter.py |
80 | | - - test_alert_handler.py |
81 | | - - test_redis_manager.py |
82 | | - - test_ioc_handler.py |
83 | | - - test_timeline.py |
84 | | - - test_database.py |
85 | | - - test_symbols_handler.py |
86 | | - - test_profile_handler.py |
87 | | - - test_process_manager.py |
88 | | - - test_metadata_manager.py |
89 | | - - test_host_ip_manager.py |
90 | | - - test_rnn_cc_detection.py |
91 | | - - test_idea_format.py |
92 | | - - test_fides_sqlite_db.py |
93 | | - - test_fides_module.py |
94 | | - - test_fides_queues.py |
95 | | - - test_fides_bridge.py |
96 | | - |
97 | 43 | steps: |
98 | | - - uses: actions/checkout@v5 |
99 | | - with: |
100 | | - ref: ${{ github.ref }} |
101 | | - fetch-depth: 0 |
102 | | - |
103 | | - - name: Start Redis |
104 | | - uses: ./.github/actions/start-redis |
105 | | - |
106 | | - - name: Run Unit Tests for ${{ matrix.test_file }} |
107 | | - run: | |
108 | | - python3 -m pytest tests/${{ matrix.test_file }} -p no:warnings -vv -s -n 5 |
109 | | -
|
110 | | - - name: Upload Artifacts |
111 | | - if: always() |
112 | | - uses: actions/upload-artifact@v5 |
113 | | - with: |
114 | | - name: test_slips_locally-unit-tests-output |
115 | | - path: | |
116 | | - output/unit_tests |
| 44 | + - uses: actions/checkout@v5 |
| 45 | + with: |
| 46 | + ref: ${{ github.ref }} |
| 47 | + fetch-depth: 0 |
| 48 | + |
| 49 | + - name: Start Redis |
| 50 | + uses: ./.github/actions/start-redis |
| 51 | + |
| 52 | + - name: Run Unit Tests for ${{ matrix.test_file }} |
| 53 | + run: | |
| 54 | + # The path is reconstructed here using the matrix variable |
| 55 | + python3 -m pytest tests/unit/${{ matrix.test_file }} -p no:warnings -vv -s -n 5 |
| 56 | +
|
| 57 | + - name: Upload Artifacts |
| 58 | + if: always() |
| 59 | + uses: actions/upload-artifact@v5 |
| 60 | + with: |
| 61 | + name: test_slips-output-${{ strategy.job-index }} |
| 62 | + path: | |
| 63 | + output/unit_tests |
0 commit comments