serialbench 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/benchmark.yml +181 -30
- data/.github/workflows/ci.yml +3 -3
- data/.github/workflows/docker.yml +272 -0
- data/.github/workflows/rake.yml +15 -0
- data/.github/workflows/release.yml +25 -0
- data/Gemfile +6 -30
- data/README.adoc +381 -415
- data/Rakefile +0 -55
- data/config/benchmarks/full.yml +29 -0
- data/config/benchmarks/short.yml +26 -0
- data/config/environments/asdf-ruby-3.2.yml +8 -0
- data/config/environments/asdf-ruby-3.3.yml +8 -0
- data/config/environments/docker-ruby-3.0.yml +9 -0
- data/config/environments/docker-ruby-3.1.yml +9 -0
- data/config/environments/docker-ruby-3.2.yml +9 -0
- data/config/environments/docker-ruby-3.3.yml +9 -0
- data/config/environments/docker-ruby-3.4.yml +9 -0
- data/docker/Dockerfile.alpine +33 -0
- data/docker/Dockerfile.ubuntu +32 -0
- data/docker/README.md +214 -0
- data/exe/serialbench +1 -1
- data/lib/serialbench/benchmark_runner.rb +270 -350
- data/lib/serialbench/cli/base_cli.rb +51 -0
- data/lib/serialbench/cli/benchmark_cli.rb +380 -0
- data/lib/serialbench/cli/environment_cli.rb +181 -0
- data/lib/serialbench/cli/resultset_cli.rb +215 -0
- data/lib/serialbench/cli/ruby_build_cli.rb +238 -0
- data/lib/serialbench/cli.rb +59 -410
- data/lib/serialbench/config_manager.rb +140 -0
- data/lib/serialbench/models/benchmark_config.rb +63 -0
- data/lib/serialbench/models/benchmark_result.rb +45 -0
- data/lib/serialbench/models/environment_config.rb +71 -0
- data/lib/serialbench/models/platform.rb +59 -0
- data/lib/serialbench/models/result.rb +53 -0
- data/lib/serialbench/models/result_set.rb +71 -0
- data/lib/serialbench/models/result_store.rb +108 -0
- data/lib/serialbench/models.rb +54 -0
- data/lib/serialbench/ruby_build_manager.rb +153 -0
- data/lib/serialbench/runners/asdf_runner.rb +296 -0
- data/lib/serialbench/runners/base.rb +32 -0
- data/lib/serialbench/runners/docker_runner.rb +142 -0
- data/lib/serialbench/serializers/base_serializer.rb +8 -16
- data/lib/serialbench/serializers/json/base_json_serializer.rb +4 -4
- data/lib/serialbench/serializers/json/json_serializer.rb +0 -2
- data/lib/serialbench/serializers/json/oj_serializer.rb +0 -2
- data/lib/serialbench/serializers/json/rapidjson_serializer.rb +50 -0
- data/lib/serialbench/serializers/json/yajl_serializer.rb +6 -4
- data/lib/serialbench/serializers/toml/base_toml_serializer.rb +5 -3
- data/lib/serialbench/serializers/toml/toml_rb_serializer.rb +0 -2
- data/lib/serialbench/serializers/toml/tomlib_serializer.rb +0 -2
- data/lib/serialbench/serializers/toml/tomlrb_serializer.rb +56 -0
- data/lib/serialbench/serializers/xml/base_xml_serializer.rb +4 -9
- data/lib/serialbench/serializers/xml/libxml_serializer.rb +0 -2
- data/lib/serialbench/serializers/xml/nokogiri_serializer.rb +21 -5
- data/lib/serialbench/serializers/xml/oga_serializer.rb +0 -2
- data/lib/serialbench/serializers/xml/ox_serializer.rb +0 -2
- data/lib/serialbench/serializers/xml/rexml_serializer.rb +32 -4
- data/lib/serialbench/serializers/yaml/base_yaml_serializer.rb +59 -0
- data/lib/serialbench/serializers/yaml/psych_serializer.rb +54 -0
- data/lib/serialbench/serializers/yaml/syck_serializer.rb +102 -0
- data/lib/serialbench/serializers.rb +34 -6
- data/lib/serialbench/site_generator.rb +105 -0
- data/lib/serialbench/templates/assets/css/benchmark_report.css +535 -0
- data/lib/serialbench/templates/assets/css/format_based.css +526 -0
- data/lib/serialbench/templates/assets/css/themes.css +588 -0
- data/lib/serialbench/templates/assets/js/chart_helpers.js +381 -0
- data/lib/serialbench/templates/assets/js/dashboard.js +796 -0
- data/lib/serialbench/templates/assets/js/navigation.js +142 -0
- data/lib/serialbench/templates/base.liquid +49 -0
- data/lib/serialbench/templates/format_based.liquid +279 -0
- data/lib/serialbench/templates/partials/chart_section.liquid +4 -0
- data/lib/serialbench/version.rb +1 -1
- data/lib/serialbench.rb +2 -31
- data/serialbench.gemspec +28 -17
- metadata +192 -55
- data/lib/serialbench/chart_generator.rb +0 -821
- data/lib/serialbench/result_formatter.rb +0 -182
- data/lib/serialbench/result_merger.rb +0 -1201
- data/lib/serialbench/serializers/xml/base_parser.rb +0 -69
- data/lib/serialbench/serializers/xml/libxml_parser.rb +0 -98
- data/lib/serialbench/serializers/xml/nokogiri_parser.rb +0 -111
- data/lib/serialbench/serializers/xml/oga_parser.rb +0 -85
- data/lib/serialbench/serializers/xml/ox_parser.rb +0 -64
- data/lib/serialbench/serializers/xml/rexml_parser.rb +0 -129
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bd127a1fb810ad2b4a95377dd7bf7e75297ec4b989b44844131b5ac01b0ab83
|
4
|
+
data.tar.gz: f594315660bf94c7c97d8a0b0f9d9aadf6b756f675cc8e1671535840840c26bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 607d47dee25a4815518e7246b44830cc78d08e9852c79f06803ba073a0af71946066f287ce174f130ce5553bbe3707e76d12c5318eb5db9966a97cb69de976e2
|
7
|
+
data.tar.gz: 808cc1fdd677a2b6ee5603305fa9a2da913ee2c2feae3b6ea0e648b39c99c15a01a3f89b067be9ac45b634ab330f3fb1dc2f1e02606482af2faef3118c04a484
|
@@ -1,4 +1,4 @@
|
|
1
|
-
name:
|
1
|
+
name: benchmark
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
@@ -25,24 +25,27 @@ jobs:
|
|
25
25
|
runs-on: ubuntu-latest
|
26
26
|
outputs:
|
27
27
|
ruby-versions: ${{ steps.set-matrix.outputs.ruby-versions }}
|
28
|
-
|
28
|
+
platforms: ${{ steps.set-matrix.outputs.platforms }}
|
29
29
|
steps:
|
30
|
-
- name: Set
|
30
|
+
- name: Set matrix configurations
|
31
31
|
id: set-matrix
|
32
32
|
run: |
|
33
33
|
echo 'ruby-versions=["3.1", "3.2", "3.3", "3.4"]' >> $GITHUB_OUTPUT
|
34
|
-
echo '
|
34
|
+
echo 'platforms=["ubuntu-latest", "macos-latest", "windows-latest"]' >> $GITHUB_OUTPUT
|
35
35
|
|
36
|
+
# Cross-platform native benchmarks
|
36
37
|
benchmark:
|
37
|
-
runs-on:
|
38
|
+
runs-on: ${{ matrix.platform }}
|
38
39
|
needs: setup
|
39
40
|
strategy:
|
40
41
|
matrix:
|
42
|
+
platform: ${{ fromJson(needs.setup.outputs.platforms) }}
|
41
43
|
ruby-version: ${{ fromJson(needs.setup.outputs.ruby-versions) }}
|
42
44
|
fail-fast: false
|
43
45
|
|
44
46
|
steps:
|
45
|
-
-
|
47
|
+
- name: Checkout repository
|
48
|
+
uses: actions/checkout@v4
|
46
49
|
|
47
50
|
- name: Set up Ruby ${{ matrix.ruby-version }}
|
48
51
|
uses: ruby/setup-ruby@v1
|
@@ -50,39 +53,64 @@ jobs:
|
|
50
53
|
ruby-version: ${{ matrix.ruby-version }}
|
51
54
|
bundler-cache: true
|
52
55
|
|
53
|
-
- name: Install system dependencies
|
56
|
+
- name: Install system dependencies (Ubuntu)
|
57
|
+
if: matrix.platform == 'ubuntu-latest'
|
54
58
|
run: |
|
55
59
|
sudo apt-get update
|
56
|
-
sudo apt-get install -y libxml2-dev libxslt1-dev
|
60
|
+
sudo apt-get install -y libxml2-dev libxslt1-dev build-essential
|
57
61
|
|
58
|
-
- name:
|
62
|
+
- name: Install system dependencies (macOS)
|
63
|
+
if: matrix.platform == 'macos-latest'
|
59
64
|
run: |
|
60
|
-
|
65
|
+
brew install libxml2 libxslt
|
61
66
|
|
62
|
-
- name:
|
63
|
-
|
67
|
+
- name: Install system dependencies (Windows)
|
68
|
+
if: matrix.platform == 'windows-latest'
|
69
|
+
run: |
|
70
|
+
# Windows dependencies are typically handled by gem installations
|
71
|
+
echo "Windows dependencies handled by gems"
|
64
72
|
|
65
|
-
- name:
|
73
|
+
- name: Install gems
|
66
74
|
run: |
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
75
|
+
bundle install
|
76
|
+
|
77
|
+
- name: List available serializers
|
78
|
+
run: bundle exec serialbench list
|
71
79
|
|
72
|
-
- name:
|
80
|
+
- name: Run benchmarks
|
81
|
+
run: |
|
82
|
+
if [ "${{ matrix.platform }}" = "macos-latest" ]; then
|
83
|
+
# macOS can handle full benchmarks
|
84
|
+
bundle exec serialbench benchmark \
|
85
|
+
--formats xml json yaml toml \
|
86
|
+
--iterations 5 \
|
87
|
+
--warmup 2
|
88
|
+
else
|
89
|
+
# Windows and Ubuntu use short configuration for memory efficiency
|
90
|
+
bundle exec serialbench benchmark \
|
91
|
+
--config config/short.yml
|
92
|
+
fi
|
93
|
+
shell: bash
|
94
|
+
|
95
|
+
- name: Run tests to verify functionality
|
96
|
+
run: bundle exec rspec --format documentation
|
97
|
+
|
98
|
+
- name: Upload benchmark results
|
73
99
|
uses: actions/upload-artifact@v4
|
74
100
|
with:
|
75
|
-
name: benchmark-results-ruby-${{ matrix.ruby-version }}
|
76
|
-
path: results
|
101
|
+
name: benchmark-results-${{ matrix.platform }}-ruby-${{ matrix.ruby-version }}
|
102
|
+
path: results/
|
77
103
|
retention-days: 30
|
78
104
|
|
105
|
+
# Merge results and deploy to GitHub Pages
|
79
106
|
merge-and-deploy:
|
80
107
|
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
|
81
108
|
runs-on: ubuntu-latest
|
82
109
|
needs: [setup, benchmark]
|
83
110
|
|
84
111
|
steps:
|
85
|
-
-
|
112
|
+
- name: Checkout repository
|
113
|
+
uses: actions/checkout@v4
|
86
114
|
|
87
115
|
- name: Set up Ruby (for report generation)
|
88
116
|
uses: ruby/setup-ruby@v1
|
@@ -93,24 +121,68 @@ jobs:
|
|
93
121
|
- name: Install system dependencies
|
94
122
|
run: |
|
95
123
|
sudo apt-get update
|
96
|
-
sudo apt-get install -y libxml2-dev libxslt1-dev
|
124
|
+
sudo apt-get install -y libxml2-dev libxslt1-dev build-essential
|
125
|
+
|
126
|
+
- name: Install gems
|
127
|
+
run: bundle install
|
97
128
|
|
98
129
|
- name: Download all benchmark artifacts
|
99
130
|
uses: actions/download-artifact@v4
|
100
131
|
with:
|
101
|
-
pattern: benchmark-results
|
132
|
+
pattern: benchmark-results-*
|
102
133
|
path: artifacts/
|
103
134
|
|
104
|
-
- name:
|
135
|
+
- name: List downloaded artifacts
|
136
|
+
run: |
|
137
|
+
echo "Downloaded artifacts:"
|
138
|
+
find artifacts/ -type f -name "*.json" -o -name "*.html" | head -20
|
139
|
+
|
140
|
+
- name: Generate comprehensive GitHub Pages
|
105
141
|
run: |
|
106
142
|
mkdir -p docs
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
for
|
111
|
-
|
143
|
+
|
144
|
+
# Find all result directories
|
145
|
+
RESULT_DIRS=""
|
146
|
+
for dir in artifacts/benchmark-results-*/; do
|
147
|
+
if [ -d "$dir" ]; then
|
148
|
+
RESULT_DIRS="$RESULT_DIRS $dir"
|
149
|
+
fi
|
112
150
|
done
|
113
|
-
|
151
|
+
|
152
|
+
echo "Processing result directories: $RESULT_DIRS"
|
153
|
+
|
154
|
+
# Generate GitHub Pages from all results
|
155
|
+
if [ -n "$RESULT_DIRS" ]; then
|
156
|
+
bundle exec serialbench github_pages $RESULT_DIRS docs/
|
157
|
+
else
|
158
|
+
echo "No result directories found, creating placeholder page"
|
159
|
+
echo "<html><body><h1>No benchmark results available</h1></body></html>" > docs/index.html
|
160
|
+
fi
|
161
|
+
|
162
|
+
- name: Create platform comparison summary
|
163
|
+
run: |
|
164
|
+
# Create a summary of cross-platform results
|
165
|
+
cat > docs/platform-summary.md << 'EOF'
|
166
|
+
# Cross-Platform Benchmark Summary
|
167
|
+
|
168
|
+
This page contains benchmark results from multiple platforms and Ruby versions:
|
169
|
+
|
170
|
+
## Platforms Tested
|
171
|
+
- **Ubuntu Latest**: Linux x86_64 environment
|
172
|
+
- **macOS Latest**: Apple Silicon and Intel Mac environment
|
173
|
+
- **Windows Latest**: Windows Server environment
|
174
|
+
|
175
|
+
## Ruby Versions
|
176
|
+
- Ruby 3.1, 3.2, 3.3, 3.4
|
177
|
+
|
178
|
+
## Serialization Libraries
|
179
|
+
- **XML**: REXML, Ox, Nokogiri, Oga, LibXML
|
180
|
+
- **JSON**: JSON, Oj, RapidJSON, YAJL
|
181
|
+
- **YAML**: Psych, Syck
|
182
|
+
- **TOML**: TOML-RB, Tomlib
|
183
|
+
|
184
|
+
Results show performance variations across different operating systems and architectures.
|
185
|
+
EOF
|
114
186
|
|
115
187
|
- name: Setup Pages
|
116
188
|
uses: actions/configure-pages@v4
|
@@ -123,3 +195,82 @@ jobs:
|
|
123
195
|
- name: Deploy to GitHub Pages
|
124
196
|
id: deployment
|
125
197
|
uses: actions/deploy-pages@v4
|
198
|
+
|
199
|
+
# Performance comparison analysis
|
200
|
+
performance-analysis:
|
201
|
+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
|
202
|
+
runs-on: ubuntu-latest
|
203
|
+
needs: [benchmark]
|
204
|
+
|
205
|
+
steps:
|
206
|
+
- name: Checkout repository
|
207
|
+
uses: actions/checkout@v4
|
208
|
+
|
209
|
+
- name: Download all benchmark results
|
210
|
+
uses: actions/download-artifact@v4
|
211
|
+
with:
|
212
|
+
pattern: benchmark-results-*-ruby-*
|
213
|
+
path: analysis/
|
214
|
+
|
215
|
+
- name: Set up Ruby for analysis
|
216
|
+
uses: ruby/setup-ruby@v1
|
217
|
+
with:
|
218
|
+
ruby-version: '3.3'
|
219
|
+
bundler-cache: true
|
220
|
+
|
221
|
+
- name: Install dependencies
|
222
|
+
run: |
|
223
|
+
sudo apt-get update
|
224
|
+
sudo apt-get install -y libxml2-dev libxslt1-dev
|
225
|
+
bundle install
|
226
|
+
|
227
|
+
- name: Generate performance analysis
|
228
|
+
run: |
|
229
|
+
bundle exec serialbench analyze_performance analysis/benchmark-results-*/ performance_analysis.json
|
230
|
+
|
231
|
+
- name: Generate platform comparison report
|
232
|
+
run: |
|
233
|
+
bundle exec serialbench platform_comparison performance_analysis.json platform_comparison.json
|
234
|
+
|
235
|
+
- name: Upload performance analysis
|
236
|
+
uses: actions/upload-artifact@v4
|
237
|
+
with:
|
238
|
+
name: performance-analysis
|
239
|
+
path: |
|
240
|
+
performance_analysis.json
|
241
|
+
platform_comparison.json
|
242
|
+
retention-days: 90
|
243
|
+
|
244
|
+
# Summary job
|
245
|
+
summary:
|
246
|
+
runs-on: ubuntu-latest
|
247
|
+
needs: [setup, benchmark, merge-and-deploy, performance-analysis]
|
248
|
+
if: always()
|
249
|
+
steps:
|
250
|
+
- name: Generate workflow summary
|
251
|
+
run: |
|
252
|
+
echo "## Cross-Platform Benchmark Summary" >> $GITHUB_STEP_SUMMARY
|
253
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
254
|
+
echo "**Benchmark Status**: ${{ needs.benchmark.result }}" >> $GITHUB_STEP_SUMMARY
|
255
|
+
echo "**Deploy Status**: ${{ needs.merge-and-deploy.result }}" >> $GITHUB_STEP_SUMMARY
|
256
|
+
echo "**Analysis Status**: ${{ needs.performance-analysis.result }}" >> $GITHUB_STEP_SUMMARY
|
257
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
258
|
+
echo "### Platforms Tested" >> $GITHUB_STEP_SUMMARY
|
259
|
+
echo "- Ubuntu Latest (Linux x86_64)" >> $GITHUB_STEP_SUMMARY
|
260
|
+
echo "- macOS Latest (Apple Silicon/Intel)" >> $GITHUB_STEP_SUMMARY
|
261
|
+
echo "- Windows Latest (Windows Server)" >> $GITHUB_STEP_SUMMARY
|
262
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
263
|
+
echo "### Ruby Versions" >> $GITHUB_STEP_SUMMARY
|
264
|
+
echo "- Ruby 3.1, 3.2, 3.3, 3.4" >> $GITHUB_STEP_SUMMARY
|
265
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
266
|
+
echo "### Serialization Libraries" >> $GITHUB_STEP_SUMMARY
|
267
|
+
echo "- **XML**: REXML, Ox, Nokogiri, Oga, LibXML" >> $GITHUB_STEP_SUMMARY
|
268
|
+
echo "- **JSON**: JSON, Oj, RapidJSON, YAJL" >> $GITHUB_STEP_SUMMARY
|
269
|
+
echo "- **YAML**: Psych, Syck" >> $GITHUB_STEP_SUMMARY
|
270
|
+
echo "- **TOML**: TOML-RB, Tomlib" >> $GITHUB_STEP_SUMMARY
|
271
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
272
|
+
if [ "${{ github.ref }}" == "refs/heads/main" ] || [ "${{ github.ref }}" == "refs/heads/master" ]; then
|
273
|
+
echo "### Results" >> $GITHUB_STEP_SUMMARY
|
274
|
+
echo "📊 [View Interactive Results](https://metanorma.github.io/serialbench/)" >> $GITHUB_STEP_SUMMARY
|
275
|
+
echo "📈 Performance analysis and platform comparison available in artifacts" >> $GITHUB_STEP_SUMMARY
|
276
|
+
fi
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
name:
|
1
|
+
name: ci
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
@@ -40,7 +40,7 @@ jobs:
|
|
40
40
|
sudo apt-get install -y libxml2-dev libxslt1-dev
|
41
41
|
|
42
42
|
- name: List available serializers
|
43
|
-
run: bundle exec
|
43
|
+
run: bundle exec serialbench list
|
44
44
|
|
45
45
|
- name: Run tests
|
46
46
|
run: bundle exec rspec
|
@@ -48,7 +48,7 @@ jobs:
|
|
48
48
|
- name: Run quick benchmark test
|
49
49
|
run: |
|
50
50
|
# Run a quick benchmark to ensure the CLI works
|
51
|
-
bundle exec
|
51
|
+
bundle exec serialbench benchmark --formats xml --data-sizes small --iterations 5
|
52
52
|
|
53
53
|
lint:
|
54
54
|
runs-on: ubuntu-latest
|
@@ -0,0 +1,272 @@
|
|
1
|
+
name: docker
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main, master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ main, master ]
|
8
|
+
schedule:
|
9
|
+
# Build Docker images weekly on Saturdays at 1 AM UTC
|
10
|
+
- cron: '0 1 * * 6'
|
11
|
+
workflow_dispatch:
|
12
|
+
# Allow manual triggering
|
13
|
+
|
14
|
+
permissions:
|
15
|
+
contents: read
|
16
|
+
packages: write
|
17
|
+
|
18
|
+
env:
|
19
|
+
REGISTRY: ghcr.io
|
20
|
+
IMAGE_NAME: ${{ github.repository }}/serialbench
|
21
|
+
|
22
|
+
jobs:
|
23
|
+
setup:
|
24
|
+
runs-on: ubuntu-latest
|
25
|
+
outputs:
|
26
|
+
ruby-versions: ${{ steps.set-matrix.outputs.ruby-versions }}
|
27
|
+
should-build: ${{ steps.check-changes.outputs.should-build }}
|
28
|
+
steps:
|
29
|
+
- name: Checkout repository
|
30
|
+
uses: actions/checkout@v4
|
31
|
+
with:
|
32
|
+
fetch-depth: 2
|
33
|
+
|
34
|
+
- name: Set Ruby version matrix
|
35
|
+
id: set-matrix
|
36
|
+
run: |
|
37
|
+
echo 'ruby-versions=["3.1", "3.2", "3.3", "3.4"]' >> $GITHUB_OUTPUT
|
38
|
+
|
39
|
+
- name: Check if Docker build is needed
|
40
|
+
id: check-changes
|
41
|
+
run: |
|
42
|
+
# Always build on workflow_dispatch or schedule
|
43
|
+
if [ "${{ github.event_name }}" == "workflow_dispatch" ] || [ "${{ github.event_name }}" == "schedule" ]; then
|
44
|
+
echo "should-build=true" >> $GITHUB_OUTPUT
|
45
|
+
echo "Manual or scheduled build triggered"
|
46
|
+
exit 0
|
47
|
+
fi
|
48
|
+
|
49
|
+
# Check if code has changed since last commit
|
50
|
+
if git diff --name-only HEAD~1 | grep -E '\.(rb|gemspec|yml|yaml)$|Gemfile|Dockerfile' > /dev/null; then
|
51
|
+
echo "should-build=true" >> $GITHUB_OUTPUT
|
52
|
+
echo "Code changes detected, will build new Docker images"
|
53
|
+
else
|
54
|
+
echo "should-build=false" >> $GITHUB_OUTPUT
|
55
|
+
echo "No relevant code changes, skipping Docker build"
|
56
|
+
fi
|
57
|
+
|
58
|
+
build-docker-images:
|
59
|
+
runs-on: ubuntu-latest
|
60
|
+
needs: setup
|
61
|
+
if: needs.setup.outputs.should-build == 'true'
|
62
|
+
strategy:
|
63
|
+
matrix:
|
64
|
+
ruby-version: ${{ fromJson(needs.setup.outputs.ruby-versions) }}
|
65
|
+
fail-fast: false
|
66
|
+
|
67
|
+
steps:
|
68
|
+
- name: Checkout repository
|
69
|
+
uses: actions/checkout@v4
|
70
|
+
|
71
|
+
- name: Set up Docker Buildx
|
72
|
+
uses: docker/setup-buildx-action@v3
|
73
|
+
|
74
|
+
- name: Log in to Container Registry
|
75
|
+
uses: docker/login-action@v3
|
76
|
+
with:
|
77
|
+
registry: ${{ env.REGISTRY }}
|
78
|
+
username: ${{ github.actor }}
|
79
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
80
|
+
|
81
|
+
- name: Extract metadata
|
82
|
+
id: meta
|
83
|
+
uses: docker/metadata-action@v5
|
84
|
+
with:
|
85
|
+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
86
|
+
tags: |
|
87
|
+
type=ref,event=branch,suffix=-ruby-${{ matrix.ruby-version }}
|
88
|
+
type=ref,event=pr,prefix=pr-,suffix=-ruby-${{ matrix.ruby-version }}
|
89
|
+
type=sha,suffix=-ruby-${{ matrix.ruby-version }}
|
90
|
+
type=raw,value=latest,suffix=-ruby-${{ matrix.ruby-version }},enable={{is_default_branch}}
|
91
|
+
|
92
|
+
- name: Build and push Docker image
|
93
|
+
uses: docker/build-push-action@v5
|
94
|
+
with:
|
95
|
+
context: .
|
96
|
+
file: docker/Dockerfile.ubuntu
|
97
|
+
build-args: |
|
98
|
+
RUBY_VERSION=${{ matrix.ruby-version }}
|
99
|
+
push: true
|
100
|
+
tags: ${{ steps.meta.outputs.tags }}
|
101
|
+
labels: ${{ steps.meta.outputs.labels }}
|
102
|
+
cache-from: type=gha
|
103
|
+
cache-to: type=gha,mode=max
|
104
|
+
platforms: linux/amd64,linux/arm64
|
105
|
+
|
106
|
+
- name: Test Docker image
|
107
|
+
run: |
|
108
|
+
# Get the first tag from the metadata output
|
109
|
+
IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
|
110
|
+
echo "Testing image: $IMAGE_TAG"
|
111
|
+
|
112
|
+
# Test that the image works correctly
|
113
|
+
docker run --rm "$IMAGE_TAG" \
|
114
|
+
bundle exec serialbench list
|
115
|
+
|
116
|
+
- name: Run basic functionality test
|
117
|
+
run: |
|
118
|
+
# Get the first tag from the metadata output
|
119
|
+
IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
|
120
|
+
echo "Testing functionality with image: $IMAGE_TAG"
|
121
|
+
|
122
|
+
# Create a temporary results directory
|
123
|
+
mkdir -p test-results
|
124
|
+
|
125
|
+
# Run a quick benchmark test
|
126
|
+
docker run --rm \
|
127
|
+
-v $(pwd)/test-results:/app/results \
|
128
|
+
"$IMAGE_TAG" \
|
129
|
+
bundle exec serialbench benchmark \
|
130
|
+
--formats json \
|
131
|
+
--iterations 1 \
|
132
|
+
--warmup 0 \
|
133
|
+
--output-dir /app/results
|
134
|
+
|
135
|
+
# Verify results were generated
|
136
|
+
ls -la test-results/
|
137
|
+
|
138
|
+
# Clean up
|
139
|
+
rm -rf test-results
|
140
|
+
|
141
|
+
test-docker-images:
|
142
|
+
runs-on: ubuntu-latest
|
143
|
+
needs: [setup, build-docker-images]
|
144
|
+
if: needs.setup.outputs.should-build == 'true'
|
145
|
+
strategy:
|
146
|
+
matrix:
|
147
|
+
ruby-version: ${{ fromJson(needs.setup.outputs.ruby-versions) }}
|
148
|
+
fail-fast: false
|
149
|
+
|
150
|
+
steps:
|
151
|
+
- name: Checkout repository
|
152
|
+
uses: actions/checkout@v4
|
153
|
+
|
154
|
+
- name: Set up Docker Buildx
|
155
|
+
uses: docker/setup-buildx-action@v3
|
156
|
+
|
157
|
+
- name: Log in to Container Registry
|
158
|
+
uses: docker/login-action@v3
|
159
|
+
with:
|
160
|
+
registry: ${{ env.REGISTRY }}
|
161
|
+
username: ${{ github.actor }}
|
162
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
163
|
+
|
164
|
+
- name: Extract metadata for testing
|
165
|
+
id: meta
|
166
|
+
uses: docker/metadata-action@v5
|
167
|
+
with:
|
168
|
+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
169
|
+
tags: |
|
170
|
+
type=ref,event=branch,suffix=-ruby-${{ matrix.ruby-version }}
|
171
|
+
type=ref,event=pr,prefix=pr-,suffix=-ruby-${{ matrix.ruby-version }}
|
172
|
+
type=sha,suffix=-ruby-${{ matrix.ruby-version }}
|
173
|
+
type=raw,value=latest,suffix=-ruby-${{ matrix.ruby-version }},enable={{is_default_branch}}
|
174
|
+
|
175
|
+
- name: Pull Docker image
|
176
|
+
run: |
|
177
|
+
IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
|
178
|
+
echo "Pulling image: $IMAGE_TAG"
|
179
|
+
docker pull "$IMAGE_TAG"
|
180
|
+
|
181
|
+
- name: Test serializer availability
|
182
|
+
run: |
|
183
|
+
IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
|
184
|
+
echo "Testing Ruby ${{ matrix.ruby-version }} container: $IMAGE_TAG"
|
185
|
+
docker run --rm "$IMAGE_TAG" \
|
186
|
+
bundle exec ruby -e "
|
187
|
+
require 'serialbench'
|
188
|
+
puts 'Available serializers:'
|
189
|
+
Serialbench::Serializers.available.each do |s|
|
190
|
+
serializer = s.new
|
191
|
+
puts \" #{serializer.format}: #{serializer.name} v#{serializer.version}\"
|
192
|
+
end
|
193
|
+
"
|
194
|
+
|
195
|
+
- name: Run comprehensive tests
|
196
|
+
run: |
|
197
|
+
IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
|
198
|
+
echo "Running tests with image: $IMAGE_TAG"
|
199
|
+
docker run --rm "$IMAGE_TAG" \
|
200
|
+
bundle exec rspec --format progress
|
201
|
+
|
202
|
+
- name: Test benchmark execution
|
203
|
+
run: |
|
204
|
+
IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
|
205
|
+
echo "Testing benchmark execution with image: $IMAGE_TAG"
|
206
|
+
mkdir -p docker-test-results
|
207
|
+
|
208
|
+
# Run a comprehensive but quick benchmark
|
209
|
+
docker run --rm \
|
210
|
+
-v $(pwd)/docker-test-results:/app/results \
|
211
|
+
"$IMAGE_TAG" \
|
212
|
+
bundle exec serialbench benchmark \
|
213
|
+
--formats xml json yaml toml \
|
214
|
+
--iterations 2 \
|
215
|
+
--warmup 1 \
|
216
|
+
--output-dir /app/results
|
217
|
+
|
218
|
+
# Verify all expected files were created
|
219
|
+
echo "Generated files:"
|
220
|
+
find docker-test-results -type f -name "*.json" -o -name "*.html" -o -name "*.csv"
|
221
|
+
|
222
|
+
# Clean up
|
223
|
+
rm -rf docker-test-results
|
224
|
+
|
225
|
+
cleanup:
|
226
|
+
runs-on: ubuntu-latest
|
227
|
+
needs: [setup, build-docker-images, test-docker-images]
|
228
|
+
if: always() && github.event_name != 'pull_request'
|
229
|
+
steps:
|
230
|
+
- name: Log in to Container Registry
|
231
|
+
uses: docker/login-action@v3
|
232
|
+
with:
|
233
|
+
registry: ${{ env.REGISTRY }}
|
234
|
+
username: ${{ github.actor }}
|
235
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
236
|
+
|
237
|
+
- name: Clean up old Docker images
|
238
|
+
run: |
|
239
|
+
echo "Docker image cleanup would be implemented here"
|
240
|
+
# Note: Actual cleanup requires additional GitHub API calls
|
241
|
+
# For now, we rely on GitHub's automatic cleanup policies
|
242
|
+
echo "Current images are tagged and will be managed by GitHub's retention policies"
|
243
|
+
|
244
|
+
summary:
|
245
|
+
runs-on: ubuntu-latest
|
246
|
+
needs: [setup, build-docker-images, test-docker-images]
|
247
|
+
if: always()
|
248
|
+
steps:
|
249
|
+
- name: Build Summary
|
250
|
+
run: |
|
251
|
+
echo "## Docker Build Summary" >> $GITHUB_STEP_SUMMARY
|
252
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
253
|
+
echo "**Build Status**: ${{ needs.build-docker-images.result }}" >> $GITHUB_STEP_SUMMARY
|
254
|
+
echo "**Test Status**: ${{ needs.test-docker-images.result }}" >> $GITHUB_STEP_SUMMARY
|
255
|
+
echo "**Should Build**: ${{ needs.setup.outputs.should-build }}" >> $GITHUB_STEP_SUMMARY
|
256
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
257
|
+
echo "### Available Images" >> $GITHUB_STEP_SUMMARY
|
258
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
259
|
+
echo "| Ruby Version | Image Tag |" >> $GITHUB_STEP_SUMMARY
|
260
|
+
echo "|--------------|-----------|" >> $GITHUB_STEP_SUMMARY
|
261
|
+
echo "| 3.1 | \`ghcr.io/metanorma/serialbench:main-ruby-3.1\` |" >> $GITHUB_STEP_SUMMARY
|
262
|
+
echo "| 3.2 | \`ghcr.io/metanorma/serialbench:main-ruby-3.2\` |" >> $GITHUB_STEP_SUMMARY
|
263
|
+
echo "| 3.3 | \`ghcr.io/metanorma/serialbench:main-ruby-3.3\` |" >> $GITHUB_STEP_SUMMARY
|
264
|
+
echo "| 3.4 | \`ghcr.io/metanorma/serialbench:main-ruby-3.4\` |" >> $GITHUB_STEP_SUMMARY
|
265
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
266
|
+
echo "### Usage" >> $GITHUB_STEP_SUMMARY
|
267
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
268
|
+
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
|
269
|
+
echo "# Pull and run latest Ruby 3.3 container" >> $GITHUB_STEP_SUMMARY
|
270
|
+
echo "docker pull ghcr.io/metanorma/serialbench:main-ruby-3.3" >> $GITHUB_STEP_SUMMARY
|
271
|
+
echo "docker run --rm -v \$(pwd)/results:/app/results ghcr.io/metanorma/serialbench:main-ruby-3.3" >> $GITHUB_STEP_SUMMARY
|
272
|
+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: rake
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master, main ]
|
8
|
+
tags: [ v* ]
|
9
|
+
pull_request:
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
rake:
|
13
|
+
uses: metanorma/ci/.github/workflows/generic-rake.yml@main
|
14
|
+
secrets:
|
15
|
+
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: release
|
4
|
+
|
5
|
+
on:
|
6
|
+
workflow_dispatch:
|
7
|
+
inputs:
|
8
|
+
next_version:
|
9
|
+
description: |
|
10
|
+
Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc).
|
11
|
+
Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version
|
12
|
+
required: true
|
13
|
+
default: 'skip'
|
14
|
+
repository_dispatch:
|
15
|
+
types: [ do-release ]
|
16
|
+
|
17
|
+
jobs:
|
18
|
+
release:
|
19
|
+
uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
|
20
|
+
with:
|
21
|
+
next_version: ${{ github.event.inputs.next_version }}
|
22
|
+
secrets:
|
23
|
+
rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
|
24
|
+
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
25
|
+
|
data/Gemfile
CHANGED
@@ -2,33 +2,9 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
group :benchmarking do
|
12
|
-
gem 'csv', '~> 3.2' # Required from Ruby 3.4+
|
13
|
-
|
14
|
-
# XML libraries
|
15
|
-
gem 'libxml-ruby', '~> 4.0'
|
16
|
-
gem 'nokogiri', '~> 1.15'
|
17
|
-
gem 'oga', '~> 3.4'
|
18
|
-
gem 'ox', '~> 2.14'
|
19
|
-
gem 'rexml', '~> 3.2' # Required from Ruby 3.4+
|
20
|
-
|
21
|
-
# JSON libraries
|
22
|
-
gem 'json', '~> 2.6' # Built-in but explicit version
|
23
|
-
gem 'oj', '~> 3.16'
|
24
|
-
gem 'yajl-ruby', '~> 1.4'
|
25
|
-
|
26
|
-
# TOML libraries
|
27
|
-
gem 'tomlib', '~> 0.6'
|
28
|
-
gem 'toml-rb', '~> 2.2'
|
29
|
-
|
30
|
-
# Benchmarking and reporting tools
|
31
|
-
gem 'asciidoctor', '~> 2.0'
|
32
|
-
gem 'benchmark-ips', '~> 2.12'
|
33
|
-
gem 'memory_profiler', '~> 1.0'
|
34
|
-
end
|
5
|
+
gem 'lutaml-model', git: 'https://github.com/lutaml/lutaml-model.git'
|
6
|
+
gem 'rake'
|
7
|
+
gem 'rspec'
|
8
|
+
gem 'rubocop'
|
9
|
+
gem 'rubocop-performance'
|
10
|
+
gem 'rubocop-rspec'
|