File tree 1 file changed +46
-0
lines changed
1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Pr-Check Bash Script
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+ pull_request :
8
+ branches :
9
+ - main
10
+
11
+ jobs :
12
+ test-script :
13
+ runs-on : ubuntu-latest
14
+
15
+ steps :
16
+ - name : Check out code
17
+ uses : actions/checkout@v3
18
+
19
+ - name : Set execute permissions
20
+ run : chmod +x ./usr/bin/clean_memory.sh
21
+
22
+ - name : Run the Bash script
23
+ id : run_script
24
+ run : |
25
+ # Execute the script and capture output
26
+ sudo ./usr/bin/clean_memory.sh | tee script_output.log
27
+
28
+ - name : Verify script output
29
+ run : |
30
+ # Check if the script produced output indicating it ran
31
+ if grep -q "Values before" script_output.log && grep -q "Values now" script_output.log; then
32
+ echo "Script executed successfully."
33
+ else
34
+ echo "Script failed to execute properly."
35
+ exit 1
36
+ fi
37
+
38
+ - name : Verify script logs
39
+ run : |
40
+ # Ensure that certain expected outputs are present in the logs
41
+ if grep -q "Cleaning Memory..." script_output.log; then
42
+ echo "Memory cleaning step executed."
43
+ else
44
+ echo "Memory cleaning step missing."
45
+ exit 1
46
+ fi
You can’t perform that action at this time.
0 commit comments