-
Notifications
You must be signed in to change notification settings - Fork 4
162 lines (144 loc) · 4.85 KB
/
Copy pathtest-updated-actions.yml
File metadata and controls
162 lines (144 loc) · 4.85 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
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
name: Test Updated Actions
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
test-find-changed-files:
name: "Test: find-changed-files"
runs-on: ARM64
permissions:
contents: read
pull-requests: read
steps:
- uses: actions/checkout@v4
- name: Run find-changed-files
id: changed
uses: ./.github/actions/find-changed-files
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify output
run: |
files="${{ steps.changed.outputs.all_modified_files }}"
echo "Changed files: $files"
if [ -z "$files" ]; then
echo "::error::Expected non-empty all_modified_files output"
exit 1
fi
echo "find-changed-files produced output successfully"
test-archived-repo-scanner:
name: "Test: archived-repo-scanner"
runs-on: ubuntu-latest
permissions:
security-events: write
contents: read
actions: read
steps:
- uses: actions/checkout@v4
- name: Run archived-repo-scanner
id: scanner
uses: ./.github/actions/archived-repo-scanner
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
fail_on_archived: 'false'
- name: Verify output
run: |
total="${{ steps.scanner.outputs.total_github_links }}"
echo "Total GitHub links found: $total"
if [ -z "$total" ]; then
echo "::error::Expected total_github_links output to be set"
exit 1
fi
echo "archived-repo-scanner completed successfully"
test-csv-vulnerability-filter:
name: "Test: csv-vulnerability-filter"
runs-on: ARM64
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Create sample CSV
run: |
mkdir -p /tmp/test-csv
cat > /tmp/test-csv/primary.csv << 'CSVEOF'
AWS Inspector Scan Results
Generated: 2025-01-01
ID,Severity,Title,Fixed Package,CVSS
CVE-2024-0001,CRITICAL,Test vuln 1,1.2.3,9.8
CVE-2024-0002,HIGH,Test vuln 2,2.0.0,7.5
CVE-2024-0003,MEDIUM,Test vuln 3,,5.0
CVE-2024-0004,LOW,Test vuln 4,N/A,2.1
CSVEOF
- name: Run csv-vulnerability-filter
id: filter
uses: ./.github/actions/csv-vulnerability-filter
with:
primary_csv_path: /tmp/test-csv/primary.csv
ignore_unpatched: 'false'
filter_min_severity: 'LOW'
- name: Verify output
run: |
count="${{ steps.filter.outputs.filtered_count }}"
echo "Filtered count: $count"
if [ -z "$count" ]; then
echo "::error::Expected filtered_count output to be set"
exit 1
fi
echo "csv-vulnerability-filter completed successfully with $count findings"
test-validate-json-schema:
name: "Test: validate-json-schema"
runs-on: ARM64
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Test valid JSON (should pass)
uses: ./.github/actions/validate-json-schema
with:
data: '{"name": "test", "version": "1.0.0"}'
schema: '{"type": "object", "properties": {"name": {"type": "string"}, "version": {"type": "string"}}, "required": ["name", "version"]}'
- name: Test invalid JSON (should fail)
id: invalid
continue-on-error: true
uses: ./.github/actions/validate-json-schema
with:
data: '{"name": 123}'
schema: '{"type": "object", "properties": {"name": {"type": "string"}}, "required": ["name"]}'
- name: Verify invalid case was caught
run: |
if [ "${{ steps.invalid.outcome }}" = "failure" ]; then
echo "Correctly rejected invalid JSON"
else
echo "::error::Expected validation to fail for invalid JSON but it passed"
exit 1
fi
test-build-prep:
name: "Test: argus-builder/build-prep"
runs-on: ARM64
permissions:
contents: read
pull-requests: read
steps:
- uses: actions/checkout@v4
- name: Run build-prep
id: prep
uses: ./.github/actions/argus-builder/build-prep
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
images: |
{
"test-image": {
"context": ".",
"dockerfile": "Dockerfile"
}
}
- name: Verify outputs
run: |
tag="${{ steps.prep.outputs.image_tag }}"
should_build="${{ steps.prep.outputs.should_build }}"
echo "image_tag: $tag"
echo "should_build: $should_build"
if [ -z "$tag" ]; then
echo "::error::Expected image_tag output to be set"
exit 1
fi
echo "argus-builder/build-prep completed successfully"