serialbench 0.1.0 → 0.1.1
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 +173 -30
- data/.github/workflows/ci.yml +3 -3
- data/.github/workflows/docker.yml +246 -0
- data/.github/workflows/release.yml +25 -0
- data/Gemfile +5 -30
- data/README.adoc +962 -134
- data/config/ci.yml +22 -0
- data/config/full.yml +30 -0
- data/docker/Dockerfile.benchmark +31 -0
- data/docker/README.md +214 -0
- data/docker/run-benchmarks.sh +356 -0
- data/lib/serialbench/benchmark_runner.rb +82 -0
- data/lib/serialbench/cli.rb +201 -9
- data/lib/serialbench/result_merger.rb +5 -5
- data/lib/serialbench/serializers/json/rapidjson_serializer.rb +50 -0
- data/lib/serialbench/serializers/json/yajl_serializer.rb +6 -2
- data/lib/serialbench/serializers/xml/nokogiri_serializer.rb +21 -3
- data/lib/serialbench/serializers/xml/rexml_serializer.rb +32 -2
- data/lib/serialbench/serializers/yaml/base_yaml_serializer.rb +55 -0
- data/lib/serialbench/serializers/yaml/psych_serializer.rb +54 -0
- data/lib/serialbench/serializers/yaml/syck_serializer.rb +65 -0
- data/lib/serialbench/serializers.rb +11 -0
- data/lib/serialbench/version.rb +1 -1
- data/serialbench.gemspec +25 -17
- metadata +113 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 581c331152e89c99f638efa981ae50ae12d3a283317fe7e4e7613a2bb4910dd0
|
4
|
+
data.tar.gz: e622c9f34c00629169508f5e92a4841bbf49cf802a736116d6a77752d82bd001
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec2cdc63a2917c724cccc1cda6c6a885822ccf62d8d129a17c64d49ec9b06952ad26eeda30edeb75f20b59b3373004c97cd647c186ed93334f028804b220383e
|
7
|
+
data.tar.gz: 2c1243b837f25723bee4f971ceaff58e85e36264c114bc0a7d201769bda93c744a7a9169d957578128e30b700467b849b405a6609c397d4f0d9eafa0a782f1cd
|
@@ -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,56 @@ 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 comprehensive benchmarks
|
81
|
+
run: |
|
82
|
+
bundle exec serialbench benchmark \
|
83
|
+
--formats xml json yaml toml \
|
84
|
+
--iterations 5 \
|
85
|
+
--warmup 2
|
86
|
+
|
87
|
+
- name: Run tests to verify functionality
|
88
|
+
run: bundle exec rspec --format documentation
|
89
|
+
|
90
|
+
- name: Upload benchmark results
|
73
91
|
uses: actions/upload-artifact@v4
|
74
92
|
with:
|
75
|
-
name: benchmark-results-ruby-${{ matrix.ruby-version }}
|
76
|
-
path: results
|
93
|
+
name: benchmark-results-${{ matrix.platform }}-ruby-${{ matrix.ruby-version }}
|
94
|
+
path: results/
|
77
95
|
retention-days: 30
|
78
96
|
|
97
|
+
# Merge results and deploy to GitHub Pages
|
79
98
|
merge-and-deploy:
|
80
99
|
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
|
81
100
|
runs-on: ubuntu-latest
|
82
101
|
needs: [setup, benchmark]
|
83
102
|
|
84
103
|
steps:
|
85
|
-
-
|
104
|
+
- name: Checkout repository
|
105
|
+
uses: actions/checkout@v4
|
86
106
|
|
87
107
|
- name: Set up Ruby (for report generation)
|
88
108
|
uses: ruby/setup-ruby@v1
|
@@ -93,24 +113,68 @@ jobs:
|
|
93
113
|
- name: Install system dependencies
|
94
114
|
run: |
|
95
115
|
sudo apt-get update
|
96
|
-
sudo apt-get install -y libxml2-dev libxslt1-dev
|
116
|
+
sudo apt-get install -y libxml2-dev libxslt1-dev build-essential
|
117
|
+
|
118
|
+
- name: Install gems
|
119
|
+
run: bundle install
|
97
120
|
|
98
121
|
- name: Download all benchmark artifacts
|
99
122
|
uses: actions/download-artifact@v4
|
100
123
|
with:
|
101
|
-
pattern: benchmark-results
|
124
|
+
pattern: benchmark-results-*
|
102
125
|
path: artifacts/
|
103
126
|
|
104
|
-
- name:
|
127
|
+
- name: List downloaded artifacts
|
128
|
+
run: |
|
129
|
+
echo "Downloaded artifacts:"
|
130
|
+
find artifacts/ -type f -name "*.json" -o -name "*.html" | head -20
|
131
|
+
|
132
|
+
- name: Generate comprehensive GitHub Pages
|
105
133
|
run: |
|
106
134
|
mkdir -p docs
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
for
|
111
|
-
|
135
|
+
|
136
|
+
# Find all result directories
|
137
|
+
RESULT_DIRS=""
|
138
|
+
for dir in artifacts/benchmark-results-*/; do
|
139
|
+
if [ -d "$dir" ]; then
|
140
|
+
RESULT_DIRS="$RESULT_DIRS $dir"
|
141
|
+
fi
|
112
142
|
done
|
113
|
-
|
143
|
+
|
144
|
+
echo "Processing result directories: $RESULT_DIRS"
|
145
|
+
|
146
|
+
# Generate GitHub Pages from all results
|
147
|
+
if [ -n "$RESULT_DIRS" ]; then
|
148
|
+
bundle exec serialbench github_pages $RESULT_DIRS docs/
|
149
|
+
else
|
150
|
+
echo "No result directories found, creating placeholder page"
|
151
|
+
echo "<html><body><h1>No benchmark results available</h1></body></html>" > docs/index.html
|
152
|
+
fi
|
153
|
+
|
154
|
+
- name: Create platform comparison summary
|
155
|
+
run: |
|
156
|
+
# Create a summary of cross-platform results
|
157
|
+
cat > docs/platform-summary.md << 'EOF'
|
158
|
+
# Cross-Platform Benchmark Summary
|
159
|
+
|
160
|
+
This page contains benchmark results from multiple platforms and Ruby versions:
|
161
|
+
|
162
|
+
## Platforms Tested
|
163
|
+
- **Ubuntu Latest**: Linux x86_64 environment
|
164
|
+
- **macOS Latest**: Apple Silicon and Intel Mac environment
|
165
|
+
- **Windows Latest**: Windows Server environment
|
166
|
+
|
167
|
+
## Ruby Versions
|
168
|
+
- Ruby 3.1, 3.2, 3.3, 3.4
|
169
|
+
|
170
|
+
## Serialization Libraries
|
171
|
+
- **XML**: REXML, Ox, Nokogiri, Oga, LibXML
|
172
|
+
- **JSON**: JSON, Oj, RapidJSON, YAJL
|
173
|
+
- **YAML**: Psych, Syck
|
174
|
+
- **TOML**: TOML-RB, Tomlib
|
175
|
+
|
176
|
+
Results show performance variations across different operating systems and architectures.
|
177
|
+
EOF
|
114
178
|
|
115
179
|
- name: Setup Pages
|
116
180
|
uses: actions/configure-pages@v4
|
@@ -123,3 +187,82 @@ jobs:
|
|
123
187
|
- name: Deploy to GitHub Pages
|
124
188
|
id: deployment
|
125
189
|
uses: actions/deploy-pages@v4
|
190
|
+
|
191
|
+
# Performance comparison analysis
|
192
|
+
performance-analysis:
|
193
|
+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
|
194
|
+
runs-on: ubuntu-latest
|
195
|
+
needs: [benchmark]
|
196
|
+
|
197
|
+
steps:
|
198
|
+
- name: Checkout repository
|
199
|
+
uses: actions/checkout@v4
|
200
|
+
|
201
|
+
- name: Download all benchmark results
|
202
|
+
uses: actions/download-artifact@v4
|
203
|
+
with:
|
204
|
+
pattern: benchmark-results-*-ruby-*
|
205
|
+
path: analysis/
|
206
|
+
|
207
|
+
- name: Set up Ruby for analysis
|
208
|
+
uses: ruby/setup-ruby@v1
|
209
|
+
with:
|
210
|
+
ruby-version: '3.3'
|
211
|
+
bundler-cache: true
|
212
|
+
|
213
|
+
- name: Install dependencies
|
214
|
+
run: |
|
215
|
+
sudo apt-get update
|
216
|
+
sudo apt-get install -y libxml2-dev libxslt1-dev
|
217
|
+
bundle install
|
218
|
+
|
219
|
+
- name: Generate performance analysis
|
220
|
+
run: |
|
221
|
+
bundle exec serialbench analyze_performance analysis/benchmark-results-*/ performance_analysis.json
|
222
|
+
|
223
|
+
- name: Generate platform comparison report
|
224
|
+
run: |
|
225
|
+
bundle exec serialbench platform_comparison performance_analysis.json platform_comparison.json
|
226
|
+
|
227
|
+
- name: Upload performance analysis
|
228
|
+
uses: actions/upload-artifact@v4
|
229
|
+
with:
|
230
|
+
name: performance-analysis
|
231
|
+
path: |
|
232
|
+
performance_analysis.json
|
233
|
+
platform_comparison.json
|
234
|
+
retention-days: 90
|
235
|
+
|
236
|
+
# Summary job
|
237
|
+
summary:
|
238
|
+
runs-on: ubuntu-latest
|
239
|
+
needs: [setup, benchmark, merge-and-deploy, performance-analysis]
|
240
|
+
if: always()
|
241
|
+
steps:
|
242
|
+
- name: Generate workflow summary
|
243
|
+
run: |
|
244
|
+
echo "## Cross-Platform Benchmark Summary" >> $GITHUB_STEP_SUMMARY
|
245
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
246
|
+
echo "**Benchmark Status**: ${{ needs.benchmark.result }}" >> $GITHUB_STEP_SUMMARY
|
247
|
+
echo "**Deploy Status**: ${{ needs.merge-and-deploy.result }}" >> $GITHUB_STEP_SUMMARY
|
248
|
+
echo "**Analysis Status**: ${{ needs.performance-analysis.result }}" >> $GITHUB_STEP_SUMMARY
|
249
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
250
|
+
echo "### Platforms Tested" >> $GITHUB_STEP_SUMMARY
|
251
|
+
echo "- Ubuntu Latest (Linux x86_64)" >> $GITHUB_STEP_SUMMARY
|
252
|
+
echo "- macOS Latest (Apple Silicon/Intel)" >> $GITHUB_STEP_SUMMARY
|
253
|
+
echo "- Windows Latest (Windows Server)" >> $GITHUB_STEP_SUMMARY
|
254
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
255
|
+
echo "### Ruby Versions" >> $GITHUB_STEP_SUMMARY
|
256
|
+
echo "- Ruby 3.1, 3.2, 3.3, 3.4" >> $GITHUB_STEP_SUMMARY
|
257
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
258
|
+
echo "### Serialization Libraries" >> $GITHUB_STEP_SUMMARY
|
259
|
+
echo "- **XML**: REXML, Ox, Nokogiri, Oga, LibXML" >> $GITHUB_STEP_SUMMARY
|
260
|
+
echo "- **JSON**: JSON, Oj, RapidJSON, YAJL" >> $GITHUB_STEP_SUMMARY
|
261
|
+
echo "- **YAML**: Psych, Syck" >> $GITHUB_STEP_SUMMARY
|
262
|
+
echo "- **TOML**: TOML-RB, Tomlib" >> $GITHUB_STEP_SUMMARY
|
263
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
264
|
+
if [ "${{ github.ref }}" == "refs/heads/main" ] || [ "${{ github.ref }}" == "refs/heads/master" ]; then
|
265
|
+
echo "### Results" >> $GITHUB_STEP_SUMMARY
|
266
|
+
echo "📊 [View Interactive Results](https://metanorma.github.io/serialbench/)" >> $GITHUB_STEP_SUMMARY
|
267
|
+
echo "📈 Performance analysis and platform comparison available in artifacts" >> $GITHUB_STEP_SUMMARY
|
268
|
+
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,246 @@
|
|
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,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.benchmark
|
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
|
+
# Test that the image works correctly
|
109
|
+
docker run --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-ruby-${{ matrix.ruby-version }} \
|
110
|
+
bundle exec serialbench list
|
111
|
+
|
112
|
+
- name: Run basic functionality test
|
113
|
+
run: |
|
114
|
+
# Create a temporary results directory
|
115
|
+
mkdir -p test-results
|
116
|
+
|
117
|
+
# Run a quick benchmark test
|
118
|
+
docker run --rm \
|
119
|
+
-v $(pwd)/test-results:/app/results \
|
120
|
+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-ruby-${{ matrix.ruby-version }} \
|
121
|
+
bundle exec serialbench benchmark \
|
122
|
+
--formats json \
|
123
|
+
--iterations 1 \
|
124
|
+
--warmup 0 \
|
125
|
+
--output-dir /app/results
|
126
|
+
|
127
|
+
# Verify results were generated
|
128
|
+
ls -la test-results/
|
129
|
+
|
130
|
+
# Clean up
|
131
|
+
rm -rf test-results
|
132
|
+
|
133
|
+
test-docker-images:
|
134
|
+
runs-on: ubuntu-latest
|
135
|
+
needs: [setup, build-docker-images]
|
136
|
+
if: needs.setup.outputs.should-build == 'true'
|
137
|
+
strategy:
|
138
|
+
matrix:
|
139
|
+
ruby-version: ${{ fromJson(needs.setup.outputs.ruby-versions) }}
|
140
|
+
fail-fast: false
|
141
|
+
|
142
|
+
steps:
|
143
|
+
- name: Checkout repository
|
144
|
+
uses: actions/checkout@v4
|
145
|
+
|
146
|
+
- name: Set up Docker Buildx
|
147
|
+
uses: docker/setup-buildx-action@v3
|
148
|
+
|
149
|
+
- name: Log in to Container Registry
|
150
|
+
uses: docker/login-action@v3
|
151
|
+
with:
|
152
|
+
registry: ${{ env.REGISTRY }}
|
153
|
+
username: ${{ github.actor }}
|
154
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
155
|
+
|
156
|
+
- name: Pull Docker image
|
157
|
+
run: |
|
158
|
+
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-ruby-${{ matrix.ruby-version }}
|
159
|
+
|
160
|
+
- name: Test serializer availability
|
161
|
+
run: |
|
162
|
+
echo "Testing Ruby ${{ matrix.ruby-version }} container..."
|
163
|
+
docker run --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-ruby-${{ matrix.ruby-version }} \
|
164
|
+
bundle exec ruby -e "
|
165
|
+
require 'serialbench'
|
166
|
+
puts 'Available serializers:'
|
167
|
+
Serialbench::Serializers.available.each do |s|
|
168
|
+
serializer = s.new
|
169
|
+
puts \" #{serializer.format}: #{serializer.name} v#{serializer.version}\"
|
170
|
+
end
|
171
|
+
"
|
172
|
+
|
173
|
+
- name: Run comprehensive tests
|
174
|
+
run: |
|
175
|
+
docker run --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-ruby-${{ matrix.ruby-version }} \
|
176
|
+
bundle exec rspec --format progress
|
177
|
+
|
178
|
+
- name: Test benchmark execution
|
179
|
+
run: |
|
180
|
+
mkdir -p docker-test-results
|
181
|
+
|
182
|
+
# Run a comprehensive but quick benchmark
|
183
|
+
docker run --rm \
|
184
|
+
-v $(pwd)/docker-test-results:/app/results \
|
185
|
+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-ruby-${{ matrix.ruby-version }} \
|
186
|
+
bundle exec serialbench benchmark \
|
187
|
+
--formats xml json yaml toml \
|
188
|
+
--iterations 2 \
|
189
|
+
--warmup 1 \
|
190
|
+
--output-dir /app/results
|
191
|
+
|
192
|
+
# Verify all expected files were created
|
193
|
+
echo "Generated files:"
|
194
|
+
find docker-test-results -type f -name "*.json" -o -name "*.html" -o -name "*.csv"
|
195
|
+
|
196
|
+
# Clean up
|
197
|
+
rm -rf docker-test-results
|
198
|
+
|
199
|
+
cleanup:
|
200
|
+
runs-on: ubuntu-latest
|
201
|
+
needs: [setup, build-docker-images, test-docker-images]
|
202
|
+
if: always() && github.event_name != 'pull_request'
|
203
|
+
steps:
|
204
|
+
- name: Log in to Container Registry
|
205
|
+
uses: docker/login-action@v3
|
206
|
+
with:
|
207
|
+
registry: ${{ env.REGISTRY }}
|
208
|
+
username: ${{ github.actor }}
|
209
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
210
|
+
|
211
|
+
- name: Clean up old Docker images
|
212
|
+
run: |
|
213
|
+
echo "Docker image cleanup would be implemented here"
|
214
|
+
# Note: Actual cleanup requires additional GitHub API calls
|
215
|
+
# For now, we rely on GitHub's automatic cleanup policies
|
216
|
+
echo "Current images are tagged and will be managed by GitHub's retention policies"
|
217
|
+
|
218
|
+
summary:
|
219
|
+
runs-on: ubuntu-latest
|
220
|
+
needs: [setup, build-docker-images, test-docker-images]
|
221
|
+
if: always()
|
222
|
+
steps:
|
223
|
+
- name: Build Summary
|
224
|
+
run: |
|
225
|
+
echo "## Docker Build Summary" >> $GITHUB_STEP_SUMMARY
|
226
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
227
|
+
echo "**Build Status**: ${{ needs.build-docker-images.result }}" >> $GITHUB_STEP_SUMMARY
|
228
|
+
echo "**Test Status**: ${{ needs.test-docker-images.result }}" >> $GITHUB_STEP_SUMMARY
|
229
|
+
echo "**Should Build**: ${{ needs.setup.outputs.should-build }}" >> $GITHUB_STEP_SUMMARY
|
230
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
231
|
+
echo "### Available Images" >> $GITHUB_STEP_SUMMARY
|
232
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
233
|
+
echo "| Ruby Version | Image Tag |" >> $GITHUB_STEP_SUMMARY
|
234
|
+
echo "|--------------|-----------|" >> $GITHUB_STEP_SUMMARY
|
235
|
+
echo "| 3.1 | \`ghcr.io/metanorma/serialbench:main-ruby-3.1\` |" >> $GITHUB_STEP_SUMMARY
|
236
|
+
echo "| 3.2 | \`ghcr.io/metanorma/serialbench:main-ruby-3.2\` |" >> $GITHUB_STEP_SUMMARY
|
237
|
+
echo "| 3.3 | \`ghcr.io/metanorma/serialbench:main-ruby-3.3\` |" >> $GITHUB_STEP_SUMMARY
|
238
|
+
echo "| 3.4 | \`ghcr.io/metanorma/serialbench:main-ruby-3.4\` |" >> $GITHUB_STEP_SUMMARY
|
239
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
240
|
+
echo "### Usage" >> $GITHUB_STEP_SUMMARY
|
241
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
242
|
+
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
|
243
|
+
echo "# Pull and run latest Ruby 3.3 container" >> $GITHUB_STEP_SUMMARY
|
244
|
+
echo "docker pull ghcr.io/metanorma/serialbench:main-ruby-3.3" >> $GITHUB_STEP_SUMMARY
|
245
|
+
echo "docker run --rm -v \$(pwd)/results:/app/results ghcr.io/metanorma/serialbench:main-ruby-3.3" >> $GITHUB_STEP_SUMMARY
|
246
|
+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
@@ -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,8 @@ 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 'rake'
|
6
|
+
gem 'rspec'
|
7
|
+
gem 'rubocop'
|
8
|
+
gem 'rubocop-rspec'
|
9
|
+
gem 'rubocop-performance'
|