resizing 1.2.2 → 1.4.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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer/Dockerfile +73 -0
  3. data/.devcontainer/compose.yaml +61 -0
  4. data/.devcontainer/devcontainer-lock.json +9 -0
  5. data/.devcontainer/devcontainer.json +32 -0
  6. data/.devcontainer/post-create.sh +41 -0
  7. data/.github/copilot-instructions.md +1 -0
  8. data/.github/dependabot.yml +23 -0
  9. data/.github/labeler.yml +28 -0
  10. data/.github/release.yml +35 -0
  11. data/.github/tools/actionlint/Dockerfile +3 -0
  12. data/.github/tools/gitleaks/Dockerfile +2 -0
  13. data/.github/workflows/actionlint.yml +27 -0
  14. data/.github/workflows/actions.lock +54 -0
  15. data/.github/workflows/labeler.yml +22 -0
  16. data/.github/workflows/lint.yml +37 -0
  17. data/.github/workflows/secret-scan.yml +29 -0
  18. data/.github/workflows/test.yml +51 -13
  19. data/.github/workflows/verify-lockfile.yml +28 -0
  20. data/AGENTS.md +1 -0
  21. data/CHANGELOG.md +3 -0
  22. data/CLAUDE.md +68 -0
  23. data/Gemfile +12 -3
  24. data/README.ja.md +241 -0
  25. data/README.md +196 -2
  26. data/Rakefile +5 -7
  27. data/bin/setup +3 -0
  28. data/docker-compose.yml +7 -0
  29. data/git-hooks/pre-push +6 -0
  30. data/git-hooks/pre-push-ruby.sh +53 -0
  31. data/lib/resizing/carrier_wave/callback_file.rb +88 -0
  32. data/lib/resizing/carrier_wave/storage/file.rb +105 -38
  33. data/lib/resizing/carrier_wave/storage/remote.rb +25 -16
  34. data/lib/resizing/carrier_wave.rb +109 -6
  35. data/lib/resizing/client.rb +47 -4
  36. data/lib/resizing/configurable.rb +1 -1
  37. data/lib/resizing/configuration.rb +40 -10
  38. data/lib/resizing/mock_client.rb +48 -9
  39. data/lib/resizing/public_id.rb +3 -2
  40. data/lib/resizing/version.rb +1 -1
  41. data/lib/resizing.rb +4 -1
  42. data/resizing.gemspec +3 -3
  43. data/test/rails_app/app/views/users/new.html.erb +6 -0
  44. data/test/rails_app/rails_app.rb +86 -0
  45. data/test/resizing/carrier_wave/storage/file_test.rb +495 -9
  46. data/test/resizing/carrier_wave/storage/remote_test.rb +151 -12
  47. data/test/resizing/carrier_wave_cache_callbacks_test.rb +224 -0
  48. data/test/resizing/carrier_wave_callback_file_test.rb +77 -0
  49. data/test/resizing/carrier_wave_rails_integration_test.rb +94 -0
  50. data/test/resizing/carrier_wave_temporary_image_test.rb +280 -0
  51. data/test/resizing/carrier_wave_test.rb +214 -30
  52. data/test/resizing/carrier_wave_uploader_test.rb +225 -0
  53. data/test/resizing/client_test.rb +419 -30
  54. data/test/resizing/configuration_test.rb +235 -10
  55. data/test/resizing/http_clientable_test.rb +27 -0
  56. data/test/resizing/mock_client_test.rb +145 -1
  57. data/test/resizing/public_id_test.rb +96 -0
  58. data/test/resizing_module_test.rb +126 -0
  59. data/test/resizing_test.rb +8 -0
  60. data/test/test_helper.rb +318 -9
  61. data/test/vcr/carrier_wave_test/confirm.yml +23 -0
  62. data/test/vcr/carrier_wave_test/retrieve_from_cache.yml +23 -0
  63. data/test/vcr/carrier_wave_test/save.yml +1 -1
  64. data/test/vcr/carrier_wave_test/update_image.yml +42 -2
  65. metadata +47 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97be4b8cf7324441cfa73563ea4f102ac47b947fc95adb9ccbad206fe802f785
4
- data.tar.gz: ae8df42cb9197bdfc81874d83027e266ba523e3e0c90605ddafc93b310da4368
3
+ metadata.gz: a3e94426f43cec8a3f2e0ff353fbe80de1f826599c2f5c1347152b70f67355dc
4
+ data.tar.gz: 27be738a572a08c1c059cf312a7f86487f5b3f4c2a693450f4aec38b856aa6b2
5
5
  SHA512:
6
- metadata.gz: 56a57d325523e21d22a6e3c77c3907e6ec8860433e6524d8ee89da79381f29f56bb7b79af37805ab4be46c921b4e70c5cceb99039de947231c50f7838c4fa544
7
- data.tar.gz: 18c995f91897d11813477ea16298c2e3101c352f611ecf84e23fb57954e86b6d2c44d28a48515f3df42548b27b0bbebb2b413af85797ce246e9ef22e52d71639
6
+ metadata.gz: 2842a8b98e345387267078eb4094975248ede7453f0b20028831be6599f96614c7119e0ff8fe986295238e304bf5af73ce8d38a7ee7eee4bfc611e2fe2f08ed4
7
+ data.tar.gz: 8af5ab4079f72664958e345ef1ac0ff6a39bd028751a5591e45833171d9e838249c821943c79cb39f24b139a00e35f286a5f56981c4a40432e0d7f6854ef5afe
@@ -0,0 +1,73 @@
1
+ # Debian variant of the base image (bookworm / bullseye)
2
+ ARG VARIANT=bookworm
3
+ FROM mcr.microsoft.com/devcontainers/base:${VARIANT}
4
+
5
+ # Ruby installed and set as the rbenv global version. Matches .ruby-version.
6
+ # Other versions can be installed from inside the container with `rbenv install`.
7
+ ARG RUBY_VERSION=3.1.7
8
+
9
+ # Build dependencies for ruby-build, plus what the mysql2 gem needs.
10
+ # The MySQL packages match .github/workflows/test.yml.
11
+ RUN apt-get update \
12
+ && export DEBIAN_FRONTEND=noninteractive \
13
+ && apt-get install -y --no-install-recommends \
14
+ autoconf \
15
+ bison \
16
+ build-essential \
17
+ libffi-dev \
18
+ libgdbm-dev \
19
+ libncurses-dev \
20
+ libreadline-dev \
21
+ libssl-dev \
22
+ libyaml-dev \
23
+ uuid-dev \
24
+ zlib1g-dev \
25
+ default-libmysqlclient-dev \
26
+ default-mysql-client \
27
+ pkg-config \
28
+ && apt-get clean \
29
+ && rm -rf /var/lib/apt/lists/*
30
+
31
+ ENV RBENV_ROOT=/usr/local/rbenv
32
+ ENV PATH=${RBENV_ROOT}/shims:${RBENV_ROOT}/bin:${PATH}
33
+
34
+ # rbenv and ruby-build. RBENV_ROOT is owned by vscode so that `rbenv install`
35
+ # works from inside the container without sudo.
36
+ RUN git clone --depth 1 https://github.com/rbenv/rbenv.git "${RBENV_ROOT}" \
37
+ && git clone --depth 1 https://github.com/rbenv/ruby-build.git "${RBENV_ROOT}/plugins/ruby-build" \
38
+ && printf '%s\n' \
39
+ 'export RBENV_ROOT=/usr/local/rbenv' \
40
+ 'export PATH="$RBENV_ROOT/shims:$RBENV_ROOT/bin:$PATH"' \
41
+ 'eval "$(rbenv init -)"' \
42
+ > /etc/profile.d/rbenv.sh
43
+
44
+ RUN rbenv install "${RUBY_VERSION}" \
45
+ && rbenv global "${RUBY_VERSION}" \
46
+ && gem install bundler \
47
+ && rbenv rehash \
48
+ && chown -R vscode:vscode "${RBENV_ROOT}"
49
+
50
+ # Install gems into a named volume, so nothing is written to the bind-mounted
51
+ # workspace and a rebuild does not have to fetch them again.
52
+ ENV BUNDLE_PATH=/usr/local/bundle
53
+
54
+ RUN mkdir -p "${BUNDLE_PATH}" && chown -R vscode:vscode "${BUNDLE_PATH}"
55
+
56
+ # Ruby artifacts generated on the host must not leak in through the bind mount:
57
+ # vendor/ holds gems with native extensions built against the host's glibc,
58
+ # .bundle/config points BUNDLE_PATH at it, and .ruby-lsp/ records which gems the
59
+ # Ruby LSP extension has installed. compose.yaml keeps all three on their own
60
+ # volumes; creating the directories here gives those volumes the right owner.
61
+ RUN mkdir -p /workspaces/resizing-gem/vendor \
62
+ /workspaces/resizing-gem/.bundle \
63
+ /workspaces/resizing-gem/.ruby-lsp \
64
+ && chown -R vscode:vscode /workspaces
65
+
66
+ # Bundler's global config, so that BUNDLE_PATH also applies to tools that
67
+ # compose their own bundle with a clean environment. The Ruby LSP extension
68
+ # builds one under .ruby-lsp/, which makes that directory bundler's app root,
69
+ # so a config in the workspace root would not be read for it.
70
+ RUN mkdir -p /home/vscode/.bundle \
71
+ && printf '%s\n' '---' 'BUNDLE_PATH: "/usr/local/bundle"' \
72
+ > /home/vscode/.bundle/config \
73
+ && chown -R vscode:vscode /home/vscode/.bundle
@@ -0,0 +1,61 @@
1
+ services:
2
+ app:
3
+ build:
4
+ context: ..
5
+ dockerfile: .devcontainer/Dockerfile
6
+ args:
7
+ # Default Ruby version. Other versions can be installed from inside the
8
+ # container with `rbenv install`, so this rarely needs changing.
9
+ RUBY_VERSION: 3.1.7
10
+ command: sleep infinity
11
+ environment:
12
+ # test/test_helper.rb reads these to build the ActiveRecord connection.
13
+ # MYSQL_DATABASE is left unset on purpose: the tests then create a database
14
+ # per process and drop it afterwards, which keeps concurrent runs isolated.
15
+ MYSQL_HOST: db
16
+ MYSQL_PORT: '3306'
17
+ MYSQL_USER: root
18
+ MYSQL_PASSWORD: secret
19
+ # RAILS_VERSION is left unset on purpose: the Gemfile then picks the newest
20
+ # Rails that runs on the container's Ruby. Set it here to pin another version.
21
+ volumes:
22
+ - ..:/workspaces/resizing-gem:cached
23
+ - bundle:/usr/local/bundle
24
+ # Not shared with the host: see the Dockerfile
25
+ - vendor:/workspaces/resizing-gem/vendor
26
+ - bundle-config:/workspaces/resizing-gem/.bundle
27
+ - ruby-lsp:/workspaces/resizing-gem/.ruby-lsp
28
+ depends_on:
29
+ db:
30
+ condition: service_healthy
31
+
32
+ db:
33
+ image: mysql:5.7.29
34
+ # mysql:5.7 is published for amd64 only, so run it emulated on Apple Silicon
35
+ platform: linux/amd64
36
+ command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_bin
37
+ # MySQL 5.7 sizes its file descriptor tables from the nofile limit. On hosts
38
+ # where containerd runs with LimitNOFILE=infinity, containers inherit about
39
+ # 2^31, and mysqld then allocates tens of GB of memory and never gets ready.
40
+ ulimits:
41
+ nofile:
42
+ soft: 65536
43
+ hard: 65536
44
+ environment:
45
+ MYSQL_ROOT_PASSWORD: secret
46
+ MYSQL_DATABASE: resizing_gem_test
47
+ volumes:
48
+ - db-data:/var/lib/mysql
49
+ healthcheck:
50
+ test: ['CMD', 'mysqladmin', 'ping', '-h', '127.0.0.1', '-uroot', '-psecret']
51
+ interval: 5s
52
+ timeout: 5s
53
+ retries: 30
54
+ start_period: 30s
55
+
56
+ volumes:
57
+ bundle:
58
+ vendor:
59
+ bundle-config:
60
+ ruby-lsp:
61
+ db-data:
@@ -0,0 +1,9 @@
1
+ {
2
+ "features": {
3
+ "ghcr.io/devcontainers/features/github-cli:1": {
4
+ "version": "1.1.2",
5
+ "resolved": "ghcr.io/devcontainers/features/github-cli@sha256:7c409bf6316ffd85f04fd92fba85a744282639e603417dd4796409866bdb6805",
6
+ "integrity": "sha256:7c409bf6316ffd85f04fd92fba85a744282639e603417dd4796409866bdb6805"
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "resizing-gem",
3
+ "dockerComposeFile": "compose.yaml",
4
+ "service": "app",
5
+ "workspaceFolder": "/workspaces/resizing-gem",
6
+ "remoteUser": "vscode",
7
+ "features": {
8
+ "ghcr.io/devcontainers/features/github-cli:1": {}
9
+ },
10
+ "postCreateCommand": ".devcontainer/post-create.sh",
11
+ "customizations": {
12
+ "vscode": {
13
+ "extensions": [
14
+ "Shopify.ruby-lsp",
15
+ "eamodio.gitlens"
16
+ ],
17
+ "settings": {
18
+ "[ruby]": {
19
+ "editor.defaultFormatter": "Shopify.ruby-lsp",
20
+ "editor.tabSize": 2,
21
+ "editor.insertSpaces": true
22
+ },
23
+ "rubyLsp.formatter": "rubocop",
24
+ "rubyLsp.rubyVersionManager": {
25
+ "identifier": "rbenv"
26
+ },
27
+ "files.trimTrailingWhitespace": true,
28
+ "files.insertFinalNewline": true
29
+ }
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env bash
2
+ # Runs once after the dev container is created.
3
+ set -euo pipefail
4
+
5
+ # Honour a .ruby-version that asks for a Ruby the image does not carry.
6
+ # (.ruby-version is gitignored, so it differs from machine to machine.)
7
+ if [ -f .ruby-version ]; then
8
+ required="$(cat .ruby-version)"
9
+ if ! rbenv versions --bare | grep -qx "${required}"; then
10
+ echo "==> installing Ruby ${required} (from .ruby-version)"
11
+ rbenv install "${required}"
12
+ rbenv rehash
13
+ fi
14
+ fi
15
+
16
+ echo "==> ruby $(ruby -e 'print RUBY_VERSION')"
17
+
18
+ echo "==> bundle install"
19
+ bundle install
20
+
21
+ echo "==> waiting for MySQL (${MYSQL_HOST}:${MYSQL_PORT})"
22
+ for _ in $(seq 1 60); do
23
+ if mysqladmin ping \
24
+ -h "${MYSQL_HOST}" -P "${MYSQL_PORT}" \
25
+ -u "${MYSQL_USER}" -p"${MYSQL_PASSWORD}" \
26
+ --silent > /dev/null 2>&1; then
27
+ echo "MySQL is ready"
28
+ break
29
+ fi
30
+ sleep 1
31
+ done
32
+
33
+ cat <<'MSG'
34
+
35
+ setup done.
36
+
37
+ bundle exec rake test # run the tests
38
+ bundle exec rubocop # run the linter
39
+ bin/console # interactive prompt
40
+
41
+ MSG
@@ -0,0 +1 @@
1
+ ../CLAUDE.md
@@ -0,0 +1,23 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+
8
+ # The official tool images that CI runs, pinned by tag and digest in
9
+ # the Dockerfiles under .github/tools/.
10
+ - package-ecosystem: docker
11
+ directories:
12
+ - /.github/tools/actionlint
13
+ - /.github/tools/gitleaks
14
+ schedule:
15
+ interval: weekly
16
+
17
+ - package-ecosystem: github-actions
18
+ directory: /
19
+ schedule:
20
+ interval: weekly
21
+ groups:
22
+ github-actions:
23
+ patterns: ['*']
@@ -0,0 +1,28 @@
1
+ ruby:
2
+ - changed-files:
3
+ - any-glob-to-any-file:
4
+ - 'lib/**/*.rb'
5
+ - 'Rakefile'
6
+ - 'resizing.gemspec'
7
+ - '.rubocop.yml'
8
+
9
+ tests:
10
+ - changed-files:
11
+ - any-glob-to-any-file:
12
+ - 'test/**'
13
+
14
+ github_actions:
15
+ - changed-files:
16
+ - any-glob-to-any-file:
17
+ - '.github/**'
18
+
19
+ documentation:
20
+ - changed-files:
21
+ - any-glob-to-any-file:
22
+ - '**/*.md'
23
+
24
+ dependencies:
25
+ - changed-files:
26
+ - any-glob-to-any-file:
27
+ - 'Gemfile'
28
+ - 'Gemfile.lock'
@@ -0,0 +1,35 @@
1
+ changelog:
2
+ exclude:
3
+ labels:
4
+ - release
5
+ categories:
6
+ - title: Breaking Changes
7
+ labels:
8
+ - breaking change
9
+ - title: New Features
10
+ labels:
11
+ - enhancement
12
+ - title: Improvements
13
+ labels:
14
+ - improvement
15
+ - title: Bug Fixes
16
+ labels:
17
+ - bug
18
+ - title: Security
19
+ labels:
20
+ - security
21
+ - title: Dependencies
22
+ labels:
23
+ - dependencies
24
+ - title: CI
25
+ labels:
26
+ - github_actions
27
+ - title: Housekeeping
28
+ labels:
29
+ - housekeeping
30
+ - title: Documentation
31
+ labels:
32
+ - documentation
33
+ - title: Other Changes
34
+ labels:
35
+ - "*"
@@ -0,0 +1,3 @@
1
+ # The official actionlint image, pinned by digest and updated by Dependabot.
2
+ # It bundles shellcheck, which actionlint uses to check `run:` scripts.
3
+ FROM rhysd/actionlint:1.7.12@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667
@@ -0,0 +1,2 @@
1
+ # The official gitleaks image, pinned by digest and updated by Dependabot.
2
+ FROM zricethezav/gitleaks:v8.30.1@sha256:c00b6bd0aeb3071cbcb79009cb16a60dd9e0a7c60e2be9ab65d25e6bc8abbb7f
@@ -0,0 +1,27 @@
1
+ name: actionlint
2
+
3
+ on:
4
+ pull_request:
5
+ paths:
6
+ - .github/workflows/**
7
+ - .github/actionlint.yaml
8
+ - .github/tools/actionlint/**
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ actionlint:
15
+ runs-on: ubuntu-24.04
16
+ timeout-minutes: 10
17
+ steps:
18
+ - uses: actions/checkout@v7.0.1
19
+ with:
20
+ persist-credentials: false
21
+ # The official image, pinned by digest in the Dockerfile.
22
+ - name: Build actionlint image
23
+ run: docker build --quiet --tag actionlint .github/tools/actionlint
24
+ - name: Run actionlint
25
+ run: |
26
+ docker run --rm -v "$PWD:/repo" -w /repo actionlint -version
27
+ docker run --rm -v "$PWD:/repo" -w /repo actionlint -color
@@ -0,0 +1,54 @@
1
+ # This file is machine-generated by `gh actions-lock`.
2
+ # Do not edit by hand; run `gh actions-lock` to update.
3
+ # Docs: https://gh.io/actions-lockfile
4
+ version: 'v0.0.3'
5
+ workflows:
6
+ '.github/workflows/actionlint.yml':
7
+ - 'actions/checkout@v7.0.1'
8
+ '.github/workflows/labeler.yml':
9
+ - 'actions/labeler@v7.0.0'
10
+ '.github/workflows/lint.yml':
11
+ - 'actions/checkout@v7.0.1'
12
+ - 'ruby/setup-ruby@v1.338.0'
13
+ '.github/workflows/secret-scan.yml':
14
+ - 'actions/checkout@v7.0.1'
15
+ '.github/workflows/test.yml':
16
+ - 'actions/checkout@v7.0.1'
17
+ - 'codecov/codecov-action@v7.1.1'
18
+ - 'mirromutth/mysql-action@v1.1'
19
+ - 'ruby/setup-ruby@v1.338.0'
20
+ '.github/workflows/verify-lockfile.yml':
21
+ - 'actions/checkout@v7.0.1'
22
+ dependencies:
23
+ 'actions/checkout@v7.0.1':
24
+ ref: 'v7.0.1'
25
+ commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1'
26
+ owner_id: 44036562
27
+ repo_id: 197814629
28
+ 'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd':
29
+ ref: 'v8.0.0'
30
+ commit: 'sha1-ed597411d8f924073f98dfc5c65a23a2325f34cd'
31
+ owner_id: 44036562
32
+ repo_id: 205262760
33
+ 'actions/labeler@v7.0.0':
34
+ ref: 'v7.0.0'
35
+ commit: 'sha1-bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13'
36
+ owner_id: 44036562
37
+ repo_id: 177139928
38
+ 'codecov/codecov-action@v7.1.1':
39
+ ref: 'v7.1.1'
40
+ commit: 'sha1-303a32d7a59b442fa8d48b6a1cc6825c09c847a5'
41
+ owner_id: 8226205
42
+ repo_id: 200299178
43
+ uses:
44
+ - 'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd'
45
+ 'mirromutth/mysql-action@v1.1':
46
+ ref: 'v1.1'
47
+ commit: 'sha1-de1fba8b3f90ce8db80f663a7043be3cf3231248'
48
+ owner_id: 29607994
49
+ repo_id: 206556246
50
+ 'ruby/setup-ruby@v1.338.0':
51
+ ref: 'v1.338.0'
52
+ commit: 'sha1-b3aaceaef7e0ee231b499e7b5f49c03fc1d32199'
53
+ owner_id: 210414
54
+ repo_id: 231208785
@@ -0,0 +1,22 @@
1
+ name: labeler
2
+
3
+ on:
4
+ pull_request_target:
5
+ types:
6
+ - opened
7
+ - synchronize
8
+ - reopened
9
+
10
+ permissions: {}
11
+
12
+ jobs:
13
+ labeler:
14
+ runs-on: ubuntu-latest
15
+ permissions:
16
+ contents: read
17
+ pull-requests: write
18
+ steps:
19
+ - uses: actions/labeler@v7.0.0
20
+ with:
21
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
22
+ sync-labels: false
@@ -0,0 +1,37 @@
1
+ name: lint
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - master
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ rubocop:
14
+ name: RuboCop
15
+ runs-on: ubuntu-22.04
16
+
17
+ steps:
18
+ - uses: actions/checkout@v7.0.1
19
+
20
+ - name: "Install ruby dependencies"
21
+ run: |
22
+ sudo apt update
23
+ sudo apt install -y libyaml-dev curl libmysqlclient-dev
24
+
25
+ - uses: ruby/setup-ruby@v1.338.0
26
+ with:
27
+ # Matches the devcontainer, so local and CI report the same offenses
28
+ ruby-version: '3.1'
29
+ bundler-cache: false
30
+
31
+ - name: bundle install
32
+ run: |
33
+ bundle install
34
+
35
+ - name: Run RuboCop
36
+ run: |
37
+ bundle exec rubocop
@@ -0,0 +1,29 @@
1
+ name: Secret scan
2
+
3
+ on:
4
+ pull_request:
5
+
6
+ permissions:
7
+ contents: read
8
+
9
+ jobs:
10
+ gitleaks:
11
+ runs-on: ubuntu-24.04
12
+ timeout-minutes: 10
13
+ steps:
14
+ # Check out the PR head rather than the merge commit, so the scanned
15
+ # range is exactly the commits the PR adds.
16
+ - uses: actions/checkout@v7.0.1
17
+ with:
18
+ ref: ${{ github.event.pull_request.head.sha }}
19
+ fetch-depth: 0
20
+ persist-credentials: false
21
+ # The official image, pinned by digest in the Dockerfile.
22
+ - name: Build gitleaks image
23
+ run: docker build --quiet --tag gitleaks .github/tools/gitleaks
24
+ - name: Scan the PR commits
25
+ env:
26
+ BASE_REF: ${{ github.base_ref }}
27
+ run: |
28
+ docker run --rm -v "$PWD:/repo" -w /repo gitleaks version
29
+ docker run --rm -v "$PWD:/repo" -w /repo gitleaks git --log-opts="origin/$BASE_REF..HEAD" --redact --verbose .
@@ -7,35 +7,37 @@ on:
7
7
  - master
8
8
 
9
9
  permissions:
10
- id-token: write # This is required for codecov/codecov-action
11
10
  contents: read # This is required for actions/checkout
12
11
 
13
12
  jobs:
14
13
  test:
15
- name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}
14
+ name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }} / Faraday ${{ matrix.faraday }}
16
15
  strategy:
17
16
  fail-fast: false
18
17
  matrix:
19
- ruby: ['3.1', '3.2','3.3', '3.4']
20
- rails: ['6.1', '7.0', '7.1', '7.2']
18
+ ruby: ['3.1', '3.2', '3.3', '3.4', '4.0']
19
+ rails: ['7.0', '7.1', '7.2', '8.0', '8.1']
20
+ faraday: ['1.10', '2.0']
21
21
  exclude:
22
- # Rails 7.2 requires Ruby 3.1+
22
+ # Rails 8.x requires Ruby 3.2+
23
23
  - ruby: '3.1'
24
- rails: '7.2'
25
- # Rails 7.1 requires Ruby 3.1+
24
+ rails: '8.0'
26
25
  - ruby: '3.1'
26
+ rails: '8.1'
27
+ # Upstream does not support Ruby 4.0 on Rails 7.0 / 7.1
28
+ - ruby: '4.0'
29
+ rails: '7.0'
30
+ - ruby: '4.0'
27
31
  rails: '7.1'
28
- # Rails 6.1 requires Ruby under 3.3
29
- - ruby: '3.4'
30
- rails: '6.1'
31
32
 
32
33
  runs-on: ubuntu-22.04
33
34
 
34
35
  env:
35
36
  RAILS_VERSION: ${{ matrix.rails }}
37
+ FARADAY_VERSION: ${{ matrix.faraday }}
36
38
 
37
39
  steps:
38
- - uses: actions/checkout@v4
40
+ - uses: actions/checkout@v7.0.1
39
41
 
40
42
  - uses: mirromutth/mysql-action@v1.1
41
43
  with:
@@ -52,7 +54,7 @@ jobs:
52
54
  sudo apt update
53
55
  sudo apt install -y libyaml-dev curl libmysqlclient-dev
54
56
 
55
- - uses: ruby/setup-ruby@v1
57
+ - uses: ruby/setup-ruby@v1.338.0
56
58
  with:
57
59
  ruby-version: ${{ matrix.ruby }}
58
60
  bundler-cache: false
@@ -61,11 +63,47 @@ jobs:
61
63
  run: |
62
64
  bundle install
63
65
 
66
+ # Fail when the resolved Rails is not the one the matrix asks for, so that a
67
+ # loose Gemfile requirement cannot silently test another version
68
+ - name: Check Rails and Faraday versions
69
+ run: |
70
+ bundle exec ruby -e '
71
+ require "rails"
72
+ require "faraday"
73
+ puts "Rails #{Rails::VERSION::STRING} / Faraday #{Faraday::VERSION}"
74
+ expected = ENV.fetch("RAILS_VERSION")
75
+ unless Rails::VERSION::STRING.start_with?("#{expected}.")
76
+ abort "Rails #{Rails::VERSION::STRING} is installed, but RAILS_VERSION is #{expected}"
77
+ end
78
+ '
79
+
64
80
  - name: Run test
65
81
  run: |
66
82
  bundle exec rake test
67
83
 
68
84
  - name: Upload coverage reports to Codecov
69
- uses: codecov/codecov-action@v3
85
+ uses: codecov/codecov-action@v7.1.1
70
86
  env:
71
87
  CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
88
+
89
+ # Single status for the required checks: fails unless every test job
90
+ # succeeded, including when one is skipped or cancelled.
91
+ ci-passed:
92
+ if: always()
93
+ needs: [test]
94
+ runs-on: ubuntu-24.04
95
+ timeout-minutes: 5
96
+
97
+ steps:
98
+ - name: Check test results
99
+ shell: bash
100
+ env:
101
+ NEEDS: ${{ toJSON(needs) }}
102
+ run: |
103
+ set -euo pipefail
104
+ jq -r 'to_entries[] | "\(.key): \(.value.result)"' <<<"$NEEDS"
105
+ failed="$(jq -r '[to_entries[] | select(.value.result != "success") | .key] | join(", ")' <<<"$NEEDS")"
106
+ if [[ -n "$failed" ]]; then
107
+ echo "::error::Test jobs did not succeed: $failed"
108
+ exit 1
109
+ fi
@@ -0,0 +1,28 @@
1
+ # Fails when .github/workflows/actions.lock is out of sync with the
2
+ # workflows or a locked pin no longer verifies upstream.
3
+
4
+ name: verify-lockfile
5
+
6
+ on:
7
+ pull_request:
8
+ push:
9
+ branches:
10
+ - master
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ verify:
17
+ runs-on: ubuntu-24.04
18
+ timeout-minutes: 10
19
+ env:
20
+ GH_TOKEN: ${{ github.token }}
21
+ steps:
22
+ - uses: actions/checkout@v7.0.1
23
+ with:
24
+ persist-credentials: false
25
+ - name: Install gh-actions-lock
26
+ run: gh extension install github/gh-actions-lock --pin v0.4.0
27
+ - name: Verify the lockfile
28
+ run: gh actions-lock --verify
data/AGENTS.md ADDED
@@ -0,0 +1 @@
1
+ CLAUDE.md
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ > このファイルは v0.8.2 までの履歴です。以降のリリースノートは
4
+ > [GitHub Releases](https://github.com/jksy/resizing-gem/releases) に一本化しています。
5
+
3
6
  **Merged pull requests:**
4
7
 
5
8
  - v0.8.2 [\#53](https://github.com/jksy/resizing-gem/pull/53) ([jksy](https://github.com/jksy))