-
Notifications
You must be signed in to change notification settings - Fork 19
104 lines (102 loc) · 3.62 KB
/
integration-tests-execd-tier-0-1-win.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Integration tests for Execd on Windows - Tier 0 and 1
on:
workflow_dispatch:
inputs:
base_branch:
description: 'Base branch'
required: true
default: 'main'
pull_request:
paths:
- ".github/workflows/integration-tests-execd-tier-0-1-win.yml"
- "src/config/active-response.c"
- "src/config/active-response.h"
- "src/execd/**"
- "src/win32/**"
- "src/Makefile"
- "tests/integration/conftest.py"
- "tests/integration/test_execd/**"
jobs:
# Build the winagent on linux.
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Install wingw required to build the winagent.
- name: Install dependencies
run: sudo apt install gcc-mingw-w64 g++-mingw-w64-i686 g++-mingw-w64-x86-64 nsis -y
# Build winagent.
- name: Build wazuh agent for windows
run: |
make deps -C src TARGET=winagent -j2
make -C src TARGET=winagent -j2
# Compress the files generated by the build.
- name: Compress the winagent build
run: cd .. && zip -r wazuh.zip wazuh
# Make folder and save the compressed build as artifacts.
- name: Save compressed build
run: |
mkdir -p src/winagent
cp ../wazuh.zip src/winagent/wazuh.zip
# Upload build artifacts.
- name: Upload Artifact winagent
uses: actions/upload-artifact@v3
with:
name: winagent
path: src/winagent
# Execute the tests on windows.
run-test:
needs: build
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
BRANCH_BASE: ${{ github.base_ref || inputs.base_branch }}
runs-on: windows-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version-file: ".github/workflows/.python-version"
architecture: x64
- name: Add WiX toolkit to PATH
shell: bash
run: echo "${WIX}bin" >> $GITHUB_PATH
# Download the compressed winagent build.
- name: Download Artifact winagent
uses: actions/download-artifact@v3
with:
name: winagent
path: C:\winagent\
# Decompress the winagent files.
- name: Decompress wazuh
run: |
Expand-Archive -LiteralPath C:\winagent\wazuh.zip -DestinationPath C:\
# Build the winagent installer.
- name: Build wazuh installer
run: |
cd C:\wazuh\src\win32
.\wazuh-installer-build-msi.bat
# Install the windows agent.
- name: Install wazuh agent
run: |
cd C:\wazuh\src\win32
.\wazuh-agent--.msi /q WAZUH_MANAGER="127.0.0.1"
# Download and install integration tests framework.
- name: Download and install qa-integration-framework
run: |
if (git ls-remote https://github.com/wazuh/qa-integration-framework.git $env:BRANCH_NAME) {
$QA_BRANCH = $env:BRANCH_NAME
} elseif (git ls-remote https://github.com/wazuh/qa-integration-framework.git $env:BRANCH_BASE) {
$QA_BRANCH = $env:BRANCH_BASE
} else {
$QA_BRANCH = "main"
}
git clone -b $QA_BRANCH --single-branch https://github.com/wazuh/qa-integration-framework.git
pip install qa-integration-framework/
rm qa-integration-framework/ -r -force
# Run execd integration tests.
- name: Run execd integration tests
run: |
cd C:\wazuh\tests\integration
python -m pytest -m win32 --tier 0 --tier 1 test_execd\