-
Notifications
You must be signed in to change notification settings - Fork 15
185 lines (130 loc) · 5.44 KB
/
system-tests-workflow.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: System tests
on: [push]
jobs:
monitor-system-tests-unix:
runs-on: ubuntu-20.04
steps:
- name: Check out repository code, branch='${{ github.ref }}'
uses: actions/checkout@v2
- name: Install pytest
run: pip3 install pytest
- name: Build FIM
run: cargo build --release
- name: Change configuration to test on Linux
if: runner.os == 'Linux'
run: sed -i 's|usr/bin/.*|tmp/test|g' config/linux/config.yml
- name: Change configuration to test on macOS
if: runner.os == 'macOS'
run: sed -i '' 's|usr/bin.*|tmp/test|g' config/linux/config.yml
- name: Copy FIM binary to main folder
run: cp ./target/release/fim ./
- name: Create required directories
run: mkdir -p /tmp/test
- name: Create events file and folder
run: sudo mkdir -p /var/lib/fim/ && sudo touch /var/lib/fim/events.json && sudo chown -R runner:runner /var/lib/fim
- name: Create log file and folder
run: sudo mkdir -p /var/log/fim/ && sudo touch /var/log/fim/fim.log && sudo chown -R runner:runner /var/log/fim
- name: Start FIM process
run: sudo ./fim &
- name: Launch test suite
run: python3 -m pytest test/system/monitor.py -v --noconftest
- name: Print events.json file
if: always()
run: cat /var/lib/fim/events.json
- run: echo "Job's status is ${{ job.status }}."
audit-system-tests-ubuntu18:
runs-on: [self-hosted, ubuntu18]
steps:
- name: Check out repository code, branch='${{ github.ref }}'
uses: actions/checkout@v2
- name: Build FIM
run: cargo build --release
- name: Change configuration
run: sed -i 's|/tmp|/tmp/test|g' config/linux/config.yml
- name: Copy FIM binary to main folder
run: cp ./target/release/fim ./
- name: Create required directories
run: mkdir -p /tmp/test
- name: Create events file and folder
run: sudo mkdir -p /var/lib/fim/ && sudo touch /var/lib/fim/events.json && sudo chown -R okynos:okynos /var/lib/fim
- name: Create log file and folder
run: sudo mkdir -p /var/log/fim/ && sudo touch /var/log/fim/fim.log && sudo chown -R okynos:okynos /var/log/fim
- name: Start FIM process
run: sudo ./fim &
- name: Check FIM running
run: sleep 5 && ps a | grep fim | grep -v grep
- name: Launch test suite
run: sudo python3 -m pytest test/system/audit.py -v
- name: Print config file
if: always()
run: cat ${{ github.workspace }}/config/linux/config.yml || true
- name: Print log file
if: always()
run: cat /var/log/fim/fim.log || true
- name: Stop FIM process
if: always()
run: sudo pkill fim || true
- name: Clean temporal folder
if: always()
run: sudo rm -rf /tmp/test
- name: Clean log folder
if: always()
run: sudo rm -rf /var/log/fim/
- name: Clean lib folder
if: always()
run: sudo rm -rf /var/lib/fim/
- name: Clean workspace
if: always()
run: sudo rm -rf ${{ github.workspace }}/test/system/__pycache__/ ${{ github.workspace }}/test/system/.pytest_cache ${{ github.workspace }}/.pytest_cache
- name: Clean test output
if: always()
run: sudo rm -rf ${{ github.workspace }}/test_*
- run: echo "Job's status is ${{ job.status }}."
audit-system-tests-centos7:
runs-on: [self-hosted, centos7]
steps:
- name: Check out repository code, branch='${{ github.ref }}'
uses: actions/checkout@v2
- name: Build FIM
run: /home/okynos/.cargo/bin/cargo build --release
- name: Change configuration
run: sed -i 's|/tmp|/tmp/test|g' config/linux/config.yml
- name: Copy FIM binary to main folder
run: cp ./target/release/fim ./
- name: Create required directories
run: mkdir -p /tmp/test
- name: Create events file and folder
run: sudo mkdir -p /var/lib/fim/ && sudo touch /var/lib/fim/events.json && sudo chown -R okynos:okynos /var/lib/fim
- name: Create log file and folder
run: sudo mkdir -p /var/log/fim/ && sudo touch /var/log/fim/fim.log && sudo chown -R okynos:okynos /var/log/fim
- name: Start FIM process
run: sudo ./fim &
- name: Check FIM running
run: sleep 5 && ps a | grep fim | grep -v grep
- name: Launch test suite
run: sudo python3 -m pytest test/system/audit.py -v
- name: Print config file
if: always()
run: cat ${{ github.workspace }}/config/linux/config.yml || true
- name: Print log file
if: always()
run: cat /var/log/fim/fim.log || true
- name: Stop FIM process
if: always()
run: sudo pkill fim || true
- name: Clean temporal folder
if: always()
run: sudo rm -rf /tmp/test
- name: Clean log folder
if: always()
run: sudo rm -rf /var/log/fim/
- name: Clean lib folder
if: always()
run: sudo rm -rf /var/lib/fim/
- name: Clean workspace
if: always()
run: sudo rm -rf ${{ github.workspace }}/test/system/__pycache__/ ${{ github.workspace }}/test/system/.pytest_cache ${{ github.workspace }}/.pytest_cache
- name: Clean test output
if: always()
run: sudo rm -rf ${{ github.workspace }}/test_*
- run: echo "Job's status is ${{ job.status }}."