-
Notifications
You must be signed in to change notification settings - Fork 46
147 lines (130 loc) · 5.85 KB
/
versioned-report.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
# This workflow is a separate workflow from `report.yml` for regenerating the versioned report data needed for Bowtie's UI and `bowtie trend`.
# It retests all of Bowtie's supported implementations for all their multiple versions listed in `matrix-versions.json` file if one exists for them.
name: Collect New Versioned Test Results
on:
workflow_dispatch:
inputs:
implementation:
description: The name of an implementation.
required: false
type: string
jobs:
list-implementations:
runs-on: ubuntu-latest
outputs:
implementations: ${{ steps.implementations-matrix.outputs.implementations }}
steps:
- uses: actions/checkout@v4
- name: Install Bowtie
uses: ./
- name: List all Bowtie Supported Implementations having a "matrix-versions.json" file
id: implementations-matrix
run: |
implementation=${{ inputs.implementation }}
IMPLEMENTATIONS=$(bowtie filter-implementations --format json)
MATRIX="[]"
if [ -n "$implementation" ]; then
if echo "$IMPLEMENTATIONS" | jq -e --arg impl "$implementation" 'index($impl) != null' > /dev/null; then
if [ -f "implementations/$implementation/matrix-versions.json" ]; then
MATRIX=$(echo $MATRIX | jq --arg impl "$implementation" '. + [$impl]')
else
echo "No \`matrix-versions.json\` file found for implementation ('$implementation')."
exit 1
fi
else
echo "No such implementation ('$implementation') found. Please provide a correct implementation name."
echo "To see a list of all Bowtie supported implementations, run \`bowtie filter-implementations\`."
exit 1
fi
else
for impl in $(echo "$IMPLEMENTATIONS" | jq -r '.[]'); do
if [ -f "implementations/$impl/matrix-versions.json" ]; then
MATRIX=$(echo $MATRIX | jq --arg impl "$impl" '. + [$impl]')
fi
done
fi
echo "implementations=$(echo $MATRIX | jq -c .)" >> $GITHUB_OUTPUT
regenerate-versioned-reports:
needs: list-implementations
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
implementation: ${{ fromJson(needs.list-implementations.outputs.implementations) }}
steps:
- uses: actions/checkout@v4
- name: Install Bowtie
uses: ./
# just so that we don't get rate limited (429)
- name: Checkout JSON Schema Test Suite
uses: actions/checkout@v4
with:
repository: json-schema-org/JSON-Schema-Test-Suite
path: json-schema-test-suite
- name: Make a ${{ matrix.implementation }} directory to keep all its version reports
run: mkdir ${{ matrix.implementation }}
- name: Generate New Versioned Reports for all Supported Dialects of ${{ matrix.implementation }}
id: generate-new-versioned-report
run: |
impl=${{ matrix.implementation }}
MATRIX_VERSIONS_FILE="implementations/$impl/matrix-versions.json"
cp $MATRIX_VERSIONS_FILE $impl
for version in $(jq -r '.[]' $MATRIX_VERSIONS_FILE); do
SUPPORTED_DIALECTS=$(bowtie filter-dialects -i image:$impl:$version | xargs -I {} jq -r '.[] | select(.uri == "{}") | .shortName' data/dialects.json)
if [ -n "$SUPPORTED_DIALECTS" ]; then
mkdir "$impl/v$version"
for dialect in $SUPPORTED_DIALECTS; do
bowtie suite -i image:$impl:$version ./json-schema-test-suite/tests/$dialect > "$impl/v$version/$dialect.json"
done
fi
done
# This is useful to debug whether Bowtie accidentally fetched some huge
# number of container images.
- name: Show what images we fetched
run: docker images
if: always()
# FIXME: We ignore for now as now this exits unsuccessfully if there
# are *test* failures
- name: Check that all Generated Versioned Reports of ${{ matrix.implementation }} are Valid
run: |
impl=${{ matrix.implementation }}
MATRIX_VERSIONS=$(jq -r '.[]' "implementations/$impl/matrix-versions.json")
for version in $MATRIX_VERSIONS; do
SUPPORTED_DIALECTS=$(bowtie filter-dialects -i image:$impl:$version | xargs -I {} jq -r '.[] | select(.uri == "{}") | .shortName' data/dialects.json)
if [ -n "$SUPPORTED_DIALECTS" ]; then
for dialect in $SUPPORTED_DIALECTS; do
bowtie summary --show failures "$impl/v$version/$dialect.json" --format markdown >> $GITHUB_STEP_SUMMARY
done
fi
done
continue-on-error: true
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.implementation }}
path: |
${{ matrix.implementation }}
combine-all-versioned-reports:
runs-on: ubuntu-latest
needs: regenerate-versioned-reports
steps:
- name: Download all uploaded artifacts
uses: actions/download-artifact@v4
with:
path: implementations
- name: Download latest versioned test reports
uses: dawidd6/action-download-artifact@v9
with:
workflow: versioned-report.yml
branch: main
name: implementations
path: latest-implementations
if: ${{ inputs.implementation != null }}
- name: Prepare artifact for upload
run: |
rm -rf "latest-implementations/${{ inputs.implementation }}"
cp -r "implementations/${{ inputs.implementation }}" "latest-implementations/"
if: ${{ inputs.implementation != null }}
- uses: actions/upload-artifact@v4
with:
name: implementations
path: ${{ inputs.implementation != null && 'latest-implementations' || 'implementations' }}