emf2svg 1.4.3 → 1.8.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed25781fa0deb370e994e4aa0f85cc85fac72582255198163e44d4b03796e068
4
- data.tar.gz: 766cb7878a0ebab1f0613fe4268992723c089f47cac7ef8e6ff3764c5ec3c9c6
3
+ metadata.gz: de85bf6c169462c3507c975d9fa32f398d6271d87c84710c256b0893d934108e
4
+ data.tar.gz: 160114f8562f04e3639ba954e7dbbd6c05131e27294ed2083d96970a4dd76c4e
5
5
  SHA512:
6
- metadata.gz: 183c66c847e395d1017f81bdc6358f64f689cbcb780b95da54a55dab6b9d79e3e775a2b2c51be425a940892e8dea3d8a6e030bef1215ef6c24df14f26f524d8d
7
- data.tar.gz: 33bfec69726ab304c8d4d9dadc5bbc9c740c398364fc51d199c946c6d922241843e0e202e5f7605371526e7735409ab64ebe925aa30b08fd045e871bf9143178
6
+ metadata.gz: 5aaeba35443541d2bce4cfa1a4d3148ba46fb0dd8ffbe80b100ffd753187a0ec85ea8a3dfbe2656d7b898fa11e196bd7d422f57901bc3ba0cf2ec7c3d91fc8b8
7
+ data.tar.gz: 30f0d7cc0601a0dc55456fb8c2932f8f8cf7fdb81517d9a69f2508a23e6b29ca0e400d0d3a1d6d03dea48c23d3b0224579d9652a923434b098c82718cd76ea11
@@ -13,56 +13,76 @@ concurrency:
13
13
  cancel-in-progress: true
14
14
 
15
15
  jobs:
16
+ prepare:
17
+ uses: metanorma/ci/.github/workflows/prepare-rake.yml@main
18
+
16
19
  test:
20
+ name: Test on Ruby ${{ matrix.ruby.version }} ${{ matrix.os }}
17
21
  runs-on: ${{ matrix.os }}
22
+
23
+ needs: prepare
24
+ if: needs.prepare.outputs.push-for-tag != 'true'
25
+
26
+ continue-on-error: ${{ matrix.ruby.experimental }}
18
27
  strategy:
19
28
  fail-fast: false
20
- matrix:
21
- os: [ ubuntu-latest, windows-latest, macos-latest ]
22
- ruby-version: [ '2.7', '3.0', '3.1' ]
29
+ max-parallel: 5
30
+ matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
23
31
 
24
32
  steps:
25
- - uses: actions/checkout@v3
33
+ - uses: actions/checkout@v4
26
34
 
27
35
  - uses: ruby/setup-ruby@master
28
36
  with:
29
37
  bundler-cache: true
30
- ruby-version: ${{ matrix.ruby-version }}
38
+ ruby-version: ${{ matrix.ruby.version }}
39
+ rubygems: ${{ matrix.ruby.rubygems }}
31
40
 
32
- # https://github.com/microsoft/vcpkg/issues/15931
33
- # no good solution :(
41
+ # https://github.com/microsoft/vcpkg/issues/15931
42
+ # no good solution :(
34
43
  - name: Workaround for vcpkg
35
- if: startsWith(matrix.os, 'ubuntu')
44
+ if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
45
+ shell: bash
36
46
  run: |
37
- sudo apt-get update
38
- sudo apt-get install gperf
47
+ if [[ "$RUNNER_OS" == "Linux" ]]; then
48
+ sudo apt-get update
49
+ sudo apt-get install -y gperf autoconf autoconf-archive automake libtool
50
+ elif [[ "$RUNNER_OS" == "macOS" ]]; then
51
+ brew install gperf autoconf autoconf-archive automake libtool
52
+ fi
53
+
54
+ - run: |
55
+ which make || true
56
+ which clang || true
57
+ which gcc || true
39
58
 
40
59
  - run: bundle exec rake
41
60
 
42
61
  build:
43
62
  name: build ${{ matrix.os }}, ${{ matrix.ruby-version }}, ${{ matrix.platform }}
44
63
  runs-on: ${{ matrix.os }}
64
+ needs: prepare
45
65
  strategy:
46
66
  fail-fast: false
47
67
  matrix:
48
68
  include:
49
69
  - os: ubuntu-latest
50
70
  platform: any
51
- ruby-version: '2.7'
71
+ ruby-version: ${{ needs.prepare.outputs.default-ruby-version }}
52
72
  - os: ubuntu-latest
53
73
  platform: x86_64-linux
54
- ruby-version: '2.7'
74
+ ruby-version: ${{ needs.prepare.outputs.default-ruby-version }}
55
75
  - os: windows-latest
56
76
  platform: x64-mingw32
57
- ruby-version: '2.7'
77
+ ruby-version: ${{ needs.prepare.outputs.default-ruby-version }}
58
78
  - os: windows-latest
59
79
  platform: x64-mingw-ucrt
60
- ruby-version: '3.1'
80
+ ruby-version: ${{ needs.prepare.outputs.default-ruby-version }}
61
81
  - os: macos-latest
62
82
  platform: x86_64-darwin
63
- ruby-version: '2.7'
83
+ ruby-version: ${{ needs.prepare.outputs.default-ruby-version }}
64
84
  steps:
65
- - uses: actions/checkout@v3
85
+ - uses: actions/checkout@v4
66
86
 
67
87
  - name: Setup Ruby
68
88
  uses: ruby/setup-ruby@master
@@ -71,39 +91,55 @@ jobs:
71
91
  bundler-cache: true
72
92
 
73
93
  - name: Workaround for vcpkg
74
- if: startsWith(matrix.os, 'ubuntu')
94
+ if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
95
+ shell: bash
75
96
  run: |
76
- sudo apt-get update
77
- sudo apt-get install gperf
97
+ if [[ "$RUNNER_OS" == "Linux" ]]; then
98
+ sudo apt-get update
99
+ sudo apt-get install -y gperf autoconf autoconf-archive automake libtool
100
+ elif [[ "$RUNNER_OS" == "macOS" ]]; then
101
+ brew install gperf autoconf autoconf-archive automake libtool
102
+ fi
78
103
 
79
104
  - run: bundle exec rake gem:native:${{ matrix.platform }}
80
105
 
81
- - uses: actions/upload-artifact@v3
106
+ - if: matrix.platform != 'any'
107
+ uses: metanorma/ci/native-deps-action@main
82
108
  with:
83
- name: pkg
109
+ libname: emf2svg
110
+ directory: lib/emf2svg
111
+
112
+ - uses: actions/upload-artifact@v4
113
+ with:
114
+ name: pkg-${{ matrix.platform }}
84
115
  path: pkg/*.gem
85
116
 
86
117
  cross-build:
87
118
  name: build ${{ matrix.os }}, ${{ matrix.ruby-version }}, ${{ matrix.platform }}
88
119
  runs-on: ${{ matrix.os }}
120
+ needs: prepare
89
121
  strategy:
90
122
  fail-fast: false
91
123
  matrix:
92
124
  include:
93
125
  - os: ubuntu-latest
94
126
  platform: aarch64-linux
95
- ruby-version: '2.7'
127
+ ruby-version: ${{ needs.prepare.outputs.default-ruby-version }}
96
128
  - os: macos-latest
97
129
  platform: arm64-darwin
98
- ruby-version: '2.7'
130
+ ruby-version: ${{ needs.prepare.outputs.default-ruby-version }}
99
131
  steps:
100
- - uses: actions/checkout@v3
132
+ - uses: actions/checkout@v4
101
133
 
102
134
  - name: Install Ubuntu packages
103
135
  if: startsWith(matrix.os, 'ubuntu')
104
136
  run: |
105
137
  sudo apt-get update
106
- sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
138
+ sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf autoconf autoconf-archive automake libtool
139
+
140
+ - name: Install macOS packages
141
+ if: startsWith(matrix.os, 'macos')
142
+ run: brew install gperf autoconf autoconf-archive automake libtool
107
143
 
108
144
  - name: Install Ruby
109
145
  uses: ruby/setup-ruby@master
@@ -114,31 +150,41 @@ jobs:
114
150
  - name: Build native extension
115
151
  run: bundle exec rake gem:native:${{ matrix.platform }}
116
152
 
117
- - uses: actions/upload-artifact@v3
153
+ - if: matrix.platform != 'aarch64-linux'
154
+ uses: metanorma/ci/native-deps-action@main
118
155
  with:
119
- name: pkg
156
+ libname: emf2svg
157
+ directory: lib/emf2svg
158
+
159
+ - uses: actions/upload-artifact@v4
160
+ with:
161
+ name: pkg-${{ matrix.platform }}
120
162
  path: pkg/*.gem
121
163
 
122
164
  test-build:
123
- needs: [ build, cross-build ]
165
+ needs: [ prepare, build, cross-build ]
124
166
  runs-on: ${{ matrix.os }}
167
+
168
+ continue-on-error: ${{ matrix.ruby.experimental }}
125
169
  strategy:
126
170
  fail-fast: false
127
- matrix:
128
- os: [ ubuntu-latest, windows-latest, macos-latest ]
129
- ruby-version: [ '2.7', '3.0', '3.1' ]
171
+ max-parallel: 5
172
+ matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
130
173
 
131
174
  steps:
132
- - uses: actions/checkout@v3
175
+ - uses: actions/checkout@v4
133
176
 
134
177
  - uses: ruby/setup-ruby@master
135
178
  with:
136
- ruby-version: ${{ matrix.ruby-version }}
179
+ bundler-cache: true
180
+ ruby-version: ${{ matrix.ruby.version }}
181
+ rubygems: ${{ matrix.ruby.rubygems }}
137
182
 
138
- - uses: actions/download-artifact@v3
183
+ - uses: actions/download-artifact@v4
139
184
  with:
140
- name: pkg
185
+ pattern: pkg-*
141
186
  path: pkg
187
+ merge-multiple: true
142
188
 
143
189
  - name: Install binary gem
144
190
  run: gem install -b pkg/emf2svg-$(ruby -I lib -r emf2svg/version -e "puts Emf2svg::VERSION")-$(ruby -e "puts RUBY_PLATFORM.sub(/darwin\d{2}$/, 'darwin')").gem
@@ -148,31 +194,40 @@ jobs:
148
194
  ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
149
195
 
150
196
  test-build-any:
151
- needs: [ build, cross-build ]
197
+ needs: [ prepare, build, cross-build ]
152
198
  runs-on: ${{ matrix.os }}
199
+
200
+ continue-on-error: ${{ matrix.ruby.experimental }}
153
201
  strategy:
154
202
  fail-fast: false
155
- matrix:
156
- os: [ ubuntu-latest, windows-latest, macos-latest ]
157
- ruby-version: [ '2.7', '3.0', '3.1' ]
203
+ max-parallel: 5
204
+ matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
158
205
 
159
206
  steps:
160
- - uses: actions/checkout@v3
207
+ - uses: actions/checkout@v4
161
208
 
162
209
  - uses: ruby/setup-ruby@master
163
210
  with:
164
- ruby-version: ${{ matrix.ruby-version }}
211
+ bundler-cache: true
212
+ ruby-version: ${{ matrix.ruby.version }}
213
+ rubygems: ${{ matrix.ruby.rubygems }}
165
214
 
166
- - uses: actions/download-artifact@v3
215
+ - uses: actions/download-artifact@v4
167
216
  with:
168
- name: pkg
217
+ pattern: pkg-*
169
218
  path: pkg
219
+ merge-multiple: true
170
220
 
171
221
  - name: Workaround for vcpkg
172
- if: startsWith(matrix.os, 'ubuntu')
222
+ if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
223
+ shell: bash
173
224
  run: |
174
- sudo apt-get update
175
- sudo apt-get install gperf
225
+ if [[ "$RUNNER_OS" == "Linux" ]]; then
226
+ sudo apt-get update
227
+ sudo apt-get install -y gperf autoconf autoconf-archive automake libtool
228
+ elif [[ "$RUNNER_OS" == "macOS" ]]; then
229
+ brew install gperf autoconf autoconf-archive automake libtool
230
+ fi
176
231
 
177
232
  - name: Install native gem
178
233
  run: gem install -b pkg/emf2svg-$(ruby -I lib -r emf2svg/version -e "puts Emf2svg::VERSION").gem
@@ -4,9 +4,121 @@ on:
4
4
  push:
5
5
  tags:
6
6
  - 'v*'
7
+ workflow_dispatch:
8
+ inputs:
9
+ bump-type:
10
+ description: 'What to bump before tagging'
11
+ type: choice
12
+ options:
13
+ - current
14
+ - iteration
15
+ - libemf2svg
16
+ default: iteration
17
+ libemf2svg-version:
18
+ description: 'New libemf2svg version (required when bump-type=libemf2svg, e.g. 1.8.3)'
19
+ type: string
20
+ required: false
21
+
22
+ # contents: write is needed for workflow_dispatch to push the bump commit + tag.
23
+ # id-token: write is required for RubyGems.org Trusted Publishing (OIDC).
24
+ permissions:
25
+ contents: write
26
+ id-token: write
7
27
 
8
28
  jobs:
29
+ bump:
30
+ if: github.event_name == 'workflow_dispatch'
31
+ runs-on: ubuntu-latest
32
+ outputs:
33
+ sha: ${{ steps.sha.outputs.sha }}
34
+ new-version: ${{ steps.bump.outputs.new-version }}
35
+ steps:
36
+ - uses: actions/checkout@v4
37
+
38
+ - uses: ruby/setup-ruby@master
39
+ with:
40
+ ruby-version: '3.3'
41
+
42
+ - name: Bump version.rb
43
+ id: bump
44
+ shell: bash
45
+ env:
46
+ BUMP_TYPE: ${{ inputs.bump-type }}
47
+ LIBEMF2SVG_VERSION_INPUT: ${{ inputs.libemf2svg-version }}
48
+ run: |
49
+ set -euo pipefail
50
+
51
+ if [[ "$BUMP_TYPE" == "current" ]]; then
52
+ NEW_VERSION=$(ruby -Ilib -remf2svg/version -e 'puts Emf2svg::VERSION')
53
+ echo "new-version=${NEW_VERSION}" >> "$GITHUB_OUTPUT"
54
+ echo "sha=${{ github.sha }}" >> "$GITHUB_OUTPUT"
55
+ echo "Releasing current VERSION (${NEW_VERSION}) -- no bump."
56
+ exit 0
57
+ fi
58
+
59
+ ruby <<'RUBY'
60
+ bump_type = ENV.fetch("BUMP_TYPE")
61
+ path = "lib/emf2svg/version.rb"
62
+ content = File.read(path)
63
+
64
+ case bump_type
65
+ when "iteration"
66
+ m = %r{LIBEMF2SVG_RUBY_ITERATION = (\d+)}.match(content) or
67
+ raise "Could not find LIBEMF2SVG_RUBY_ITERATION in #{path}"
68
+ content.sub!(%r{LIBEMF2SVG_RUBY_ITERATION = \d+},
69
+ "LIBEMF2SVG_RUBY_ITERATION = #{m[1].to_i + 1}") or
70
+ raise "Failed to substitute iteration"
71
+ when "libemf2svg"
72
+ new_v = ENV.fetch("LIBEMF2SVG_VERSION_INPUT", "")
73
+ raise "libemf2svg-version input is required when bump-type=libemf2svg" if new_v.empty?
74
+ raise "Invalid version format: #{new_v} (expected X.Y.Z)" unless new_v.match?(/\A\d+\.\d+\.\d+\z/)
75
+ content.sub!(%r{LIBEMF2SVG_VERSION = "[^"]+"},
76
+ "LIBEMF2SVG_VERSION = \"#{new_v}\"") or
77
+ raise "Failed to substitute libemf2svg version"
78
+ content.sub!(%r{LIBEMF2SVG_RUBY_ITERATION = \d+},
79
+ "LIBEMF2SVG_RUBY_ITERATION = 0") or
80
+ raise "Failed to reset iteration"
81
+ else
82
+ raise "Unknown bump-type: #{bump_type}"
83
+ end
84
+
85
+ File.write(path, content)
86
+ load File.expand_path(path)
87
+ File.open(ENV.fetch("GITHUB_OUTPUT"), "a") do |f|
88
+ f.puts "new-version=#{Emf2svg::VERSION}"
89
+ end
90
+ warn "Bumped to #{Emf2svg::VERSION}"
91
+ RUBY
92
+
93
+ NEW_VERSION=$(ruby -Ilib -remf2svg/version -e 'puts Emf2svg::VERSION')
94
+ echo "new-version=${NEW_VERSION}" >> "$GITHUB_OUTPUT"
95
+
96
+ git config user.name "github-actions[bot]"
97
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
98
+ git add lib/emf2svg/version.rb
99
+ git commit -m "Release v${NEW_VERSION}"
100
+ echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
101
+
102
+ - name: Show what's being released
103
+ run: |
104
+ echo "Releasing version: ${{ steps.bump.outputs.new-version }}"
105
+ git --no-pager log --oneline -1 "${{ steps.bump.outputs.sha }}"
106
+
107
+ - name: Push bump commit + tag
108
+ env:
109
+ NEW_VERSION: ${{ steps.bump.outputs.new-version }}
110
+ SHA: ${{ steps.bump.outputs.sha }}
111
+ run: |
112
+ # Only push the bump commit if it exists (skipped for bump-type=current).
113
+ if [[ -n "${SHA}" && "${SHA}" != "${{ github.sha }}" ]]; then
114
+ git push origin "HEAD:${{ github.event.repository.default_branch }}"
115
+ fi
116
+ git tag "v${NEW_VERSION}" "${SHA}"
117
+ git push origin "v${NEW_VERSION}"
118
+
9
119
  build:
120
+ needs: bump
121
+ if: always() && !cancelled() && !failure() && (needs.bump.result == 'success' || needs.bump.result == 'skipped')
10
122
  runs-on: ${{ matrix.os }}
11
123
  strategy:
12
124
  fail-fast: false
@@ -14,50 +126,57 @@ jobs:
14
126
  include:
15
127
  - os: ubuntu-latest
16
128
  platform: any
17
- ruby-version: '2.7'
129
+ ruby-version: '3.3'
18
130
  - os: ubuntu-latest
19
131
  platform: x86_64-linux
20
- ruby-version: '2.7'
132
+ ruby-version: '3.3'
21
133
  - os: windows-latest
22
134
  platform: x64-mingw32
23
- ruby-version: '2.7'
135
+ ruby-version: '3.3'
24
136
  - os: windows-latest
25
137
  platform: x64-mingw-ucrt
26
- ruby-version: '3.1'
138
+ ruby-version: '3.3'
27
139
  - os: macos-latest
28
- platform: x86_64-darwin
29
- ruby-version: '2.7'
140
+ platform: arm64-darwin
141
+ ruby-version: '3.3'
30
142
  steps:
31
- - uses: actions/checkout@v3
32
-
33
- - uses: ruby/setup-ruby@master
34
- with:
35
- ruby-version: ${{ matrix.ruby-version }}
36
- bundler-cache: true
37
-
38
- # https://github.com/microsoft/vcpkg/issues/15931
39
- # no good solution :(
40
- - name: Workaround for vcpkg
41
- if: startsWith(matrix.os, 'ubuntu')
42
- run: |
43
- sudo apt-get update
44
- sudo apt-get install gperf
45
-
46
- - run: bundle exec rake gem:native:${{ matrix.platform }}
47
-
48
- - uses: actions/upload-artifact@v3
49
- with:
50
- name: pkg
51
- path: pkg/*.gem
52
-
53
- - name: Install gem
54
- run: gem install -b pkg/emf2svg-*.gem
55
-
56
- - name: Test conversion
57
- run: |
58
- ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
143
+ - uses: actions/checkout@v4
144
+ with:
145
+ ref: ${{ needs.bump.outputs.sha || github.ref }}
146
+
147
+ - uses: ruby/setup-ruby@master
148
+ with:
149
+ ruby-version: ${{ matrix.ruby-version }}
150
+ bundler-cache: true
151
+
152
+ - name: Workaround for vcpkg
153
+ if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
154
+ shell: bash
155
+ run: |
156
+ if [[ "$RUNNER_OS" == "Linux" ]]; then
157
+ sudo apt-get update
158
+ sudo apt-get install -y gperf autoconf autoconf-archive automake libtool
159
+ elif [[ "$RUNNER_OS" == "macOS" ]]; then
160
+ brew install gperf autoconf autoconf-archive automake libtool
161
+ fi
162
+
163
+ - run: bundle exec rake gem:native:${{ matrix.platform }}
164
+
165
+ - uses: actions/upload-artifact@v4
166
+ with:
167
+ name: pkg-${{ matrix.platform }}
168
+ path: pkg/*.gem
169
+
170
+ - name: Install gem
171
+ run: gem install -b pkg/emf2svg-*.gem
172
+
173
+ - name: Test conversion
174
+ run: |
175
+ ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
59
176
 
60
177
  cross:
178
+ needs: bump
179
+ if: always() && !cancelled() && !failure() && (needs.bump.result == 'success' || needs.bump.result == 'skipped')
61
180
  runs-on: ${{ matrix.os }}
62
181
  strategy:
63
182
  fail-fast: false
@@ -65,60 +184,63 @@ jobs:
65
184
  include:
66
185
  - os: ubuntu-latest
67
186
  platform: aarch64-linux
68
- ruby-version: '2.7'
187
+ ruby-version: '3.3'
69
188
  - os: macos-latest
70
- platform: arm64-darwin
71
- ruby-version: '2.7'
189
+ platform: x86_64-darwin
190
+ ruby-version: '3.3'
72
191
  steps:
73
- - uses: actions/checkout@v3
192
+ - uses: actions/checkout@v4
193
+ with:
194
+ ref: ${{ needs.bump.outputs.sha || github.ref }}
195
+
196
+ - name: Install Ubuntu packages
197
+ if: startsWith(matrix.os, 'ubuntu')
198
+ run: |
199
+ sudo apt-get update
200
+ sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf autoconf autoconf-archive automake libtool
74
201
 
75
- - name: Install packages
76
- if: matrix.os == 'ubuntu-latest'
77
- run: |
78
- sudo apt-get update
79
- sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
202
+ - name: Install macOS packages
203
+ if: startsWith(matrix.os, 'macos')
204
+ run: brew install gperf autoconf autoconf-archive automake libtool
80
205
 
81
- - uses: ruby/setup-ruby@master
82
- with:
83
- ruby-version: ${{ matrix.ruby-version }}
84
- bundler-cache: true
206
+ - uses: ruby/setup-ruby@master
207
+ with:
208
+ ruby-version: ${{ matrix.ruby-version }}
209
+ bundler-cache: true
85
210
 
86
- - run: bundle exec rake gem:native:${{ matrix.platform }}
211
+ - run: bundle exec rake gem:native:${{ matrix.platform }}
87
212
 
88
- - uses: actions/upload-artifact@v3
89
- with:
90
- name: pkg
91
- path: pkg/*.gem
213
+ - uses: actions/upload-artifact@v4
214
+ with:
215
+ name: pkg-${{ matrix.platform }}
216
+ path: pkg/*.gem
92
217
 
93
- - name: Install gem
94
- run: gem install -b pkg/emf2svg-*.gem
218
+ - name: Install gem
219
+ run: gem install -b pkg/emf2svg-*.gem
95
220
 
96
221
  publish:
97
- needs: [ build, cross ]
222
+ needs: [ bump, build, cross ]
223
+ if: always() && !cancelled() && !failure()
98
224
  runs-on: ubuntu-latest
99
225
  steps:
100
- - uses: actions/checkout@v3
101
-
102
- - uses: ruby/setup-ruby@master
103
- with:
104
- ruby-version: '2.7'
105
- bundler-cache: true
106
-
107
- - uses: actions/download-artifact@v3
108
- with:
109
- name: pkg
110
- path: pkg
111
-
112
- - name: Publish to rubygems.org
113
- env:
114
- RUBYGEMS_API_KEY: ${{secrets.METANORMA_CI_RUBYGEMS_API_KEY}}
115
- run: |
116
- mkdir -p ~/.gem
117
- touch ~/.gem/credentials
118
- cat > ~/.gem/credentials << EOF
119
- ---
120
- :rubygems_api_key: ${RUBYGEMS_API_KEY}
121
- EOF
122
- chmod 0600 ~/.gem/credentials
123
- gem signin
124
- for gem in pkg/*.gem; do gem push -V $gem; done
226
+ - uses: actions/checkout@v4
227
+ with:
228
+ ref: ${{ needs.bump.outputs.sha || github.ref }}
229
+
230
+ - uses: ruby/setup-ruby@master
231
+ with:
232
+ ruby-version: '3.3'
233
+ bundler-cache: true
234
+
235
+ - uses: actions/download-artifact@v4
236
+ with:
237
+ pattern: pkg-*
238
+ path: pkg
239
+ merge-multiple: true
240
+
241
+ - name: Configure RubyGems credentials (Trusted Publishing / OIDC)
242
+ uses: rubygems/configure-rubygems-credentials@main
243
+
244
+ - name: Publish to rubygems.org
245
+ run: |
246
+ for gem in pkg/*.gem; do gem push -V "$gem"; done
data/Gemfile CHANGED
@@ -10,3 +10,5 @@ gem "rake", "~> 13.0"
10
10
  gem "rspec", "~> 3.0"
11
11
 
12
12
  gem "rubocop", "~> 1.7"
13
+ gem "rubocop-performance", "~> 1.0"
14
+ gem "rubocop-rails", "~> 2.0"
data/README.adoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = emf2svg Ruby gem for EMF to SVG conversion
2
2
 
3
- image:https://github.com/metanorma/emf2svg-ruby/actions/workflows/build.yml/badge.svg["Build", link="https://github.com/metanorma/emf2svg-ruby/actions/workflows/build.yml"]
3
+ image:https://github.com/claricle/emf2svg-ruby/actions/workflows/build.yml/badge.svg["Build", link="https://github.com/claricle/emf2svg-ruby/actions/workflows/build.yml"]
4
4
  image:https://badge.fury.io/rb/emf2svg.svg["Gem Version", link="https://badge.fury.io/rb/emf2svg"]
5
5
 
6
6
  == Purpose
@@ -9,8 +9,12 @@ The `emf2svg` Ruby gem provides a Ruby interface to the
9
9
  https://github.com/kakwa/libemf2svg[libemf2svg] EMF-to-SVG conversion library.
10
10
 
11
11
  NOTE: This gem currently uses the
12
- https://github.com/metanorma/libemf2svg[Metanorma fork of libemf2svg]
13
- until feature up-streaming is complete.
12
+ https://github.com/claricle/libemf2svg[claricle fork of libemf2svg]
13
+ where the latest portability fixes (MinGW/MSys support, arm64 CI,
14
+ restored macOS x86_64 / Windows ARM64 / MSys2 workflows, etc.) live
15
+ while waiting for further upstreaming. The source tarball this gem
16
+ compiles from is published from
17
+ https://github.com/claricle/libemf2svg/releases[claricle/libemf2svg/releases].
14
18
 
15
19
  == Prerequisites
16
20
 
@@ -88,6 +92,52 @@ same size as EMF (in pixels)
88
92
  [[packaging]]
89
93
  == Packaging
90
94
 
95
+ [[versioning]]
96
+ === Versioning
97
+
98
+ The gem version follows the pattern `{libemf2svg_version}.{ruby_iteration}`:
99
+
100
+ [cols="1,4", options="header"]
101
+ |===
102
+ | Segment | Meaning
103
+ | `libemf2svg_version`
104
+ | The upstream `libemf2svg` release this gem is built against (e.g. `1.8.2`).
105
+ Bumps when `libemf2svg` cuts a new release.
106
+
107
+ | `ruby_iteration`
108
+ | A monotonically increasing counter for Ruby-side changes that ship
109
+ *without* a new `libemf2svg` release -- recipe bug fixes, CI changes,
110
+ documentation, gemspec tweaks. Resets to `0` whenever
111
+ `libemf2SVG_version` bumps.
112
+ |===
113
+
114
+ Examples:
115
+
116
+ [cols="1,4", options="header"]
117
+ |===
118
+ | Version | Meaning
119
+ | `1.8.2.0` | First release built against `libemf2svg` 1.8.2.
120
+ | `1.8.2.1` | Ruby-side fix on top of the same `libemf2svg` 1.8.2 (e.g. recipe bug).
121
+ | `1.8.3.0` | First release built against `libemf2svg` 1.8.3 (iteration reset).
122
+ |===
123
+
124
+ To find which `libemf2svg` version a given gem version was built against,
125
+ read the first three segments. To find the Ruby-side patch level within
126
+ that `libemf2svg` version, read the fourth.
127
+
128
+ The constants live in `lib/emf2svg/version.rb`:
129
+
130
+ [source,ruby]
131
+ ----
132
+ LIBEMF2SVG_VERSION = "1.8.2"
133
+ LIBEMF2SVG_RUBY_ITERATION = 0
134
+ VERSION = "#{LIBEMF2SVG_VERSION}.#{LIBEMF2SVG_RUBY_ITERATION}"
135
+ ----
136
+
137
+ Bump `LIBEMF2SVG_VERSION` and reset `LIBEMF2SVG_RUBY_ITERATION = 0` when
138
+ pulling in a new `libemf2svg` release. Bump only
139
+ `LIBEMF2SVG_RUBY_ITERATION` for Ruby-side-only changes.
140
+
91
141
  === Pre-compiled extensions or building from source
92
142
 
93
143
  This gem is distributed with pre-compiled native extensions for a set of
@@ -194,35 +244,43 @@ https://rubygems.org[rubygems.org].
194
244
 
195
245
  === Releasing
196
246
 
197
- Releasing is done automatically with GitHub Actions. Just bump and tag with
198
- `gem-release`.
199
-
200
- For a patch release (0.0.x) use:
201
-
202
- [source,sh]
203
- ----
204
- gem bump --version patch --tag --push
205
- ----
206
-
207
- For a minor release (0.x.0) use:
208
-
209
- [source,sh]
210
- ----
211
- gem bump --version minor --tag --push
212
- ----
247
+ Releases are cut from the
248
+ https://github.com/claricle/emf2svg-ruby/actions/workflows/release.yml[release.yml]
249
+ workflow. It has two triggers:
250
+
251
+ `workflow_dispatch` (preferred):: Manually triggered from the Actions UI
252
+ with a `bump-type` input that decides how `lib/emf2svg/version.rb` is
253
+ rewritten before tagging:
254
+ +
255
+ [cols="1,4", options="header"]
256
+ |===
257
+ | `bump-type` | Effect
258
+ | `current` | Tag and publish the VERSION currently in `version.rb` (no edit, no commit). Use this for the first release of a new `LIBEMF2SVG_VERSION`.
259
+ | `iteration` | Bump `LIBEMF2SVG_RUBY_ITERATION` by 1, commit, tag, publish. Use this for Ruby-side-only fixes (recipe, CI, docs).
260
+ | `libemf2svg` | Set `LIBEMF2SVG_VERSION` to the supplied `libemf2svg-version` (e.g. `1.8.3`), reset `LIBEMF2SVG_RUBY_ITERATION` to `0`, commit, tag, publish.
261
+ |===
262
+ +
263
+ The workflow pushes the bump commit (if any) to `master`, pushes the
264
+ `vX.Y.Z.N` tag, then builds pre-compiled native gems for every supported
265
+ platform and publishes them to https://rubygems.org[rubygems.org] using
266
+ RubyGems Trusted Publishing (OIDC).
267
+
268
+ `push: tags: v*`:: If a human pushes a tag manually (e.g. for an
269
+ emergency re-release after editing `version.rb` locally), the same
270
+ build + publish pipeline runs without the bump step.
213
271
 
214
272
 
215
273
  == Contributing
216
274
 
217
275
  Bug reports and pull requests are welcome on GitHub at
218
- https://github.com/metanorma/emf2svg-ruby. This project is intended to be a
276
+ https://github.com/claricle/emf2svg-ruby. This project is intended to be a
219
277
  safe, welcoming space for collaboration, and contributors are expected to adhere
220
278
  to the
221
- https://github.com/metanorma/emf2svg-ruby/blob/master/CODE_OF_CONDUCT.md[code of conduct].
279
+ https://github.com/claricle/emf2svg-ruby/blob/main/CODE_OF_CONDUCT.md[code of conduct].
222
280
 
223
281
 
224
282
  == Code of Conduct
225
283
 
226
284
  Everyone interacting in the emf2svg project's codebases, issue trackers, chat
227
- rooms and mailing lists is expected to follow the
228
- https://github.com/metanorma/emf2svg-ruby/blob/master/CODE_OF_CONDUCT.md[code of conduct].
285
+ rooms, mailing lists is expected to follow the
286
+ https://github.com/claricle/emf2svg-ruby/blob/main/CODE_OF_CONDUCT.md[code of conduct].
data/emf2svg.gemspec CHANGED
@@ -9,13 +9,13 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["open.source@ribose.com"]
10
10
 
11
11
  spec.summary = "EMF to SVG conversion in Ruby."
12
- spec.homepage = "https://github.com/metanorma/emf2svg-ruby"
12
+ spec.homepage = "https://github.com/claricle/emf2svg-ruby"
13
13
  spec.license = "BSD-2-Clause"
14
14
  spec.required_ruby_version = ">= 2.7.0"
15
15
 
16
16
  spec.metadata["homepage_uri"] = spec.homepage
17
- spec.metadata["source_code_uri"] = "https://github.com/metanorma/emf2svg-ruby"
18
- spec.metadata["changelog_uri"] = "https://github.com/metanorma/emf2svg-ruby"
17
+ spec.metadata["source_code_uri"] = "https://github.com/claricle/emf2svg-ruby"
18
+ spec.metadata["changelog_uri"] = "https://github.com/claricle/emf2svg-ruby/blob/main/README.adoc#versioning"
19
19
 
20
20
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
21
21
  `git ls-files -z`.split("\x0").reject do |f|
@@ -26,12 +26,8 @@ Gem::Specification.new do |spec|
26
26
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = ["lib"]
28
28
 
29
- spec.add_runtime_dependency "ffi", "~> 1.0"
30
- spec.add_runtime_dependency "mini_portile2", "~> 2.6"
31
-
32
- spec.add_development_dependency "rubocop", "1.5.2"
33
- spec.add_development_dependency "rubocop-performance", "~> 1.0"
34
- spec.add_development_dependency "rubocop-rails", "~> 2.0"
29
+ spec.add_dependency "ffi", "~> 1.0"
30
+ spec.add_dependency "mini_portile2", "~> 2.6"
35
31
 
36
32
  spec.extensions = ["ext/extconf.rb"]
37
33
  end
@@ -7,14 +7,20 @@ require_relative "version"
7
7
 
8
8
  module Emf2svg
9
9
  class Recipe < MiniPortileCMake
10
+ # Pinned vcpkg commit. Matches the SHA claricle/libemf2svg CI uses;
11
+ # bump deliberately to refresh the ports tree.
12
+ VCPKG_REF = "4f95fba7a7d1101bb8acdeb51e4609686449701e".freeze
13
+ VCPKG_URL = "https://github.com/microsoft/vcpkg.git".freeze
10
14
  ROOT = Pathname.new(File.expand_path("../..", __dir__))
11
15
 
12
16
  def initialize
13
17
  super("libemf2svg", LIBEMF2SVG_VERSION)
14
18
 
15
19
  @files << {
16
- url: "https://github.com/metanorma/libemf2svg/releases/download/v#{LIBEMF2SVG_VERSION}/libemf2svg.tar.gz",
17
- sha256: "c65f25040a351d18beb5172609a55d034245f85a1152d7f294780c6cc155d876", # rubocop:disable Layout/LineLength
20
+ # rubocop:disable Layout/LineLength
21
+ url: "https://github.com/claricle/libemf2svg/releases/download/v#{LIBEMF2SVG_VERSION}/libemf2svg.tar.gz",
22
+ sha256: "3782453987b477f2d8657c727e30f1e7a509188edfe6de2f7423443635aefd6d",
23
+ # rubocop:enable Layout/LineLength
18
24
  }
19
25
 
20
26
  @target = ROOT.join(@target).to_s
@@ -30,6 +36,39 @@ module Emf2svg
30
36
  FileUtils.touch(checkpoint)
31
37
  end
32
38
 
39
+ # Since libemf2svg v1.8.2 the source tarball no longer bundles the
40
+ # vcpkg tool (it moved too fast to ship as a snapshot). We bootstrap
41
+ # vcpkg into the work path before CMake configure runs.
42
+ def configure
43
+ bootstrap_vcpkg
44
+ super
45
+ end
46
+
47
+ def bootstrap_vcpkg
48
+ vcpkg_root = File.join(work_path, "vcpkg")
49
+ return if vcpkg_bootstrapped?(vcpkg_root)
50
+
51
+ message("Bootstrapping vcpkg@#{VCPKG_REF} into #{vcpkg_root}\n")
52
+ FileUtils.rm_rf(vcpkg_root)
53
+ execute("clone-vcpkg", "git clone --quiet #{VCPKG_URL} #{vcpkg_root}")
54
+ execute("checkout-vcpkg",
55
+ "git checkout --quiet #{VCPKG_REF}", cd: vcpkg_root)
56
+ execute("bootstrap-vcpkg", bootstrap_cmd, cd: vcpkg_root)
57
+ end
58
+
59
+ def vcpkg_bootstrapped?(vcpkg_root)
60
+ exe = MiniPortile.windows? ? "vcpkg.exe" : "vcpkg"
61
+ File.executable?(File.join(vcpkg_root, exe))
62
+ end
63
+
64
+ def bootstrap_cmd
65
+ if MiniPortile.windows?
66
+ "bootstrap-vcpkg.bat -disableMetrics"
67
+ else
68
+ "./bootstrap-vcpkg.sh -disableMetrics"
69
+ end
70
+ end
71
+
33
72
  def windows_native?
34
73
  MiniPortile.windows? && target_triplet.eql?("x64-mingw-static")
35
74
  end
@@ -79,10 +118,11 @@ module Emf2svg
79
118
  out, st = Open3.capture2("file #{l}")
80
119
  raise "Failed to query file #{l}: #{out}" unless st.exitstatus.zero?
81
120
 
82
- if out.include?(target_format)
121
+ if target_format.match?(out)
83
122
  message("Verifying #{l} ... OK\n")
84
123
  else
85
- raise "Invalid file format '#{out}', '#{@target_format}' expected"
124
+ fmt = target_format.source
125
+ raise "Invalid file format '#{out}', /#{fmt}/ expected"
86
126
  end
87
127
  end
88
128
  end
@@ -92,7 +132,7 @@ module Emf2svg
92
132
  Dir.glob(File.join(work_path, "Release", "*.dll"))
93
133
  else
94
134
  Dir.glob(File.join(work_path, "libemf2svg.{so,dylib}"))
95
- .grep(/\/(?:lib)?[a-zA-Z0-9\-]+\.(?:so|dylib)$/)
135
+ .grep(/\/(?:lib)?[a-zA-Z0-9-]+\.(?:so|dylib)$/)
96
136
  end
97
137
  FileUtils.cp_r(libs, ROOT.join("lib", "emf2svg"), verbose: true)
98
138
 
@@ -178,15 +218,18 @@ module Emf2svg
178
218
  @target_format ||=
179
219
  case target_platform
180
220
  when "arm64-darwin"
181
- "Mach-O 64-bit dynamically linked shared library arm64"
221
+ /Mach-O 64-bit dynamically linked shared library arm64/
182
222
  when "x86_64-darwin"
183
- "Mach-O 64-bit dynamically linked shared library x86_64"
223
+ /Mach-O 64-bit dynamically linked shared library x86_64/
184
224
  when "aarch64-linux"
185
- "ELF 64-bit LSB shared object, ARM aarch64"
225
+ /ELF 64-bit LSB shared object, ARM aarch64/
186
226
  when "x86_64-linux"
187
- "ELF 64-bit LSB shared object, x86-64"
227
+ /ELF 64-bit LSB shared object, x86-64/
188
228
  when /\Ax64-mingw(32|-ucrt)/
189
- "PE32+ executable (DLL) (console) x86-64, for MS Windows"
229
+ # Modern `file` prints e.g. "PE32+ executable for MS Windows 6.00
230
+ # (DLL), x86-64, 6 sections"; older prints "PE32+ executable
231
+ # (DLL) (console) x86-64, for MS Windows". Match the stable bits.
232
+ /PE32\+ executable.*\(DLL\).*x86-64/
190
233
  else
191
234
  "skip"
192
235
  end
@@ -1,6 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Emf2svg
4
- VERSION = "1.4.3"
5
- LIBEMF2SVG_VERSION = "1.7.1"
4
+ # Gem version follows the pattern:
5
+ #
6
+ # {LIBEMF2SVG_VERSION}.{LIBEMF2SVG_RUBY_ITERATION}
7
+ #
8
+ # where LIBEMF2SVG_VERSION is the upstream libemf2svg release this gem
9
+ # is built against, and LIBEMF2SVG_RUBY_ITERATION is a counter for
10
+ # Ruby-side changes (recipe bug fixes, CI changes, docs) that bump
11
+ # without a new libemf2svg release. The iteration resets to 0 each
12
+ # time LIBEMF2SVG_VERSION bumps.
13
+ #
14
+ # See README.adoc -> "Versioning" for the rationale and examples.
15
+ LIBEMF2SVG_VERSION = "1.8.2"
16
+ LIBEMF2SVG_RUBY_ITERATION = 0
17
+ VERSION = "#{LIBEMF2SVG_VERSION}.#{LIBEMF2SVG_RUBY_ITERATION}"
6
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emf2svg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.8.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-26 00:00:00.000000000 Z
11
+ date: 2026-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -38,49 +38,7 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.6'
41
- - !ruby/object:Gem::Dependency
42
- name: rubocop
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '='
46
- - !ruby/object:Gem::Version
47
- version: 1.5.2
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '='
53
- - !ruby/object:Gem::Version
54
- version: 1.5.2
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop-performance
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.0'
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop-rails
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '2.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '2.0'
83
- description:
41
+ description:
84
42
  email:
85
43
  - open.source@ribose.com
86
44
  executables:
@@ -108,14 +66,14 @@ files:
108
66
  - lib/emf2svg.rb
109
67
  - lib/emf2svg/recipe.rb
110
68
  - lib/emf2svg/version.rb
111
- homepage: https://github.com/metanorma/emf2svg-ruby
69
+ homepage: https://github.com/claricle/emf2svg-ruby
112
70
  licenses:
113
71
  - BSD-2-Clause
114
72
  metadata:
115
- homepage_uri: https://github.com/metanorma/emf2svg-ruby
116
- source_code_uri: https://github.com/metanorma/emf2svg-ruby
117
- changelog_uri: https://github.com/metanorma/emf2svg-ruby
118
- post_install_message:
73
+ homepage_uri: https://github.com/claricle/emf2svg-ruby
74
+ source_code_uri: https://github.com/claricle/emf2svg-ruby
75
+ changelog_uri: https://github.com/claricle/emf2svg-ruby/blob/main/README.adoc#versioning
76
+ post_install_message:
119
77
  rdoc_options: []
120
78
  require_paths:
121
79
  - lib
@@ -130,8 +88,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
88
  - !ruby/object:Gem::Version
131
89
  version: '0'
132
90
  requirements: []
133
- rubygems_version: 3.1.6
134
- signing_key:
91
+ rubygems_version: 3.5.22
92
+ signing_key:
135
93
  specification_version: 4
136
94
  summary: EMF to SVG conversion in Ruby.
137
95
  test_files: []