Repository navigation
57 lines (48 loc) · 1.66 KB
/
Copy pathshell-syntax.yml
File metadata and controls
57 lines (48 loc) · 1.66 KB
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
name: Validate audit tooling
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
bash-syntax:
name: Bash syntax
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Validate shell syntax
shell: bash
run: |
set -Eeuo pipefail
while IFS= read -r -d '' script; do
printf 'Checking %s\n' "$script"
bash -n "$script"
done < <(find scripts -type f -name '*.sh' -print0)
- name: Smoke-test network evidence collector
shell: bash
run: |
set -Eeuo pipefail
temporary_directory="$(mktemp -d)"
trap 'rm -rf -- "$temporary_directory"' EXIT
output_directory="$temporary_directory/evidence"
bash scripts/collect-evidence/collect-network-security-evidence.sh "$output_directory"
text_file_count="$(find "$output_directory" -maxdepth 1 -type f -name '*.txt' | wc -l)"
test "$text_file_count" -eq 31
test -f "$output_directory/SHA256SUMS"
(cd "$output_directory" && sha256sum --check SHA256SUMS)
python-validation:
name: Python syntax and anonymizer tests
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Validate Python syntax
run: python -m py_compile scripts/collect-evidence/anonymize-audit-evidence.py
- name: Test anonymizer
run: python -m unittest discover -s scripts/collect-evidence -p 'test_*.py' -v