serialbench 0.1.2 → 0.1.3

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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/benchmark.yml +273 -228
  3. data/.github/workflows/rake.yml +11 -0
  4. data/.github/workflows/windows-debug.yml +171 -0
  5. data/.gitignore +32 -0
  6. data/.rubocop.yml +1 -0
  7. data/.rubocop_todo.yml +274 -0
  8. data/Gemfile +13 -1
  9. data/README.adoc +36 -0
  10. data/data/schemas/result.yml +29 -0
  11. data/docs/PLATFORM_VALIDATION_FIX.md +79 -0
  12. data/docs/SYCK_YAML_FIX.md +91 -0
  13. data/docs/WEBSITE_COMPLETION_PLAN.md +440 -0
  14. data/docs/WINDOWS_LIBXML_FIX.md +136 -0
  15. data/docs/WINDOWS_SETUP.md +122 -0
  16. data/lib/serialbench/benchmark_runner.rb +3 -3
  17. data/lib/serialbench/cli/benchmark_cli.rb +74 -1
  18. data/lib/serialbench/cli/environment_cli.rb +3 -3
  19. data/lib/serialbench/cli/resultset_cli.rb +72 -26
  20. data/lib/serialbench/cli/ruby_build_cli.rb +75 -88
  21. data/lib/serialbench/cli/validate_cli.rb +88 -0
  22. data/lib/serialbench/cli.rb +6 -2
  23. data/lib/serialbench/config_manager.rb +15 -26
  24. data/lib/serialbench/models/benchmark_config.rb +12 -0
  25. data/lib/serialbench/models/benchmark_result.rb +39 -3
  26. data/lib/serialbench/models/environment_config.rb +3 -2
  27. data/lib/serialbench/models/platform.rb +56 -4
  28. data/lib/serialbench/models/result.rb +28 -1
  29. data/lib/serialbench/models/result_set.rb +8 -0
  30. data/lib/serialbench/ruby_build_manager.rb +19 -23
  31. data/lib/serialbench/runners/asdf_runner.rb +1 -1
  32. data/lib/serialbench/runners/docker_runner.rb +2 -4
  33. data/lib/serialbench/runners/local_runner.rb +71 -0
  34. data/lib/serialbench/serializers/base_serializer.rb +1 -1
  35. data/lib/serialbench/serializers/json/rapidjson_serializer.rb +1 -1
  36. data/lib/serialbench/serializers/toml/base_toml_serializer.rb +0 -2
  37. data/lib/serialbench/serializers/toml/toml_rb_serializer.rb +1 -1
  38. data/lib/serialbench/serializers/toml/tomlib_serializer.rb +1 -1
  39. data/lib/serialbench/serializers/xml/libxml_serializer.rb +4 -8
  40. data/lib/serialbench/serializers/xml/nokogiri_serializer.rb +2 -2
  41. data/lib/serialbench/serializers/xml/oga_serializer.rb +4 -8
  42. data/lib/serialbench/serializers/xml/ox_serializer.rb +2 -2
  43. data/lib/serialbench/serializers/xml/rexml_serializer.rb +3 -3
  44. data/lib/serialbench/serializers/yaml/psych_serializer.rb +1 -1
  45. data/lib/serialbench/serializers/yaml/syck_serializer.rb +1 -1
  46. data/lib/serialbench/serializers.rb +2 -2
  47. data/lib/serialbench/site_generator.rb +180 -2
  48. data/lib/serialbench/templates/assets/css/format_based.css +1 -53
  49. data/lib/serialbench/templates/assets/css/themes.css +5 -4
  50. data/lib/serialbench/templates/assets/js/chart_helpers.js +44 -14
  51. data/lib/serialbench/templates/assets/js/dashboard.js +14 -15
  52. data/lib/serialbench/templates/format_based.liquid +480 -252
  53. data/lib/serialbench/version.rb +1 -1
  54. data/lib/serialbench/yaml_validator.rb +36 -0
  55. data/serialbench.gemspec +11 -2
  56. metadata +34 -23
  57. data/.github/workflows/ci.yml +0 -74
  58. data/.github/workflows/docker.yml +0 -272
@@ -0,0 +1,171 @@
1
+ name: Windows Debug
2
+
3
+ on:
4
+ push:
5
+ branches: [ master, main ]
6
+ paths:
7
+ - '.github/workflows/windows-debug.yml'
8
+ pull_request:
9
+ paths:
10
+ - '.github/workflows/windows-debug.yml'
11
+ workflow_dispatch:
12
+
13
+ jobs:
14
+ test-libxml2-install:
15
+ runs-on: windows-latest
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby: ['3.1', '3.4']
20
+ method: ['vcpkg', 'msys2', 'direct']
21
+
22
+ name: Test ${{ matrix.method }} on Ruby ${{ matrix.ruby }}
23
+
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+
27
+ - name: Set up Ruby
28
+ uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby }}
31
+
32
+ - name: Install via vcpkg
33
+ if: matrix.method == 'vcpkg'
34
+ shell: powershell
35
+ run: |
36
+ Write-Host "Installing libxml2 via vcpkg..."
37
+ vcpkg install libxml2:x64-windows
38
+ vcpkg integrate install
39
+
40
+ # Find the libxml2 installation
41
+ $vcpkgRoot = "C:\vcpkg"
42
+ $libxml2Path = Join-Path $vcpkgRoot "installed\x64-windows"
43
+
44
+ Write-Host "libxml2 installed at: $libxml2Path"
45
+
46
+ # Set environment variables
47
+ echo "LIBXML2_INCLUDE=$libxml2Path\include" >> $env:GITHUB_ENV
48
+ echo "LIBXML2_LIB=$libxml2Path\lib" >> $env:GITHUB_ENV
49
+ echo "PKG_CONFIG_PATH=$libxml2Path\lib\pkgconfig" >> $env:GITHUB_ENV
50
+
51
+ # Add to PATH
52
+ $currentPath = [Environment]::GetEnvironmentVariable("PATH", "Process")
53
+ $newPath = "$libxml2Path\bin;$currentPath"
54
+ echo "$newPath" >> $env:GITHUB_PATH
55
+
56
+ # Verify installation
57
+ Get-ChildItem -Path $libxml2Path -Recurse | Where-Object { $_.Name -like "*libxml*" } | Select-Object FullName
58
+
59
+ - name: Install via msys2
60
+ if: matrix.method == 'msys2'
61
+ shell: powershell
62
+ run: |
63
+ Write-Host "Installing libxml2 via msys2..."
64
+ choco install -y msys2
65
+
66
+ # Initialize msys2 and install libxml2
67
+ C:\tools\msys64\usr\bin\bash -lc "pacman -Syu --noconfirm"
68
+ C:\tools\msys64\usr\bin\bash -lc "pacman -S --noconfirm mingw-w64-x86_64-libxml2 mingw-w64-x86_64-pkg-config"
69
+
70
+ # Set environment variables
71
+ $msys2Root = "C:\tools\msys64\mingw64"
72
+ echo "LIBXML2_INCLUDE=$msys2Root\include\libxml2" >> $env:GITHUB_ENV
73
+ echo "LIBXML2_LIB=$msys2Root\lib" >> $env:GITHUB_ENV
74
+ echo "PKG_CONFIG_PATH=$msys2Root\lib\pkgconfig" >> $env:GITHUB_ENV
75
+
76
+ # Add to PATH
77
+ echo "$msys2Root\bin" >> $env:GITHUB_PATH
78
+
79
+ # Verify installation
80
+ Get-ChildItem -Path $msys2Root -Recurse | Where-Object { $_.Name -like "*libxml*" } | Select-Object FullName
81
+
82
+ - name: Install via direct download
83
+ if: matrix.method == 'direct'
84
+ shell: powershell
85
+ run: |
86
+ Write-Host "Installing libxml2 via direct download..."
87
+
88
+ # Download pre-built binaries from gnome.org
89
+ $downloadDir = "$env:TEMP\libxml2"
90
+ New-Item -ItemType Directory -Force -Path $downloadDir
91
+
92
+ # Download libxml2 and dependencies
93
+ $libxml2Url = "https://download.gnome.org/binaries/win64/libxml2/2.9/libxml2-2.9.14-x64_dll.zip"
94
+ $zlibUrl = "https://download.gnome.org/binaries/win64/dependencies/zlib-1.2.13-x64_dll.zip"
95
+ $iconvUrl = "https://download.gnome.org/binaries/win64/dependencies/libiconv-1.17-x64_dll.zip"
96
+
97
+ Invoke-WebRequest -Uri $libxml2Url -OutFile "$downloadDir\libxml2.zip"
98
+ Invoke-WebRequest -Uri $zlibUrl -OutFile "$downloadDir\zlib.zip"
99
+ Invoke-WebRequest -Uri $iconvUrl -OutFile "$downloadDir\iconv.zip"
100
+
101
+ # Extract archives
102
+ Expand-Archive -Path "$downloadDir\libxml2.zip" -DestinationPath "C:\libxml2" -Force
103
+ Expand-Archive -Path "$downloadDir\zlib.zip" -DestinationPath "C:\libxml2" -Force
104
+ Expand-Archive -Path "$downloadDir\iconv.zip" -DestinationPath "C:\libxml2" -Force
105
+
106
+ # Set environment variables
107
+ echo "LIBXML2_INCLUDE=C:\libxml2\include" >> $env:GITHUB_ENV
108
+ echo "LIBXML2_LIB=C:\libxml2\lib" >> $env:GITHUB_ENV
109
+
110
+ # Add to PATH
111
+ echo "C:\libxml2\bin" >> $env:GITHUB_PATH
112
+
113
+ # Verify installation
114
+ Get-ChildItem -Path "C:\libxml2" -Recurse | Where-Object { $_.Name -like "*libxml*" } | Select-Object FullName
115
+
116
+ - name: Verify pkg-config
117
+ shell: powershell
118
+ run: |
119
+ Write-Host "Checking for pkg-config..."
120
+ try {
121
+ $pkgConfigPath = Get-Command pkg-config -ErrorAction Stop
122
+ Write-Host "pkg-config found at: $($pkgConfigPath.Source)"
123
+ pkg-config --version
124
+ } catch {
125
+ Write-Host "pkg-config not found, installing pkgconfiglite..."
126
+ choco install -y pkgconfiglite
127
+ pkg-config --version
128
+ }
129
+
130
+ # Try to find libxml2 via pkg-config
131
+ Write-Host "`nSearching for libxml-2.0.pc..."
132
+ if ($env:PKG_CONFIG_PATH) {
133
+ Write-Host "PKG_CONFIG_PATH: $env:PKG_CONFIG_PATH"
134
+ pkg-config --list-all | Select-String libxml
135
+ }
136
+
137
+ - name: Install bundler
138
+ run: gem install bundler
139
+
140
+ - name: Try to install libxml-ruby gem
141
+ shell: powershell
142
+ continue-on-error: true
143
+ run: |
144
+ Write-Host "Attempting to install libxml-ruby..."
145
+
146
+ # Set additional environment variables for gem installation
147
+ if ($env:LIBXML2_INCLUDE) {
148
+ $env:CFLAGS = "-I$env:LIBXML2_INCLUDE"
149
+ $env:CPPFLAGS = "-I$env:LIBXML2_INCLUDE"
150
+ }
151
+ if ($env:LIBXML2_LIB) {
152
+ $env:LDFLAGS = "-L$env:LIBXML2_LIB"
153
+ }
154
+
155
+ gem install libxml-ruby --verbose
156
+
157
+ - name: Report results
158
+ if: always()
159
+ shell: powershell
160
+ run: |
161
+ Write-Host "`n=== Installation Method: ${{ matrix.method }} ==="
162
+ Write-Host "Ruby Version: ${{ matrix.ruby }}"
163
+ Write-Host "`nEnvironment Variables:"
164
+ Write-Host "LIBXML2_INCLUDE: $env:LIBXML2_INCLUDE"
165
+ Write-Host "LIBXML2_LIB: $env:LIBXML2_LIB"
166
+ Write-Host "PKG_CONFIG_PATH: $env:PKG_CONFIG_PATH"
167
+ Write-Host "`nPATH:"
168
+ $env:PATH -split ';' | ForEach-Object { Write-Host " $_" }
169
+
170
+ Write-Host "`nChecking for libxml2 files..."
171
+ Get-ChildItem C:\ -Recurse -ErrorAction SilentlyContinue -Include libxml2.dll,libxml2.lib,xml2-config.h 2>$null | Select-Object FullName
data/.gitignore ADDED
@@ -0,0 +1,32 @@
1
+ # RSpec
2
+ .rspec_status
3
+
4
+ # ASDF
5
+ .tool-versions
6
+
7
+ # Bundler
8
+ Gemfile.lock
9
+
10
+ # Generated sites
11
+ _site/
12
+ _site.bak/
13
+
14
+ # Gem builds
15
+ pkg/
16
+
17
+ # Benchmark results
18
+ results/
19
+
20
+ # macOS
21
+ .DS_Store
22
+
23
+ # Ruby LSP
24
+ .ruby-lsp/
25
+
26
+ # Editor files
27
+ *.swp
28
+ *.tmp
29
+ *.log
30
+
31
+ # Ruby version manager files
32
+ .ruby-version
data/.rubocop.yml ADDED
@@ -0,0 +1 @@
1
+ inherit_from: .rubocop_todo.yml
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,274 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2025-10-18 07:01:07 UTC using RuboCop version 1.76.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
12
+ # SupportedStyles: with_first_argument, with_fixed_indentation
13
+ Layout/ArgumentAlignment:
14
+ Exclude:
15
+ - 'lib/serialbench/config_manager.rb'
16
+
17
+ # Offense count: 4
18
+ # This cop supports safe autocorrection (--autocorrect).
19
+ # Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth.
20
+ # SupportedStyles: case, end
21
+ Layout/CaseIndentation:
22
+ Exclude:
23
+ - 'lib/serialbench/serializers/xml/libxml_serializer.rb'
24
+ - 'lib/serialbench/serializers/xml/oga_serializer.rb'
25
+
26
+ # Offense count: 2
27
+ # This cop supports safe autocorrection (--autocorrect).
28
+ Layout/ElseAlignment:
29
+ Exclude:
30
+ - 'lib/serialbench/serializers/xml/libxml_serializer.rb'
31
+ - 'lib/serialbench/serializers/xml/oga_serializer.rb'
32
+
33
+ # Offense count: 2
34
+ # This cop supports safe autocorrection (--autocorrect).
35
+ Layout/EmptyLineAfterGuardClause:
36
+ Exclude:
37
+ - 'lib/serialbench/config_manager.rb'
38
+
39
+ # Offense count: 3
40
+ # This cop supports safe autocorrection (--autocorrect).
41
+ Layout/EmptyLineAfterMagicComment:
42
+ Exclude:
43
+ - 'Gemfile'
44
+ - 'lib/serialbench/models/benchmark_config.rb'
45
+ - 'lib/serialbench/models/environment_config.rb'
46
+
47
+ # Offense count: 1
48
+ # This cop supports safe autocorrection (--autocorrect).
49
+ # Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, DefLikeMacros, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
50
+ Layout/EmptyLineBetweenDefs:
51
+ Exclude:
52
+ - 'lib/serialbench/serializers/toml/base_toml_serializer.rb'
53
+
54
+ # Offense count: 1
55
+ # This cop supports safe autocorrection (--autocorrect).
56
+ Layout/EmptyLines:
57
+ Exclude:
58
+ - 'lib/serialbench/serializers/toml/base_toml_serializer.rb'
59
+
60
+ # Offense count: 5
61
+ # This cop supports safe autocorrection (--autocorrect).
62
+ Layout/EmptyLinesAroundExceptionHandlingKeywords:
63
+ Exclude:
64
+ - 'lib/serialbench/cli/ruby_build_cli.rb'
65
+
66
+ # Offense count: 10
67
+ # This cop supports safe autocorrection (--autocorrect).
68
+ Layout/EmptyLinesAroundMethodBody:
69
+ Exclude:
70
+ - 'lib/serialbench/cli/ruby_build_cli.rb'
71
+ - 'lib/serialbench/config_manager.rb'
72
+
73
+ # Offense count: 2
74
+ # This cop supports safe autocorrection (--autocorrect).
75
+ # Configuration parameters: EnforcedStyleAlignWith, Severity.
76
+ # SupportedStylesAlignWith: keyword, variable, start_of_line
77
+ Layout/EndAlignment:
78
+ Exclude:
79
+ - 'lib/serialbench/serializers/xml/libxml_serializer.rb'
80
+ - 'lib/serialbench/serializers/xml/oga_serializer.rb'
81
+
82
+ # Offense count: 7
83
+ # This cop supports safe autocorrection (--autocorrect).
84
+ # Configuration parameters: EnforcedStyle.
85
+ # SupportedStyles: normal, indented_internal_methods
86
+ Layout/IndentationConsistency:
87
+ Exclude:
88
+ - 'lib/serialbench/config_manager.rb'
89
+ - 'lib/serialbench/serializers/xml/libxml_serializer.rb'
90
+ - 'lib/serialbench/serializers/xml/oga_serializer.rb'
91
+
92
+ # Offense count: 10
93
+ # This cop supports safe autocorrection (--autocorrect).
94
+ # Configuration parameters: Width, AllowedPatterns.
95
+ Layout/IndentationWidth:
96
+ Exclude:
97
+ - 'lib/serialbench/cli/ruby_build_cli.rb'
98
+ - 'lib/serialbench/serializers/xml/libxml_serializer.rb'
99
+ - 'lib/serialbench/serializers/xml/oga_serializer.rb'
100
+
101
+ # Offense count: 4
102
+ # This cop supports safe autocorrection (--autocorrect).
103
+ Layout/RescueEnsureAlignment:
104
+ Exclude:
105
+ - 'lib/serialbench/cli/ruby_build_cli.rb'
106
+
107
+ # Offense count: 11
108
+ # This cop supports safe autocorrection (--autocorrect).
109
+ # Configuration parameters: AllowInHeredoc.
110
+ Layout/TrailingWhitespace:
111
+ Exclude:
112
+ - 'lib/serialbench/cli/ruby_build_cli.rb'
113
+ - 'lib/serialbench/config_manager.rb'
114
+
115
+ # Offense count: 1
116
+ # Configuration parameters: AllowedParentClasses.
117
+ Lint/MissingSuper:
118
+ Exclude:
119
+ - 'lib/serialbench/serializers/xml/ox_serializer.rb'
120
+
121
+ # Offense count: 22
122
+ # This cop supports safe autocorrection (--autocorrect).
123
+ # Configuration parameters: AutoCorrect, AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
124
+ # NotImplementedExceptions: NotImplementedError
125
+ Lint/UnusedMethodArgument:
126
+ Enabled: false
127
+
128
+ # Offense count: 1
129
+ # This cop supports safe autocorrection (--autocorrect).
130
+ # Configuration parameters: AutoCorrect, ContextCreatingMethods, MethodCreatingMethods.
131
+ Lint/UselessAccessModifier:
132
+ Exclude:
133
+ - 'lib/serialbench/serializers/toml/base_toml_serializer.rb'
134
+
135
+ # Offense count: 2
136
+ # This cop supports safe autocorrection (--autocorrect).
137
+ # Configuration parameters: AutoCorrect.
138
+ Lint/UselessAssignment:
139
+ Exclude:
140
+ - 'lib/serialbench/cli/resultset_cli.rb'
141
+
142
+ # Offense count: 32
143
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
144
+ Metrics/AbcSize:
145
+ Max: 50
146
+
147
+ # Offense count: 13
148
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
149
+ # AllowedMethods: refine
150
+ Metrics/BlockLength:
151
+ Max: 449
152
+
153
+ # Offense count: 6
154
+ # Configuration parameters: CountComments, CountAsOne.
155
+ Metrics/ClassLength:
156
+ Max: 367
157
+
158
+ # Offense count: 4
159
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
160
+ Metrics/CyclomaticComplexity:
161
+ Max: 12
162
+
163
+ # Offense count: 60
164
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
165
+ Metrics/MethodLength:
166
+ Max: 63
167
+
168
+ # Offense count: 1
169
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
170
+ Metrics/PerceivedComplexity:
171
+ Max: 12
172
+
173
+ # Offense count: 1
174
+ Naming/AccessorMethodName:
175
+ Exclude:
176
+ - 'lib/serialbench/runners/asdf_runner.rb'
177
+
178
+ # Offense count: 37
179
+ # Configuration parameters: AllowedConstants.
180
+ Style/Documentation:
181
+ Enabled: false
182
+
183
+ # Offense count: 3
184
+ # This cop supports unsafe autocorrection (--autocorrect-all).
185
+ # Configuration parameters: EnforcedStyle.
186
+ # SupportedStyles: always, always_true, never
187
+ Style/FrozenStringLiteralComment:
188
+ Exclude:
189
+ - '**/*.arb'
190
+ - 'Gemfile'
191
+ - 'lib/serialbench/models/benchmark_config.rb'
192
+ - 'lib/serialbench/models/environment_config.rb'
193
+
194
+ # Offense count: 2
195
+ # This cop supports safe autocorrection (--autocorrect).
196
+ # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
197
+ Style/GuardClause:
198
+ Exclude:
199
+ - 'lib/serialbench/config_manager.rb'
200
+
201
+ # Offense count: 12
202
+ # This cop supports unsafe autocorrection (--autocorrect-all).
203
+ Style/IdenticalConditionalBranches:
204
+ Exclude:
205
+ - 'lib/serialbench/serializers/xml/libxml_serializer.rb'
206
+ - 'lib/serialbench/serializers/xml/oga_serializer.rb'
207
+
208
+ # Offense count: 10
209
+ # This cop supports safe autocorrection (--autocorrect).
210
+ Style/IfUnlessModifier:
211
+ Exclude:
212
+ - 'lib/serialbench/config_manager.rb'
213
+ - 'lib/serialbench/ruby_build_manager.rb'
214
+ - 'lib/serialbench/runners/docker_runner.rb'
215
+
216
+ # Offense count: 5
217
+ # This cop supports unsafe autocorrection (--autocorrect-all).
218
+ # Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
219
+ # SupportedStyles: predicate, comparison
220
+ Style/NumericPredicate:
221
+ Exclude:
222
+ - 'spec/**/*'
223
+ - 'lib/serialbench/benchmark_runner.rb'
224
+ - 'lib/serialbench/cli/ruby_build_cli.rb'
225
+ - 'lib/serialbench/serializers/xml/rexml_serializer.rb'
226
+
227
+ # Offense count: 4
228
+ # This cop supports safe autocorrection (--autocorrect).
229
+ Style/RedundantBegin:
230
+ Exclude:
231
+ - 'lib/serialbench/cli/ruby_build_cli.rb'
232
+
233
+ # Offense count: 5
234
+ # This cop supports unsafe autocorrection (--autocorrect-all).
235
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
236
+ # AllowedMethods: present?, blank?, presence, try, try!
237
+ Style/SafeNavigation:
238
+ Exclude:
239
+ - 'lib/serialbench/serializers/toml/tomlib_serializer.rb'
240
+ - 'lib/serialbench/serializers/xml/libxml_serializer.rb'
241
+ - 'lib/serialbench/serializers/xml/nokogiri_serializer.rb'
242
+ - 'lib/serialbench/serializers/xml/oga_serializer.rb'
243
+ - 'lib/serialbench/serializers/xml/ox_serializer.rb'
244
+
245
+ # Offense count: 1
246
+ # This cop supports unsafe autocorrection (--autocorrect-all).
247
+ # Configuration parameters: Mode.
248
+ Style/StringConcatenation:
249
+ Exclude:
250
+ - 'lib/serialbench/ruby_build_manager.rb'
251
+
252
+ # Offense count: 12
253
+ # This cop supports safe autocorrection (--autocorrect).
254
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
255
+ # SupportedStyles: single_quotes, double_quotes
256
+ Style/StringLiterals:
257
+ Exclude:
258
+ - 'lib/serialbench/cli/ruby_build_cli.rb'
259
+ - 'lib/serialbench/config_manager.rb'
260
+
261
+ # Offense count: 2
262
+ # This cop supports unsafe autocorrection (--autocorrect-all).
263
+ # Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
264
+ # AllowedMethods: define_method
265
+ Style/SymbolProc:
266
+ Exclude:
267
+ - 'lib/serialbench/serializers.rb'
268
+
269
+ # Offense count: 4
270
+ # This cop supports safe autocorrection (--autocorrect).
271
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
272
+ # URISchemes: http, https
273
+ Layout/LineLength:
274
+ Max: 163
data/Gemfile CHANGED
@@ -1,8 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
5
- gem 'lutaml-model', git: 'https://github.com/lutaml/lutaml-model.git'
7
+ # Platform-specific dependencies
8
+ # nokogiri and libxml-ruby fail to compile on Windows ARM due to libxml2
9
+ # compilation issues, but work on other platforms
10
+ unless Gem.win_platform? && RUBY_PLATFORM.include?('aarch64')
11
+ gem 'nokogiri'
12
+ gem 'libxml-ruby'
13
+ end
14
+
15
+ gem 'base64' # Required for Ruby 3.4+
16
+ gem 'lutaml-model', '~> 0.7'
17
+ gem 'octokit'
6
18
  gem 'rake'
7
19
  gem 'rspec'
8
20
  gem 'rubocop'
data/README.adoc CHANGED
@@ -125,6 +125,42 @@ $ sudo apt-get install libxml2-dev libxslt1-dev build-essential
125
125
  $ sudo yum install libxml2-devel libxslt-devel gcc gcc-c++
126
126
  ----
127
127
 
128
+ === GitHub API token (optional but recommended)
129
+
130
+ Serialbench fetches Ruby build definitions from the GitHub API. While this works
131
+ without authentication, GitHub imposes strict rate limits on unauthenticated
132
+ requests (60 requests per hour). For better reliability, especially in CI/CD
133
+ environments or when running multiple benchmarks, set the `GITHUB_TOKEN`
134
+ environment variable.
135
+
136
+ **Rate limits:**
137
+
138
+ * **Without token**: 60 requests per hour
139
+ * **With token**: 1,000 requests per hour
140
+
141
+ **Setting the token:**
142
+
143
+ [source,bash]
144
+ ----
145
+ # For local usage
146
+ export GITHUB_TOKEN=ghp_your_token_here
147
+
148
+ # For GitHub Actions (automatic)
149
+ # GitHub Actions automatically provides ${{ secrets.GITHUB_TOKEN }}
150
+ # No manual configuration needed in workflows
151
+ ----
152
+
153
+ **Creating a token:**
154
+
155
+ . Go to https://github.com/settings/tokens
156
+ . Click "Generate new token (classic)"
157
+ . Select scope: `public_repo` (for accessing public repositories)
158
+ . Copy the generated token
159
+ . Store it securely in your environment
160
+
161
+ NOTE: The token is optional. Serialbench will work without it but may hit rate
162
+ limits when updating Ruby build definitions frequently.
163
+
128
164
  == Installation
129
165
 
130
166
  Add this line to your application's Gemfile:
@@ -0,0 +1,29 @@
1
+ ---
2
+ type: object
3
+ title: Serialbench Result
4
+ description: Schema for serialbench benchmark result files (basic structure validation)
5
+ properties:
6
+ platform:
7
+ type: object
8
+ properties:
9
+ platform_string:
10
+ type: string
11
+ os:
12
+ type: string
13
+ arch:
14
+ type: string
15
+ ruby_version:
16
+ type: string
17
+ metadata:
18
+ type: object
19
+ environment_config:
20
+ type: object
21
+ properties:
22
+ name:
23
+ type: string
24
+ kind:
25
+ type: string
26
+ benchmark_config:
27
+ type: object
28
+ benchmark_result:
29
+ type: object
@@ -0,0 +1,79 @@
1
+ # Platform Validation Fix
2
+
3
+ ## Problem
4
+
5
+ GitHub Actions workflow run [18624230866](https://github.com/metanorma/serialbench/actions/runs/18624230866/job/53099708431) failed with the error:
6
+
7
+ ```
8
+ Error adding run to resultset: undefined method `platform_string' for nil
9
+ ```
10
+
11
+ This occurred when trying to add benchmark results from `artifacts/benchmark-results-macos-latest-ruby-3.2` to the weekly resultset.
12
+
13
+ ## Root Cause
14
+
15
+ The error occurred in `lib/serialbench/models/result_set.rb` line 56, where the code attempted to access `result.platform.platform_string` to check for duplicate results. When `result.platform` is `nil`, this causes a NoMethodError.
16
+
17
+ The underlying issue is that some result files were missing the `platform` section in their YAML data, causing `Result.load()` to return a Result object with a nil platform.
18
+
19
+ ## Solution Implemented
20
+
21
+ Added validation in the `ResultSet#add_result` method to check for required fields before attempting to access their properties:
22
+
23
+ ```ruby
24
+ # Validate that the result has required fields
25
+ raise ArgumentError, "Result from #{result_path} is missing platform information" if result.platform.nil?
26
+ raise ArgumentError, "Result from #{result_path} is missing environment_config" if result.environment_config.nil?
27
+ raise ArgumentError, "Result from #{result_path} is missing benchmark_config" if result.benchmark_config.nil?
28
+ ```
29
+
30
+ This provides clear, actionable error messages that indicate:
31
+ 1. Which result file has the problem
32
+ 2. Which specific field is missing
33
+
34
+ ## Testing
35
+
36
+ Created comprehensive RSpec tests in `spec/serialbench/models/result_set_spec.rb` that verify:
37
+ - Missing platform information raises appropriate error
38
+ - Missing environment_config raises appropriate error
39
+ - Missing benchmark_config raises appropriate error
40
+ - Complete results are added successfully
41
+
42
+ All tests pass.
43
+
44
+ ## Next Steps
45
+
46
+ While this fix improves error reporting, the underlying issue of why platform data is missing needs investigation:
47
+
48
+ 1. **Investigate Result Generation**: Check why some results are being created without platform data
49
+ - Review `LocalRunner#run_benchmark` in `lib/serialbench/runners/local_runner.rb`
50
+ - Review how platform data is serialized in `Platform.to_yaml`
51
+ - Check if there's a Lutaml::Model serialization issue
52
+
53
+ 2. **GitHub Actions Debugging**:
54
+ - Add debugging output to show the contents of result files before adding them to resultsets
55
+ - Verify that all benchmark runs are creating complete result files with platform data
56
+
57
+ 3. **Platform Serialization**: Ensure `Platform` model properly serializes/deserializes:
58
+ - All attributes are included in YAML output
59
+ - Default values are properly set
60
+ - No Lutaml::Model configuration issues
61
+
62
+ ## Commit
63
+
64
+ ```
65
+ fix(resultset): add validation for missing platform data in results
66
+
67
+ Previously, when adding a result to a resultset, if the result's YAML file
68
+ was missing platform information (or environment_config/benchmark_config),
69
+ the code would fail with 'undefined method platform_string for nil' when
70
+ trying to check for duplicates.
71
+
72
+ This commit adds proper validation to check for nil values before accessing
73
+ their properties, providing clear error messages that indicate which field
74
+ is missing and which result path has the issue.
75
+
76
+ Also adds comprehensive RSpec tests to verify the validation works correctly
77
+ for all three required fields: platform, environment_config, and benchmark_config.
78
+
79
+ Fixes the error seen in GitHub Actions workflow run 18624230866.