Skip to content

Commit 38d42d4

Browse files
committed
Merge remote-tracking branch 'upstream/master' into feature/no-swap-flag
2 parents ca55e8c + 2d287b9 commit 38d42d4

35 files changed

+2425
-919
lines changed

.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[alias]
2+
xtask = "run --package xtask --"

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1+
[*]
2+
indent_style = space
3+
indent_size = 4
4+
15
[*.rs]
26
max_line_length = 80

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"

.github/workflows/publish.yml

Lines changed: 68 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
target: arm-unknown-linux-gnueabihf
2525
use-cross: true
2626

27+
- os: windows-latest
28+
target: x86_64-pc-windows-gnu
29+
use-cross: false
30+
2731
- os: windows-latest
2832
target: x86_64-pc-windows-msvc
2933
use-cross: false
@@ -36,40 +40,85 @@ jobs:
3640
target: aarch64-apple-darwin
3741
use-cross: false
3842

43+
- os: ubuntu-latest
44+
target: aarch64-unknown-linux-musl
45+
use-cross: true
46+
47+
- os: ubuntu-latest
48+
target: armv7-unknown-linux-gnueabihf
49+
use-cross: true
50+
3951
steps:
4052
- name: Checkout repository
41-
uses: actions/checkout@v2
53+
uses: actions/checkout@v4
4254
with:
4355
fetch-depth: 1
4456

4557
- name: Set the version
46-
id: version
47-
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
58+
shell: bash
59+
if: env.SD_VERSION == ''
60+
run: |
61+
echo "SD_VERSION=$GITHUB_REF_NAME" >> $GITHUB_ENV
62+
echo "version is: ${{ env.SD_VERSION }}"
4863
4964
- name: Install Rust
50-
uses: actions-rs/toolchain@v1
65+
uses: dtolnay/rust-toolchain@stable
5166
with:
52-
toolchain: stable
53-
profile: minimal
54-
override: true
55-
target: ${{ matrix.target }}
67+
targets: ${{ matrix.target }}
5668

69+
- name: Setup native compilation
70+
if: ${{ matrix.use-cross == false }}
71+
shell: bash
72+
run: |
73+
echo "CARGO=cargo" >> $GITHUB_ENV
74+
75+
- name: Setup cross compilation
76+
if: ${{ matrix.use-cross == true }}
77+
shell: bash
78+
run: |
79+
dir="$RUNNER_TEMP/cross-download"
80+
mkdir "$dir"
81+
echo "$dir" >> $GITHUB_PATH
82+
cd "$dir"
83+
curl -LO "https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-musl.tar.gz"
84+
tar xf cross-x86_64-unknown-linux-musl.tar.gz
85+
echo "CARGO=cross" >> $GITHUB_ENV
86+
echo "RUSTFLAGS=--cfg sd_cross_compile" >> $GITHUB_ENV
87+
echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
5788
5889
- name: Build
59-
uses: actions-rs/cargo@v1
60-
with:
61-
use-cross: ${{ matrix.use-cross }}
62-
command: build
63-
args: --target ${{ matrix.target }} --release --locked
90+
shell: bash
91+
run: |
92+
$CARGO --version
93+
$CARGO build --release --locked --target ${{ matrix.target }}
94+
# Handle windows being an oddity
95+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
96+
echo "BIN_NAME=sd.exe" >> $GITHUB_ENV
97+
else
98+
echo "BIN_NAME=sd" >> $GITHUB_ENV
99+
fi
100+
101+
- name: Setup archive
102+
shell: bash
103+
run: |
104+
staging="sd-${{ env.SD_VERSION }}-${{ matrix.target }}"
105+
mkdir -p "$staging"
64106
65-
- name: Strip binary
66-
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
67-
run: strip target/${{ matrix.target }}/release/sd
107+
cp -r {README.md,LICENSE,CHANGELOG.md,gen/*} "$staging"
108+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
109+
cp "target/${{ matrix.target }}/release/sd.exe" "$staging/"
110+
7z a "$staging.zip" "$staging"
111+
echo "ASSET=$staging.zip" >> $GITHUB_ENV
112+
else
113+
cp "target/${{ matrix.target }}/release/sd" "$staging/"
114+
tar czf "$staging.tar.gz" "$staging"
115+
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
116+
fi
68117
69118
- name: Upload binaries to release
70-
uses: svenstaro/upload-release-action@v1-release
119+
uses: svenstaro/upload-release-action@2.7.0
71120
with:
72121
repo_token: ${{ secrets.GITHUB_TOKEN }}
73-
file: target/${{ matrix.target }}/release/sd
74-
asset_name: sd-${{ steps.version.outputs.VERSION }}-${{ matrix.target }}
122+
file: ${{ env.ASSET }}
123+
asset_name: ${{ env.ASSET }}
75124
tag: ${{ github.ref }}

.github/workflows/test.yml

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Test
22

3-
on: [pull_request]
3+
on:
4+
pull_request:
5+
workflow_dispatch:
46

57
jobs:
68
test:
@@ -21,6 +23,10 @@ jobs:
2123
target: arm-unknown-linux-gnueabihf
2224
use-cross: true
2325

26+
- os: windows-latest
27+
target: x86_64-pc-windows-gnu
28+
use-cross: false
29+
2430
- os: windows-latest
2531
target: x86_64-pc-windows-msvc
2632
use-cross: false
@@ -29,33 +35,58 @@ jobs:
2935
target: x86_64-apple-darwin
3036
use-cross: false
3137

38+
- os: macos-latest
39+
target: aarch64-apple-darwin
40+
use-cross: false
41+
42+
- os: ubuntu-latest
43+
target: aarch64-unknown-linux-musl
44+
use-cross: true
45+
46+
- os: ubuntu-latest
47+
target: armv7-unknown-linux-gnueabihf
48+
use-cross: true
49+
3250
steps:
3351
- name: Checkout repository
34-
uses: actions/checkout@v2
52+
uses: actions/checkout@v4
3553
with:
3654
fetch-depth: 1
3755

3856
- name: Install Rust
39-
uses: actions-rs/toolchain@v1
57+
uses: dtolnay/rust-toolchain@stable
4058
with:
41-
toolchain: stable
42-
profile: minimal
43-
override: true
44-
target: ${{ matrix.target }}
59+
targets: ${{ matrix.target }}
4560

46-
- name: Create .cargo/config.toml
61+
- name: Setup native compilation
62+
if: ${{ matrix.use-cross == false }}
63+
shell: bash
64+
run: |
65+
echo "CARGO=cargo" >> $GITHUB_ENV
66+
67+
- name: Install Cross
4768
if: ${{ matrix.use-cross == true }}
4869
shell: bash
4970
run: |
50-
mkdir .cargo
51-
cat > .cargo/config.toml <<EOF
52-
[target.${{ matrix.target }}]
53-
rustflags = ["--cfg", "sd_cross_compile"]
54-
EOF
71+
dir="$RUNNER_TEMP/cross-download"
72+
mkdir "$dir"
73+
echo "$dir" >> $GITHUB_PATH
74+
cd "$dir"
75+
curl -LO "https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-musl.tar.gz"
76+
tar xf cross-x86_64-unknown-linux-musl.tar.gz
77+
echo "CARGO=cross" >> $GITHUB_ENV
78+
echo "RUSTFLAGS=--cfg sd_cross_compile" >> $GITHUB_ENV
79+
echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
5580
5681
- name: Test
57-
uses: actions-rs/cargo@v1
58-
with:
59-
use-cross: ${{ matrix.use-cross }}
60-
command: test
61-
args: --target ${{ matrix.target }}
82+
shell: bash
83+
run: |
84+
$CARGO --version
85+
# For legal reasons, cross doesn't support Apple Silicon. See this:
86+
# https://github.com/cross-rs/cross-toolchains#darwin-targets
87+
# It builds and runs fine, but there's no easy way to test it in CI
88+
if [ "${{ matrix.target }}" = "aarch64-apple-darwin" ]; then
89+
$CARGO build --target ${{ matrix.target }}
90+
else
91+
$CARGO test --target ${{ matrix.target }}
92+
fi

CHANGELOG.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,121 @@ All notable changes to this project will be documented in this file.
44

55
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.0.0] - 2023-11-07
8+
9+
A quick note to any packages. The generated shell completions and man page are
10+
now in the `gen` directory of the repo. They're also included in the pre-built
11+
release artifacts on the releases page.
12+
13+
### Improvements
14+
15+
- #115 Do not replace symlink with output file (@SimplyDanny)
16+
- Fixes an issue where a symlink would be replaced with a regular file
17+
- #124 Fix tests (@Linus789)
18+
- Removed displaying the file path when passing the `--preview` flag and fixed
19+
how text coloring was handled in tests
20+
21+
### Breaking
22+
23+
- #192 Rename `--string-mode` to `--fixed-strings` (@CosmicHorrorDev)
24+
- Renamed `-s` `--string-mode` to `-f` `--fixed-strings` to better match
25+
similar tools
26+
- `-s` and `--string-mode` will still continue to work for backwards
27+
compatibility, but are no longer documented
28+
- #258 Error on `$<num><non_num>` capture replacement names (@CosmicHorrorDev)
29+
- Previously when you tried to use a numbered capture group right before some
30+
letters in the replacement text (e.g. `$1foo`) then it would be considered
31+
the impossible-to-use `1foo` capture. The correct way to pass the numbered
32+
capture group in this case would be to surround the number with curly braces
33+
like so `${1}foo`. The error just detects this case and informs the user of
34+
the issue
35+
36+
### Docs
37+
38+
- #93 Add note about in-place file modification to --help output (@jchook)
39+
- #148 Doc: nitpick `--` has no special meaning to shells (@hexagonrecursion)
40+
- #181 Fix man page -f flag help text (@ulope)
41+
- Fixed copy-pasted text in the man page's `-f` flag's help text
42+
- #186 Improve error message for failed replacements (@CosmicHorrorDev)
43+
- #187 Freshen up README (@CosmicHorrorDev)
44+
- Added a repology badge to document different installation methods
45+
- Improved the formatting of the benchmarks
46+
- #207 Documenting `$` escape (@yahkbar)
47+
- Adds a section in the README that covers that `$$` is a literal `$` in the
48+
replacement text
49+
- #227 Improve README readability (@vassudanagunta)
50+
- Various formatting improvements
51+
- #231 Use `clap_mangen` and `roff` to generate manpage (@nc7s)
52+
- This change ensures the man page contents stay in sync with the CLI
53+
automatically, and fixes some broken rendering of the existing manpage
54+
- #243 Exclude unsupported packages from the repology badge (@CosmicHorrorDev)
55+
56+
### Pre-built Releases
57+
58+
- (11295fb) Add ARM target (@chmln)
59+
- Added the `arm-unknown-linux-gnueabihf` target to CI and releases
60+
- #114 Adding `aarch64-apple-darwin` target (@yahkbar)
61+
- #143 Fix paths to release binary in "publish" action (@skrattaren)
62+
- #179 Build Adjustments (@yahkbar)
63+
- `strip`ed release binaries and added the `aarch64-ubuntu-linux-musl` target
64+
- #204 Adding `armv7-unknown-linux-gnueabihf` target (@yahkbar)
65+
- Added the `armv7-unknown-linux-gnueabihf` target to the list of targets to
66+
build in CI and for each release
67+
- #205 Resolving broken `aarch64-apple-darwin` tests (@yahkbar)
68+
- Switched `aarch64-apple-darwin` to only try building the executable without
69+
running the tests since there seems to be no easy way to test for ARM Apple
70+
targets
71+
- #206 Adding Windows builds back (@yahkbar)
72+
- Added the `x86_64-pc-windows-gnu` and `x86_64-windows-musl` targets back to
73+
the list of targets to build in CI and for each release
74+
75+
### Internal
76+
77+
- #118 Fix master (@SimplyDanny)
78+
- Fixes several cross-compilation issues that effected different targets in CI
79+
- #182 `cargo update` (@CosmicHorrorDev)
80+
- Bumps dependencies to their latest compatible versions
81+
- #183 Switch `memmap` -> `memmap2` (@CosmicHorrorDev)
82+
- Switches away from an unmaintained crate
83+
- #184 Add editor config file matching rustfmt config (@CosmicHorrorDev)
84+
- Adds an `.editorconfig` file matching the settings listed in the
85+
`.rustfmt.toml` file
86+
- #185 Fix warnings and clippy lints (@CosmicHorrorDev)
87+
- #188 Switch `atty` for `is-terminal` (@CosmicHorrorDev)
88+
- Switches away from an unmaintained crate
89+
- #189 Replace structopt with clap v4 (@CosmicHorrorDev)
90+
- Switches away from a defacto deprecated crate
91+
- #190 Change how all shell variants are expressed (@CosmicHorrorDev)
92+
- Tiny tidying up PR
93+
- #196 Move generating static assets to a `cargo-xtask` task (@CosmicHorrorDev)
94+
- Moves the generation of the man page and shell completions from a build
95+
script to a [`cargo-xtask`](https://github.com/matklad/cargo-xtask) task
96+
- #197 Add a release checklist (@CosmicHorrorDev)
97+
- #209 Dependency updates (@yahkbar)
98+
- #235 Update generated assets (@CosmicHorrorDev)
99+
- #236 Tone down dependabot (@CosmicHorrorDev)
100+
- #245 Update sd to 2021 edition (@CosmicHorrorDev)
101+
- Updates `sd` to the Rust 2021 edition
102+
- #248 Misc Cargo.toml tweaks (@CosmicHorrorDev)
103+
- Switches to use workspace edition and dependencies where appropriate
104+
- #249 Resolve CI warnings (@CosmicHorrorDev)
105+
- Switched from `actions-rs` actions to `dtolnay@rust-toolchain`
106+
- Switched from using `::set-output` to `$GITHUB_ENV`
107+
- #251 Update dependencies (@CosmicHorrorDev)
108+
- A lot of sad CI tweaking:
109+
- #252 Fix build target usage in CI (@CosmicHorrorDev)
110+
- #253 Improve publishing CI job (@CosmicHorrorDev)
111+
- #256 More CI tweaks (@CosmicHorrorDev)
112+
- #257 Fix publish action (@CosmicHorrorDev)
113+
- #267 Rework the replacements flag (@CosmicHorrorDev)
114+
- #269 Make modified text blue instead of green (@CosmicHorrorDev)
115+
- #271 Fix release checklist indentation (@CosmicHorrorDev)
116+
- #272 Remove outdated release checklist step (@CosmicHorrorDev)
117+
- #274 Prepare 1.0.0-beta.0 release (@CosmicHorrorDev)
118+
- #275 Update `sd` version in lockfile (@CosmicHorrorDev)
119+
120+
## (History listed in here is missing from v0.6.3 - v0.7.6)
121+
7122
## [0.6.2]
8123

9124
- Fixed pre-allocated memmap buffer size

0 commit comments

Comments
 (0)