-
-
Notifications
You must be signed in to change notification settings - Fork 3
57 lines (48 loc) · 1.81 KB
/
test.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
name: Test ApiDOM Validator
on:
push:
branches:
- main
workflow_dispatch:
branches:
- main
jobs:
test_github_action:
runs-on: ubuntu-latest
outputs:
output1: ${{ steps.test1.outcome }}
output2: ${{ steps.test2.outcome }}
steps:
- uses: actions/checkout@v4
- id: test1
name: "Test 1: Validate at Severity level 1 (Errors)"
uses: swaggerexpert/apidom-validate@main
with:
definition-file: ./.github/workflows/fixtures/openapi.json
- id: test2
name: "Test 2: Validate at Severity level 4 (Hints)"
if: success() || failure()
uses: swaggerexpert/apidom-validate@main
with:
definition-file: ./.github/workflows/fixtures/openapi.json
fails-on: 4
continue-on-error: true
verify_outcomes:
needs: test_github_action
runs-on: ubuntu-latest
steps:
- name: Compare Expected vs Actual Outcomes
run: |
echo ""
echo " Test | Definition File | Fails On Level | Expected Outcome | Actual Outcome"
echo "------|-----------------|----------------|------------------|----------------"
echo " 1 | openapi.json | 1 | success | ${{ needs.test_github_action.outputs['output1'] }}"
echo " 2 | openapi.json | 4 | failure | ${{ needs.test_github_action.outputs['output2'] }}"
echo ""
if [ "${{ needs.test_github_action.outputs['output1'] }}" == "success" ] && [ "${{ needs.test_github_action.outputs['output2'] }}" == "failure" ] ; then
echo "SUCCESS: Actual outcomes match expected outcomes."
exit 0
else
echo "FAILED: Actual outcomes do not match expected outcomes."
exit 1
fi