CI: cache zeek builds #95
Workflow file for this run
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
name: unit-tests | |
on: | |
pull_request: | |
branches: | |
- 'master' | |
- 'develop' | |
jobs: | |
build-zeek: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: '' | |
- name: Enable memory overcommit (for redis) | |
run: sysctl vm.overcommit_memory=1 | |
- name: Install dependencies | |
run: sudo apt-get update --fix-missing && sudo apt-get -y --no-install-recommends install python3 redis-server python3-pip python3-certifi python3-dev build-essential file lsof net-tools iproute2 iptables python3-tzlocal nfdump tshark git whois golang nodejs notify-osd yara libnotify-bin | |
- name: Install Zeek | |
run: | | |
echo 'deb http://download.opensuse.org/repositories/security:/zeek/xUbuntu_22.04/ /' | sudo tee /etc/apt/sources.list.d/security:zeek.list | |
curl -fsSL https://download.opensuse.org/repositories/security:zeek/xUbuntu_22.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/security_zeek.gpg > /dev/null | |
sudo apt update && sudo apt install -y --no-install-recommends --fix-missing zeek | |
sudo ln -s /opt/zeek/bin/zeek /usr/local/bin/bro | |
- name: Cache Zeek Build | |
uses: actions/cache@v3 | |
with: | |
path: /opt/zeek | |
key: ${{ runner.os }}-zeek | |
tests: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 1800 | |
# make this one depend on the first job | |
needs: build-zeek | |
strategy: | |
matrix: | |
test_file: | |
- tests/test_inputProc.py | |
- tests/test_main.py | |
- tests/test_conn.py | |
- tests/test_downloaded_file.py | |
- tests/test_ssl.py | |
- tests/test_tunnel.py | |
- tests/test_ssh.py | |
- tests/test_dns.py | |
- tests/test_notice.py | |
- tests/test_software.py | |
- tests/test_smtp.py | |
- tests/test_whitelist.py | |
- tests/test_arp.py | |
- tests/test_blocking.py | |
- tests/test_flow_handler.py | |
- tests/test_horizontal_portscans.py | |
- tests/test_http_analyzer.py | |
- tests/test_vertical_portscans.py | |
- tests/test_network_discovery.py | |
- tests/test_virustotal.py | |
- tests/test_update_file_manager.py | |
- tests/test_threat_intelligence.py | |
- tests/test_slips_utils.py | |
- tests/test_slips.py | |
- tests/test_profiler.py | |
- tests/test_leak_detector.py | |
- tests/test_ip_info.py | |
- tests/test_evidence.py | |
- tests/test_asn_info.py | |
- tests/test_urlhaus.py | |
- tests/test_markov_chain.py | |
- tests/test_daemon.py | |
- tests/test_go_director.py | |
- tests/test_notify.py | |
- tests/test_checker.py | |
- tests/test_base_model.py | |
- tests/test_set_evidence.py | |
- tests/test_trustdb.py | |
- tests/test_cesnet.py | |
- tests/test_output.py | |
- tests/test_riskiq.py | |
- tests/test_spamhaus.py | |
- tests/test_circllu.py | |
- tests/test_evidence_handler.py | |
- tests/test_alert_handler.py | |
- tests/test_redis_manager.py | |
- tests/test_ioc_handler.py | |
- tests/test_timeline.py | |
- tests/test_database.py | |
- tests/test_symbols_handler.py | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: '' | |
- name: Restore Zeek Build from Cache | |
uses: actions/cache@v3 | |
with: | |
path: /opt/zeek | |
key: ${{ runner.os }}-zeek | |
- name: Set up Python 3.10.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10.12" | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python3 -m pip install --no-cache-dir -r install/requirements.txt | |
- name: Start redis server | |
run: redis-server --daemonize yes | |
- name: Run Unit Tests for ${{ matrix.test_file }} | |
run: | | |
python3 -m pytest ${{ matrix.test_file }} -p no:warnings -vv -s -n 5 | |
- name: Upload Artifacts | |
if: success() || failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test_slips_locally-integration-tests-output | |
path: | | |
output/integration_tests |