image_optim_pack 0.13.1 → 0.13.1.20260418

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +6 -6
  3. data/.github/workflows/build.yml +16 -4
  4. data/.github/workflows/cache-downloads.yml +53 -0
  5. data/.github/workflows/docker-build.yml +5 -0
  6. data/.github/workflows/livecheck.yml +6 -3
  7. data/CHANGELOG.markdown +4 -0
  8. data/Makefile +6 -2
  9. data/README.markdown +2 -1
  10. data/checksums.mk +1 -1
  11. data/image_optim_pack.gemspec +1 -1
  12. data/script/livecheck +41 -19
  13. data/script/platform_downloads +2 -0
  14. data/vendor/darwin-arm64/libpng.dylib +0 -0
  15. data/vendor/darwin-arm64/optipng +0 -0
  16. data/vendor/darwin-arm64/pngcrush +0 -0
  17. data/vendor/darwin-arm64/pngquant +0 -0
  18. data/vendor/darwin-x86_64/libpng.dylib +0 -0
  19. data/vendor/darwin-x86_64/optipng +0 -0
  20. data/vendor/darwin-x86_64/pngcrush +0 -0
  21. data/vendor/darwin-x86_64/pngquant +0 -0
  22. data/vendor/linux-aarch64-gnu/libpng.so +0 -0
  23. data/vendor/linux-aarch64-gnu/optipng +0 -0
  24. data/vendor/linux-aarch64-gnu/pngcrush +0 -0
  25. data/vendor/linux-aarch64-gnu/pngquant +0 -0
  26. data/vendor/linux-aarch64-musl/libpng.so +0 -0
  27. data/vendor/linux-aarch64-musl/optipng +0 -0
  28. data/vendor/linux-aarch64-musl/pngcrush +0 -0
  29. data/vendor/linux-aarch64-musl/pngquant +0 -0
  30. data/vendor/linux-x86_64-gnu/libpng.so +0 -0
  31. data/vendor/linux-x86_64-gnu/optipng +0 -0
  32. data/vendor/linux-x86_64-gnu/pngcrush +0 -0
  33. data/vendor/linux-x86_64-gnu/pngquant +0 -0
  34. data/vendor/linux-x86_64-musl/libpng.so +0 -0
  35. data/vendor/linux-x86_64-musl/optipng +0 -0
  36. data/vendor/linux-x86_64-musl/pngcrush +0 -0
  37. data/vendor/linux-x86_64-musl/pngquant +0 -0
  38. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a81ae61f728c591eba70ec2aee4b6f979e297c13a76f3023a06149ff854d173
4
- data.tar.gz: 8a11d77aa571c600b1392bf236cc3e43761bfae0718bd2b69d14d353bb73dc76
3
+ metadata.gz: e16756c0ef6b7711b0e39587a69fa25580afe84ee1bdf42025c31d6c975a58ac
4
+ data.tar.gz: c430c7c7c44c0fa80ee84b76ec6250575f960aef42793792d087eec3f685b55d
5
5
  SHA512:
6
- metadata.gz: ebc8894904563dc3d35f0eca936a99e8c953ea7b60e48e28e6dde07dc0eb6632e48347dbae9dd8e9a2307799127f779adc0afb5d59f3b7cac00b9c205ab444e7
7
- data.tar.gz: c146caf1f824f1645783f6877e558b88bbf61dfa228491a3b6690e30e5a46dff4b3b4ded5797908b3698985232801e526fbc6371d45d37c3e1e2df8b9333aaea
6
+ metadata.gz: 0c8d9df9bfaadb6aaf0a5009f7a724a62349d28b991816c682a93ad18937365cafb894d1fe885f244d87cb8019b7513255466552d6194936d3ce06b86ea51aeb
7
+ data.tar.gz: 0b79ddb594329a18fdb1f8e575cece74c85f01339308c81a38d816663d8cf045845ba18b26b144b4482bff544d4c94d93d43e656463c89d375f21505d2ecc993
@@ -1,8 +1,8 @@
1
1
  version: 2
2
2
  updates:
3
- - package-ecosystem: github-actions
4
- directory: /
5
- schedule:
6
- interval: daily
7
- cooldown:
8
- default-days: 7
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ schedule:
6
+ interval: daily
7
+ cooldown:
8
+ default-days: 7
@@ -11,11 +11,15 @@ jobs:
11
11
  runs-on: ${{ case(matrix.arch == 'x86_64', 'ubuntu-latest', 'ubuntu-22.04-arm') }}
12
12
  steps:
13
13
  - uses: actions/checkout@v6
14
+ - uses: actions/cache/restore@v5
15
+ with:
16
+ path: download
17
+ key: download-${{ hashFiles('checksums.mk') }}
18
+ fail-on-cache-miss: true
14
19
  - run: uname -m && test "$(uname -m)" = "${{ matrix.arch }}"
15
20
  - run: make test
16
21
  - run: rm -r vendor
17
22
  - run: sudo apt-get install -y chrpath
18
- - run: make download download-dependencies
19
23
  - run: make all -j
20
24
  - uses: actions/upload-artifact@v7
21
25
  with:
@@ -30,13 +34,17 @@ jobs:
30
34
  runs-on: ${{ case(matrix.arch == 'x86_64', 'ubuntu-latest', 'ubuntu-22.04-arm') }}
31
35
  steps:
32
36
  - uses: actions/checkout@v6
37
+ - uses: actions/cache/restore@v5
38
+ with:
39
+ path: download
40
+ key: download-${{ hashFiles('checksums.mk') }}
41
+ fail-on-cache-miss: true
33
42
  - run: docker run -di --rm --name build -v ${{ github.workspace }}:/work -w /work rust:alpine
34
43
  - run: docker exec build sh -c 'uname -m && test "$(uname -m)" = "${{ matrix.arch }}"'
35
44
  - run: docker exec build apk add --no-cache make file perl
36
45
  - run: docker exec build make test
37
46
  - run: docker exec build rm -r vendor
38
- - run: docker exec build apk add --no-cache gcc g++ chrpath pkgconf autoconf automake libtool nasm cmake patch wget
39
- - run: docker exec build make download download-dependencies
47
+ - run: docker exec build apk add --no-cache gcc g++ chrpath pkgconf autoconf automake libtool nasm cmake patch
40
48
  - run: docker exec build make all -j
41
49
  - run: docker stop build
42
50
  if: always()
@@ -54,10 +62,14 @@ jobs:
54
62
  runs-on: ${{ case(matrix.arch == 'x86_64', 'macos-15-intel', 'macos-14') }}
55
63
  steps:
56
64
  - uses: actions/checkout@v6
65
+ - uses: actions/cache/restore@v5
66
+ with:
67
+ path: download
68
+ key: download-${{ hashFiles('checksums.mk') }}
69
+ fail-on-cache-miss: true
57
70
  - run: uname -m && test "$(uname -m)" = "${{ matrix.arch }}"
58
71
  - run: make test ARCH="${{ matrix.build }}"
59
72
  - run: rm -r vendor
60
- - run: make download download-dependencies
61
73
  - run: rustup target add "${{ case(matrix.build == 'arm64', 'aarch64', matrix.build) }}-apple-darwin"
62
74
  if: ${{ matrix.build != matrix.arch }}
63
75
  - run: make all -j ARCH="${{ matrix.build }}"
@@ -0,0 +1,53 @@
1
+ name: cache-downloads
2
+ on:
3
+ schedule:
4
+ - cron: 7 10 */3 * *
5
+ workflow_dispatch:
6
+ inputs:
7
+ retry:
8
+ description: 'Retry attempt'
9
+ required: true
10
+ type: number
11
+ jobs:
12
+ cache-downloads:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v6
16
+ - uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: '4'
19
+ bundler-cache: true
20
+ - id: cache-restore
21
+ uses: actions/cache/restore@v5
22
+ with:
23
+ path: download
24
+ key: download-${{ hashFiles('checksums.mk') }}
25
+ restore-keys: download-
26
+ - run: make download-tidy-up
27
+ - run: make download
28
+ - run: make download-dependencies
29
+ - uses: actions/cache/save@v5
30
+ with:
31
+ path: download
32
+ key: download-${{ hashFiles('checksums.mk') }}
33
+ if: steps.cache-restore.outputs.cache-hit != 'true'
34
+ - run: make purge-dependencies
35
+ - env:
36
+ RETRY: ${{ inputs.retry }}
37
+ RETRIES: 3
38
+ GITHUB_TOKEN: ${{ secrets.RETRY_TOKEN }}
39
+ run: |
40
+ make update-versions || {
41
+ exit_code=$?
42
+ if (( ${RETRY:-0} < $RETRIES )); then
43
+ sleep $(( ($RETRY + 0) * 30 ))
44
+ gh workflow run "$GITHUB_WORKFLOW" --repo "$GITHUB_REPOSITORY" --ref "$GITHUB_REF_NAME" -f retry=$(( $RETRY + 1 ))
45
+ else
46
+ exit $exit_code
47
+ fi
48
+ }
49
+ - uses: actions/cache@v5
50
+ with:
51
+ path: download
52
+ key: download-${{ hashFiles('checksums.mk') }}
53
+ lookup-only: true
@@ -14,6 +14,11 @@ jobs:
14
14
  fail-fast: false
15
15
  steps:
16
16
  - uses: actions/checkout@v6
17
+ - uses: actions/cache/restore@v5
18
+ with:
19
+ path: download
20
+ key: download-${{ hashFiles('checksums.mk') }}
21
+ fail-on-cache-miss: true
17
22
  - uses: docker/login-action@v4
18
23
  with:
19
24
  registry: ghcr.io
@@ -21,15 +21,18 @@ jobs:
21
21
  bundler-cache: true
22
22
  - env:
23
23
  RETRY: ${{ inputs.retry }}
24
- RETRIES: 10
24
+ RETRIES: 3
25
25
  GITHUB_TOKEN: ${{ secrets.RETRY_TOKEN }}
26
26
  run: |
27
- bundle exec script/livecheck || {
27
+ script/livecheck || {
28
28
  exit_code=$?
29
29
  if (( $exit_code == 2 )) && (( ${RETRY:-0} < $RETRIES )); then
30
30
  sleep 300
31
- gh workflow run livecheck --repo $GITHUB_REPOSITORY --ref $GITHUB_REF_NAME -f retry=$(( $RETRY + 1 ))
31
+ gh workflow run "$GITHUB_WORKFLOW" --repo "$GITHUB_REPOSITORY" --ref "$GITHUB_REF_NAME" -f retry=$(( $RETRY + 1 ))
32
32
  else
33
+ if (( $exit_code == 1 )); then
34
+ gh workflow run cache-downloads --repo "$GITHUB_REPOSITORY" --ref "$GITHUB_REF_NAME" -f retry=0
35
+ fi
33
36
  exit $exit_code
34
37
  fi
35
38
  }
data/CHANGELOG.markdown CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## unreleased
4
4
 
5
+ ## v0.13.1.20260418 (2026-04-18)
6
+
7
+ * libpng 1.6.58 [@toy](https://github.com/toy)
8
+
5
9
  ## v0.13.1 (2026-04-12)
6
10
 
7
11
  * Add linux-x86_64 and linux-aarch64 platforms including two vendor dirs each [@toy](https://github.com/toy)
data/Makefile CHANGED
@@ -15,7 +15,7 @@ JPEGOPTIM_VER := 1.5.6
15
15
  LIBJPEG_VER := 9f
16
16
  LIBLCMS2_VER := 2.17
17
17
  LIBMOZJPEG_VER := 4.1.5
18
- LIBPNG_VER := 1.6.57
18
+ LIBPNG_VER := 1.6.58
19
19
  LIBZ_VER := 1.3.2
20
20
  OPTIPNG_VER := 7.9.1
21
21
  OXIPNG_VER := 10.1.0
@@ -139,8 +139,12 @@ download-dependencies : $(OXIPNG_EXTRACTED) $(PNGQUANT_EXTRACTED)
139
139
  cd $(PNGQUANT_DIR) && cargo fetch --locked
140
140
  .PHONY : download-dependencies
141
141
 
142
+ purge-dependencies :
143
+ rm -rf $(CARGO_HOME)
144
+ .PHONY : purge-dependencies
145
+
142
146
  download-tidy-up :
143
- rm -f $(filter-out $(foreach archive,$(ARCHIVES),$($(archive)_ARC)),$(wildcard $(DL_DIR)/*.*))
147
+ rm -fv $(filter-out $(foreach archive,$(ARCHIVES),$($(archive)_ARC)),$(wildcard $(DL_DIR)/*.*))
144
148
  .PHONY : download-tidy-up
145
149
 
146
150
  checksum : download
data/README.markdown CHANGED
@@ -1,9 +1,10 @@
1
1
  [![Gem Version](https://img.shields.io/gem/v/image_optim_pack?logo=rubygems)](https://rubygems.org/gems/image_optim_pack)
2
2
  [![Check](https://img.shields.io/github/actions/workflow/status/toy/image_optim_pack/check.yml?label=check&logo=github)](https://github.com/toy/image_optim_pack/actions/workflows/check.yml)
3
3
  [![Rubocop](https://img.shields.io/github/actions/workflow/status/toy/image_optim_pack/rubocop.yml?label=rubocop&logo=rubocop)](https://github.com/toy/image_optim_pack/actions/workflows/rubocop.yml)
4
+ [![Build](https://img.shields.io/github/actions/workflow/status/toy/image_optim_pack/build.yml?label=build&logo=github)](https://github.com/toy/image_optim_pack/actions/workflows/build.yml)
4
5
  [![Docker build](https://img.shields.io/github/actions/workflow/status/toy/image_optim_pack/docker-build.yml?label=docker+build&logo=docker)](https://github.com/toy/image_optim_pack/actions/workflows/docker-build.yml)
5
6
  [![Livecheck](https://img.shields.io/github/actions/workflow/status/toy/image_optim_pack/livecheck.yml?label=livecheck&logo=github)](https://github.com/toy/image_optim_pack/actions/workflows/livecheck.yml)
6
- [![Build](https://img.shields.io/github/actions/workflow/status/toy/image_optim_pack/build.yml?label=build&logo=github)](https://github.com/toy/image_optim_pack/actions/workflows/build.yml)
7
+ [![Cache downloads](https://img.shields.io/github/actions/workflow/status/toy/image_optim_pack/cache-downloads.yml?label=cache-downloads&logo=github)](https://github.com/toy/image_optim_pack/actions/workflows/cache-downloads.yml)
7
8
  [![Depfu](https://img.shields.io/depfu/toy/image_optim_pack)](https://depfu.com/github/toy/image_optim_pack)
8
9
  [![Inch CI](https://inch-ci.org/github/toy/image_optim_pack.svg?branch=master)](https://inch-ci.org/github/toy/image_optim_pack)
9
10
 
data/checksums.mk CHANGED
@@ -6,7 +6,7 @@ JPEGOPTIM_SHA256 := 661a808dfffa933d78c6beb47a2937d572b9f03e94cbaaab3d4c0d72f410
6
6
  LIBJPEG_SHA256 := 04705c110cb2469caa79fb71fba3d7bf834914706e9641a4589485c1f832565b
7
7
  LIBLCMS2_SHA256 := d11af569e42a1baa1650d20ad61d12e41af4fead4aa7964a01f93b08b53ab074
8
8
  LIBMOZJPEG_SHA256 := 9fcbb7171f6ac383f5b391175d6fb3acde5e64c4c4727274eade84ed0998fcc1
9
- LIBPNG_SHA256 := 01fdab044cdc575c74a9ef62a4042fbe24fea8bedfe8aa5c89f4467b781bbb60
9
+ LIBPNG_SHA256 := 8c9b05b675ca7301a458df2c2e46f26e1d41ff36b8863f8c33530bc58c2e6225
10
10
  LIBZ_SHA256 := b99a0b86c0ba9360ec7e78c4f1e43b1cbdf1e6936c8fa0f6835c0cd694a495a1
11
11
  OPTIPNG_SHA256 := c2579be58c2c66dae9d63154edcb3d427fef64cb00ec0aff079c9d156ec46f29
12
12
  OXIPNG_SHA256 := 6c5e1d021a844ba730193943ab63ad99e7d9f1089c36f3db59014517ea99cf99
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'image_optim_pack'
5
- s.version = '0.13.1'
5
+ s.version = '0.13.1.20260418'
6
6
  s.summary = %q{Precompiled binaries for image_optim: advpng, gifsicle, jhead, jpeg-recompress, jpegoptim, jpegtran, optipng, oxipng, pngcrush, pngout, pngquant}
7
7
  s.homepage = "https://github.com/toy/#{s.name}"
8
8
  s.authors = ['Ivan Kuchin']
data/script/livecheck CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ require 'bundler/setup'
5
+
4
6
  require 'uri'
5
7
  require 'net/http'
6
8
  require 'openssl'
@@ -94,12 +96,13 @@ Thread.report_on_exception = false
94
96
  # Fetch and compare latest tool/library versions
95
97
  class Livecheck
96
98
  # Commands
97
- class Cli
99
+ class CLI
98
100
  VERSION_REGEXP = /^([A-Z_]+)_VER *:= *([^$\n]*)$/.freeze
99
101
 
100
102
  def initialize(args)
101
103
  @update = args.delete('--update')
102
- abort '--update is the only supported option' unless args.empty?
104
+ @verbose = args.delete('--verbose')
105
+ abort '--update and --verbose are the only supported options' unless args.empty?
103
106
  end
104
107
 
105
108
  def run
@@ -153,7 +156,7 @@ class Livecheck
153
156
 
154
157
  def livechecks
155
158
  @livechecks ||= makefile.read.scan(VERSION_REGEXP).map do |name, version|
156
- Livecheck.new(name.downcase, version)
159
+ Livecheck.new(name.downcase, version, @verbose)
157
160
  end
158
161
  end
159
162
 
@@ -202,6 +205,12 @@ class Livecheck
202
205
  end
203
206
  end
204
207
 
208
+ def hash
209
+ @string.hash
210
+ end
211
+
212
+ alias_method :eql?, :==
213
+
205
214
  def <=>(other)
206
215
  if parsed && other.parsed
207
216
  parsed <=> other.parsed
@@ -211,16 +220,32 @@ class Livecheck
211
220
  end
212
221
  end
213
222
 
223
+ # Don't fetch twice
224
+ module Fetcher
225
+ @cache = {}
226
+
227
+ def self.get(url, verbose)
228
+ @cache[url] ||= Thread.new do
229
+ $stderr << "GET #{url}\n" if verbose
230
+ uri = URI(url)
231
+ http = Net::HTTP.new(uri.host, uri.port)
232
+ http.use_ssl = (uri.scheme == 'https')
233
+ http.request_get(uri.request_uri).body
234
+ end
235
+ end
236
+ end
237
+
214
238
  attr_reader :name, :current_version
215
239
 
216
- def initialize(name, current_version)
240
+ def initialize(name, current_version, verbose)
217
241
  @name = name
242
+ @verbose = verbose
218
243
  @current_version = Version.new(current_version)
219
- @fetcher = Thread.new{ fetch_versions.last }
244
+ @fetcher = Fetcher.get(config[:url], verbose)
220
245
  end
221
246
 
222
247
  def latest_version
223
- @fetcher.value
248
+ versions.last
224
249
  end
225
250
 
226
251
  def changed?
@@ -241,23 +266,20 @@ private
241
266
  CONFIG[name.to_sym] || fail(ArgumentError, "Livecheck for #{name} not defined")
242
267
  end
243
268
 
244
- def get(url)
245
- uri = URI(url)
246
- http = Net::HTTP.new(uri.host, uri.port)
247
- http.use_ssl = (uri.scheme == 'https')
248
- http.request_get(uri.request_uri).body
249
- end
269
+ def versions
270
+ @versions ||= begin
271
+ body = @fetcher.value
250
272
 
251
- def fetch_versions
252
- body = get(config[:url])
273
+ version_regex = config[:regexp]
253
274
 
254
- version_regex = config[:regexp]
275
+ versions = body.scan(version_regex).map{ |match| Version.new(*match) }.uniq.sort
276
+ fail "No versions found for #{name} in body:\n#{body}" if versions.empty?
255
277
 
256
- versions = body.scan(version_regex).map{ |match| Version.new(*match) }.sort
257
- fail "No versions found for #{name} in body:\n#{body}" if versions.empty?
278
+ $stderr << "#{name}: #{versions.join(', ')}\n" if @verbose
258
279
 
259
- versions
280
+ versions
281
+ end
260
282
  end
261
283
  end
262
284
 
263
- Livecheck::Cli.new(ARGV).run
285
+ Livecheck::CLI.new(ARGV).run
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ require 'bundler/setup'
5
+
4
6
  require 'gems'
5
7
  require 'ostruct'
6
8
  require 'terminal-table'
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_optim_pack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.13.1.20260418
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Kuchin
@@ -98,6 +98,7 @@ files:
98
98
  - ".dockerignore"
99
99
  - ".github/dependabot.yml"
100
100
  - ".github/workflows/build.yml"
101
+ - ".github/workflows/cache-downloads.yml"
101
102
  - ".github/workflows/check.yml"
102
103
  - ".github/workflows/docker-build.yml"
103
104
  - ".github/workflows/livecheck.yml"
@@ -253,7 +254,7 @@ licenses:
253
254
  metadata:
254
255
  bug_tracker_uri: https://github.com/toy/image_optim_pack/issues
255
256
  changelog_uri: https://github.com/toy/image_optim_pack/blob/master/CHANGELOG.markdown
256
- documentation_uri: https://www.rubydoc.info/gems/image_optim_pack/0.13.1
257
+ documentation_uri: https://www.rubydoc.info/gems/image_optim_pack/0.13.1.20260418
257
258
  source_code_uri: https://github.com/toy/image_optim_pack
258
259
  rdoc_options: []
259
260
  require_paths: