Skip to content

Commit 62c7dfe

Browse files
committed
chore: Prepare for release of diff-lcs 2.0 beta 1
Simplified build tooling, updated GitHub Actions workflows, prepared changelog for dev release, and updated support for Ruby 3.2 through 4.x. - Streamlined Rakefile and Gemfile and removed unnecessary complexity - Added Ruby 4.0 support and dropped unsupported Ruby versions - Simplified CI configuration - Updated release and support documents. Signed-off-by: Austin Ziegler <austin@zieglers.ca>
1 parent c57b5af commit 62c7dfe

15 files changed

Lines changed: 206 additions & 210 deletions

.github/workflows/ci.yml

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,14 @@ jobs:
3737
with:
3838
persist-credentials: false
3939

40-
- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
40+
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
4141
with:
4242
ruby-version: '3.4'
4343
rubygems: latest
4444
bundler: 2
45-
bundler-cache: false
45+
bundler-cache: true
4646

47-
- name: Run standardrb
48-
run: |
49-
bundle install --jobs 4 --retry 3
50-
bundle exec standardrb
51-
env:
52-
MAINTENANCE: true
47+
- run: bundle exec standardrb
5348

5449
coverage:
5550
name: Generate Coverage Report
@@ -76,18 +71,14 @@ jobs:
7671
with:
7772
persist-credentials: false
7873

79-
- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
74+
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
8075
with:
8176
ruby-version: '3.4'
8277
rubygems: latest
8378
bundler: 2
84-
bundler-cache: false
79+
bundler-cache: true
8580

86-
- run: |
87-
bundle install --jobs 4 --retry 3
88-
bundle exec ruby -S rake coverage --trace
89-
env:
90-
COVERAGE: true
81+
- run: bundle exec ruby -S rake coverage --trace
9182

9283
- uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b #v2.3.6
9384

@@ -104,12 +95,10 @@ jobs:
10495
- ubuntu-22.04
10596
- ubuntu-24.04
10697
ruby:
107-
- '2.6'
108-
- '2.7'
109-
- '3.1'
11098
- '3.2'
11199
- '3.3'
112100
- '3.4'
101+
- '4.0'
113102
- truffleruby
114103

115104
runs-on: ${{ matrix.os }}
@@ -131,7 +120,7 @@ jobs:
131120
with:
132121
persist-credentials: false
133122

134-
- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
123+
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
135124
with:
136125
ruby-version: ${{ matrix.ruby }}
137126
rubygems: latest
@@ -154,12 +143,10 @@ jobs:
154143
- macos-15
155144
- macos-26
156145
ruby:
157-
- '2.6'
158-
- '2.7'
159-
- '3.1'
160146
- '3.2'
161147
- '3.3'
162148
- '3.4'
149+
- '4.0'
163150

164151
runs-on: ${{ matrix.os }}
165152

@@ -180,7 +167,7 @@ jobs:
180167
with:
181168
persist-credentials: false
182169

183-
- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
170+
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
184171
with:
185172
ruby-version: ${{ matrix.ruby }}
186173
rubygems: latest
@@ -202,13 +189,10 @@ jobs:
202189
- windows-2022
203190
- windows-2025
204191
ruby:
205-
- '2.6'
206-
- '2.7'
207-
- '3.0'
208-
- '3.1'
209192
- '3.2'
210193
- '3.3'
211194
- '3.4'
195+
- '4.0'
212196
- mingw
213197
- mswin
214198
- ucrt
@@ -232,7 +216,7 @@ jobs:
232216
with:
233217
persist-credentials: false
234218

235-
- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
219+
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
236220
with:
237221
ruby-version: ${{ matrix.ruby }}
238222
rubygems: latest
@@ -278,7 +262,7 @@ jobs:
278262
with:
279263
persist-credentials: false
280264

281-
- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
265+
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
282266
with:
283267
ruby-version: ${{ matrix.ruby }}
284268
rubygems: latest
@@ -324,7 +308,7 @@ jobs:
324308
with:
325309
persist-credentials: false
326310

327-
- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
311+
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
328312
with:
329313
ruby-version: ${{ matrix.ruby }}
330314
rubygems: latest

.github/workflows/dco-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ jobs:
2727
api.github.com:443
2828
github.com:443
2929
30-
- uses: KineticCafe/actions-dco@cd9508e5ae82413fbd74b20af21551db0ea3eb78 # v2.0.0
30+
- uses: KineticCafe/actions-dco@76b7fc30ff5988e68d01ea07deeaf7e71256598f # v2.1.0

.github/workflows/publish-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
'print "version=", Gem::Specification.load(ARGV[0]).rubygems_version, "\n"' \
3939
diff-lcs.gemspec >>"${GITHUB_OUTPUT}"
4040
41-
- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
41+
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
4242
with:
4343
bundler-cache: false
4444
ruby-version: ruby

.github/workflows/publish-gem.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
'print "version=", Gem::Specification.load(ARGV[0]).rubygems_version, "\n"' \
6666
diff-lcs.gemspec >>"${GITHUB_OUTPUT}"
6767
68-
- uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0
68+
- uses: ruby/setup-ruby@8a836efbcebe5de0fe86b48a775b7a31b5c70c93 # v1.277.0
6969
with:
7070
bundler-cache: false
7171
ruby-version: ruby

.mise.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
[tools]
22
ruby = "3.4"
3-
4-
[env]
5-
MAINTENANCE = "true"
6-
COVERAGE = "true"

.standard.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
---
22
parallel: true
3-
ruby_version: 2.0
3+
ruby_version: 3.2
44

55
ignore:
66
- '*.gemspec'
77
- research/**/*
88
- pkg/**/*
9-
- Gemfile:
10-
- Style/HashSyntax
11-
- Rakefile:
12-
- Layout/HeredocIndentation
139

1410
plugins:
1511
- rubocop-thread_safety

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
# Changelog
22

3+
## 2.0.0.beta.1 / 2025-12-31
4+
5+
This release has significant **breaking changes**.
6+
7+
- diff-lcs 2 supports Ruby 3.2 or higher. This allowed:
8+
9+
- readability improvements (endless methods, pattern matching);
10+
11+
- support for immutable Data classes (`Diff::LCS::Block`, `Diff::LCS::Change`,
12+
and `Diff::LCS::ContextChange`);
13+
14+
- removal of compatibility shims;
15+
16+
- reduction in conditional tests in loops, especially for String character
17+
extraction (compare `string ? seq[i, 1] : seq[i]` to `seq[i]`); and
18+
19+
- optimizations to string and relying on standard encoding support present
20+
since Ruby 2.1.
21+
22+
The primary API (methods and class methods on `Diff::LCS`) has not changed,
23+
with one exception noted below. Internal APIs (including `Diff::LCS::Block`,
24+
`Diff::LCS::Change`, `Diff::LCS::ContextChange`, and `Diff::LCS::Hunk`) have
25+
changed for compatibility.
26+
27+
- The `htmldiff` binary and supporting code have been removed without
28+
replacement.
29+
30+
- `ldiff` no longer supports `ed`-script output (`ed` and `reverse_ed` formats).
31+
As Baptiste Courtois says in [#108][pull-108], the "implementation was broken
32+
for a while and no-one reported it."
33+
34+
- The method `Diff::LCS.LCS` has been removed as an alias for `Diff::LCS.lcs`.
35+
Most callers are using `Diff::LCS.lcs` and modern Ruby did-you-mean support
36+
should assist with this update.
37+
338
## 1.6.2 / 2025-05-12
439

540
- Handle upcoming changes to the `cgi` gem in Ruby 3.5 ([#147][pull-147])
@@ -504,6 +539,7 @@
504539
[pull-103]: https://github.com/halostatue/diff-lcs/pull/103
505540
[pull-104]: https://github.com/halostatue/diff-lcs/pull/104
506541
[pull-105]: https://github.com/halostatue/diff-lcs/pull/105
542+
[pull-108]: https://github.com/halostatue/diff-lcs/pull/108
507543
[pull-129]: https://github.com/halostatue/diff-lcs/pull/129
508544
[pull-147]: https://github.com/halostatue/diff-lcs/pull/147
509545
[pull-148]: https://github.com/halostatue/diff-lcs/pull/148

CONTRIBUTING.md

Lines changed: 85 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,65 @@
11
# Contributing
22

33
Contribution to diff-lcs is encouraged: bug reports, feature requests, or code
4-
contributions. There are a few DOs and DON'Ts that should be followed.
4+
contributions. New features should be proposed and discussed in an
5+
[issue][issues].
56

6-
## DO
7+
Before contributing patches, please read the [Licence](./LICENCE.md).
78

8-
- Keep the coding style that already exists for any updated Ruby code (support
9-
or otherwise). I use [Standard Ruby][standardrb] for linting and formatting.
9+
diff-lcs is governed under the [Contributor Covenant Code of Conduct][cccoc].
1010

11-
- Use thoughtfully-named topic branches for contributions. Rebase your commits
12-
into logical chunks as necessary.
11+
## Code Guidelines
1312

14-
- Use [quality commit messages][qcm].
13+
I have several guidelines to contributing code through pull requests:
1514

16-
- Add your name or GitHub handle to `CONTRIBUTORS.md` and a record in the
17-
`CHANGELOG.md` as a separate commit from your main change. (Follow the style
18-
in the `CHANGELOG.md` and provide a link to your PR.)
15+
- All code changes require tests. In most cases, this will be added or updated
16+
unit tests. I use [RSpec][rspec].
1917

20-
- Add or update tests as appropriate for your change. The test suite is written
21-
in [RSpec][rspec].
18+
- I use code formatters, static analysis tools, and linting to ensure consistent
19+
styles and formatting. There should be no warning output from test run
20+
processes. I use [Standard Ruby][standardrb].
2221

23-
- Add or update documentation as appropriate for your change. The documentation
24-
is RDoc; diff-lcs does not use extensions that may be present in alternative
25-
documentation generators.
22+
- Proposed changes should be on a thoughtfully-named topic branch and organized
23+
into logical commit chunks as appropriate.
2624

27-
## DO NOT
25+
- Use [Conventional Commits][conventional] with my
26+
[conventions](#commit-conventions).
2827

29-
- Modify `VERSION` in `lib/diff/lcs/version.rb`. When your patch is accepted and
30-
a release is made, the version will be updated at that point.
28+
- Versions must not be updated in pull requests unless otherwise directed. This
29+
means that you must not:
3130

32-
- Modify `diff-lcs.gemspec`; it is a generated file. (You _may_ use
33-
`rake gemspec` to regenerate it if your change involves metadata related to
34-
gem itself).
31+
- Modify `VERSION` in `lib/diff/lcs/version.rb`. When your patch is accepted
32+
and a release is made, the version will be updated at that point.
3533

36-
- Modify the `Gemfile`.
34+
- Modify `diff-lcs.gemspec`; it is a generated file. (You _may_ use
35+
`rake gemspec` to regenerate it if your change involves metadata related to
36+
gem itself).
3737

38-
## LLM-Generated Contribution Policy
38+
- Modify the `Gemfile`.
3939

40-
diff-lcs is a library with complex interactions and subtle decisions (some of
41-
them possibly even wrong). It is extremely important that any issues or pull
42-
requests be well understood by the submitter and that, especially for pull
43-
requests, the developer can attest to the [Developer Certificate of Origin][dco]
44-
for each pull request (see [LICENCE](LICENCE.md)).
40+
- Documentation should be added or updated as appropriate for new or updated
41+
functionality. The documentation is RDoc; diff-lcs does not use extensions
42+
that may be present in alternative documentation generators.
43+
44+
- All GitHub Actions checks marked as required must pass before a pull request
45+
may be accepted and merged.
46+
47+
- Add your name or GitHub handle to `CONTRIBUTORS.md` and a record in the
48+
`CHANGELOG.md` as a separate commit from your main change. (Follow the style
49+
in the `CHANGELOG.md` and provide a link to your PR.)
4550

46-
If LLM assistance is used in writing pull requests, this must be documented in
47-
the commit message and pull request. If there is evidence of LLM assistance
48-
without such declaration, the pull request **will be declined**.
51+
- Include your DCO sign-off in each commit message (see [LICENCE](LICENCE.md)).
4952

50-
Any contribution (bug, feature request, or pull request) that uses unreviewed
51-
LLM output will be rejected.
53+
## AI Contribution Policy
54+
55+
diff-lcs is a library with complex interactions and subtle decisions (some of
56+
them possibly even wrong). It is extremely important that contributions of any
57+
sort be well understood by the submitter and that the developer can attest to
58+
the [Developer Certificate of Origin][dco] for each pull request (see
59+
[LICENCE](LICENCE.md)).
60+
61+
Any contribution (bug, feature request, or pull request) that uses undeclared AI
62+
output will be rejected.
5263

5364
## Test Dependencies
5465

@@ -58,28 +69,54 @@ tests in the same way that `rake spec` does.
5869

5970
To assist with the installation of the development dependencies for diff-lcs, I
6071
have provided a Gemfile pointing to the (generated) `diff-lcs.gemspec` file.
61-
`minitar.gemspec` file. This will permit you to use `bundle install` to install
62-
the dependencies.
72+
This will permit you to use `bundle install` to install the dependencies.
6373

6474
You can run tests with code coverage analysis by running `rake spec:coverage`.
6575

66-
## Workflow
76+
## Commit Conventions
77+
78+
diff-lcs has adopted a variation of the Conventional Commits format for commit
79+
messages. The following types are permitted:
80+
81+
| Type | Purpose |
82+
| ------- | ----------------------------------------------------- |
83+
| `feat` | A new feature |
84+
| `fix` | A bug fix |
85+
| `chore` | A code change that is neither a bug fix nor a feature |
86+
| `docs` | Documentation updates |
87+
| `deps` | Dependency updates, including GitHub Actions. |
88+
89+
I encourage the use of [Tim Pope's][tpope-qcm] or [Chris Beam's][cbeams]
90+
guidelines on the writing of commit messages
91+
92+
I require the use of [git][trailers1] [trailers][trailers2] for specific
93+
additional metadata and strongly encourage it for others. The conditionally
94+
required metadata trailers are:
95+
96+
- `Breaking-Change`: if the change is a breaking change. **Do not** use the
97+
shorthand form (`feat!(scope)`) or `BREAKING CHANGE`.
98+
99+
- `Signed-off-by`: this is required for all developers except me, as outlined in
100+
the [Licence](./LICENCE.md#developer-certificate-of-origin).
67101

68-
Here's the most direct way to get your work merged into the project:
102+
- `Fixes` or `Resolves`: If a change fixes one or more open [issues][issues],
103+
that issue must be included in the `Fixes` or `Resolves` trailer. Multiple
104+
issues should be listed comma separated in the same trailer:
105+
`Fixes: #1, #5, #7`, but _may_ appear in separate trailers. While both `Fixes`
106+
and `Resolves` are synonyms, only _one_ should be used in a given commit or
107+
pull request.
69108

70-
- Fork the project.
71-
- Clone your fork (`git clone git://github.com/<username>/diff-lcs.git`).
72-
- Create a topic branch to contain your change
73-
(`git checkout -b my_awesome_feature`).
74-
- Hack away, add tests. Not necessarily in that order.
75-
- Make sure everything still passes by running `rake`.
76-
- If necessary, rebase your commits into logical chunks, without errors.
77-
- Push the branch up (`git push origin my_awesome_feature`).
78-
- Create a pull request against halostatue/diff-lcs and describe what your
79-
change does and the why you think it should be merged.
109+
- `Related to`: If a change does not fix an issue, those issue references should
110+
be included in this trailer.
80111

112+
[cbeams]: https://cbea.ms/git-commit/
113+
[cccoc]: ./CODE_OF_CONDUCT.md
114+
[conventional]: https://www.conventionalcommits.org/en/v1.0.0/
81115
[dco]: licences/dco.txt
82116
[hoe]: https://github.com/seattlerb/hoe
83-
[qcm]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
117+
[issues]: https://github.com/halostatue/diff-lcs/issues
84118
[rspec]: http://rspec.info/documentation/
85119
[standardrb]: https://github.com/standardrb/standard
120+
[tpope-qcm]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
121+
[trailers1]: https://git-scm.com/docs/git-interpret-trailers
122+
[trailers2]: https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---trailerlttokengtltvaluegt

0 commit comments

Comments
 (0)