Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feature/no-swap-flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Manu [tennox] committed May 10, 2024
2 parents ca55e8c + 2d287b9 commit 38d42d4
Show file tree
Hide file tree
Showing 35 changed files with 2,425 additions and 919 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
xtask = "run --package xtask --"
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[*]
indent_style = space
indent_size = 4

[*.rs]
max_line_length = 80
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
87 changes: 68 additions & 19 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ jobs:
target: arm-unknown-linux-gnueabihf
use-cross: true

- os: windows-latest
target: x86_64-pc-windows-gnu
use-cross: false

- os: windows-latest
target: x86_64-pc-windows-msvc
use-cross: false
Expand All @@ -36,40 +40,85 @@ jobs:
target: aarch64-apple-darwin
use-cross: false

- os: ubuntu-latest
target: aarch64-unknown-linux-musl
use-cross: true

- os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
use-cross: true

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Set the version
id: version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
shell: bash
if: env.SD_VERSION == ''
run: |
echo "SD_VERSION=$GITHUB_REF_NAME" >> $GITHUB_ENV
echo "version is: ${{ env.SD_VERSION }}"
- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
targets: ${{ matrix.target }}

- name: Setup native compilation
if: ${{ matrix.use-cross == false }}
shell: bash
run: |
echo "CARGO=cargo" >> $GITHUB_ENV
- name: Setup cross compilation
if: ${{ matrix.use-cross == true }}
shell: bash
run: |
dir="$RUNNER_TEMP/cross-download"
mkdir "$dir"
echo "$dir" >> $GITHUB_PATH
cd "$dir"
curl -LO "https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-musl.tar.gz"
tar xf cross-x86_64-unknown-linux-musl.tar.gz
echo "CARGO=cross" >> $GITHUB_ENV
echo "RUSTFLAGS=--cfg sd_cross_compile" >> $GITHUB_ENV
echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.use-cross }}
command: build
args: --target ${{ matrix.target }} --release --locked
shell: bash
run: |
$CARGO --version
$CARGO build --release --locked --target ${{ matrix.target }}
# Handle windows being an oddity
if [ "${{ matrix.os }}" = "windows-latest" ]; then
echo "BIN_NAME=sd.exe" >> $GITHUB_ENV
else
echo "BIN_NAME=sd" >> $GITHUB_ENV
fi
- name: Setup archive
shell: bash
run: |
staging="sd-${{ env.SD_VERSION }}-${{ matrix.target }}"
mkdir -p "$staging"
- name: Strip binary
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: strip target/${{ matrix.target }}/release/sd
cp -r {README.md,LICENSE,CHANGELOG.md,gen/*} "$staging"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp "target/${{ matrix.target }}/release/sd.exe" "$staging/"
7z a "$staging.zip" "$staging"
echo "ASSET=$staging.zip" >> $GITHUB_ENV
else
cp "target/${{ matrix.target }}/release/sd" "$staging/"
tar czf "$staging.tar.gz" "$staging"
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
fi
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
uses: svenstaro/upload-release-action@2.7.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/sd
asset_name: sd-${{ steps.version.outputs.VERSION }}-${{ matrix.target }}
file: ${{ env.ASSET }}
asset_name: ${{ env.ASSET }}
tag: ${{ github.ref }}
67 changes: 49 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Test

on: [pull_request]
on:
pull_request:
workflow_dispatch:

jobs:
test:
Expand All @@ -21,6 +23,10 @@ jobs:
target: arm-unknown-linux-gnueabihf
use-cross: true

- os: windows-latest
target: x86_64-pc-windows-gnu
use-cross: false

- os: windows-latest
target: x86_64-pc-windows-msvc
use-cross: false
Expand All @@ -29,33 +35,58 @@ jobs:
target: x86_64-apple-darwin
use-cross: false

- os: macos-latest
target: aarch64-apple-darwin
use-cross: false

- os: ubuntu-latest
target: aarch64-unknown-linux-musl
use-cross: true

- os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
use-cross: true

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
targets: ${{ matrix.target }}

- name: Create .cargo/config.toml
- name: Setup native compilation
if: ${{ matrix.use-cross == false }}
shell: bash
run: |
echo "CARGO=cargo" >> $GITHUB_ENV
- name: Install Cross
if: ${{ matrix.use-cross == true }}
shell: bash
run: |
mkdir .cargo
cat > .cargo/config.toml <<EOF
[target.${{ matrix.target }}]
rustflags = ["--cfg", "sd_cross_compile"]
EOF
dir="$RUNNER_TEMP/cross-download"
mkdir "$dir"
echo "$dir" >> $GITHUB_PATH
cd "$dir"
curl -LO "https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-musl.tar.gz"
tar xf cross-x86_64-unknown-linux-musl.tar.gz
echo "CARGO=cross" >> $GITHUB_ENV
echo "RUSTFLAGS=--cfg sd_cross_compile" >> $GITHUB_ENV
echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
- name: Test
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.use-cross }}
command: test
args: --target ${{ matrix.target }}
shell: bash
run: |
$CARGO --version
# For legal reasons, cross doesn't support Apple Silicon. See this:
# https://github.com/cross-rs/cross-toolchains#darwin-targets
# It builds and runs fine, but there's no easy way to test it in CI
if [ "${{ matrix.target }}" = "aarch64-apple-darwin" ]; then
$CARGO build --target ${{ matrix.target }}
else
$CARGO test --target ${{ matrix.target }}
fi
115 changes: 115 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,121 @@ All notable changes to this project will be documented in this file.

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

## [1.0.0] - 2023-11-07

A quick note to any packages. The generated shell completions and man page are
now in the `gen` directory of the repo. They're also included in the pre-built
release artifacts on the releases page.

### Improvements

- #115 Do not replace symlink with output file (@SimplyDanny)
- Fixes an issue where a symlink would be replaced with a regular file
- #124 Fix tests (@Linus789)
- Removed displaying the file path when passing the `--preview` flag and fixed
how text coloring was handled in tests

### Breaking

- #192 Rename `--string-mode` to `--fixed-strings` (@CosmicHorrorDev)
- Renamed `-s` `--string-mode` to `-f` `--fixed-strings` to better match
similar tools
- `-s` and `--string-mode` will still continue to work for backwards
compatibility, but are no longer documented
- #258 Error on `$<num><non_num>` capture replacement names (@CosmicHorrorDev)
- Previously when you tried to use a numbered capture group right before some
letters in the replacement text (e.g. `$1foo`) then it would be considered
the impossible-to-use `1foo` capture. The correct way to pass the numbered
capture group in this case would be to surround the number with curly braces
like so `${1}foo`. The error just detects this case and informs the user of
the issue

### Docs

- #93 Add note about in-place file modification to --help output (@jchook)
- #148 Doc: nitpick `--` has no special meaning to shells (@hexagonrecursion)
- #181 Fix man page -f flag help text (@ulope)
- Fixed copy-pasted text in the man page's `-f` flag's help text
- #186 Improve error message for failed replacements (@CosmicHorrorDev)
- #187 Freshen up README (@CosmicHorrorDev)
- Added a repology badge to document different installation methods
- Improved the formatting of the benchmarks
- #207 Documenting `$` escape (@yahkbar)
- Adds a section in the README that covers that `$$` is a literal `$` in the
replacement text
- #227 Improve README readability (@vassudanagunta)
- Various formatting improvements
- #231 Use `clap_mangen` and `roff` to generate manpage (@nc7s)
- This change ensures the man page contents stay in sync with the CLI
automatically, and fixes some broken rendering of the existing manpage
- #243 Exclude unsupported packages from the repology badge (@CosmicHorrorDev)

### Pre-built Releases

- (11295fb) Add ARM target (@chmln)
- Added the `arm-unknown-linux-gnueabihf` target to CI and releases
- #114 Adding `aarch64-apple-darwin` target (@yahkbar)
- #143 Fix paths to release binary in "publish" action (@skrattaren)
- #179 Build Adjustments (@yahkbar)
- `strip`ed release binaries and added the `aarch64-ubuntu-linux-musl` target
- #204 Adding `armv7-unknown-linux-gnueabihf` target (@yahkbar)
- Added the `armv7-unknown-linux-gnueabihf` target to the list of targets to
build in CI and for each release
- #205 Resolving broken `aarch64-apple-darwin` tests (@yahkbar)
- Switched `aarch64-apple-darwin` to only try building the executable without
running the tests since there seems to be no easy way to test for ARM Apple
targets
- #206 Adding Windows builds back (@yahkbar)
- Added the `x86_64-pc-windows-gnu` and `x86_64-windows-musl` targets back to
the list of targets to build in CI and for each release

### Internal

- #118 Fix master (@SimplyDanny)
- Fixes several cross-compilation issues that effected different targets in CI
- #182 `cargo update` (@CosmicHorrorDev)
- Bumps dependencies to their latest compatible versions
- #183 Switch `memmap` -> `memmap2` (@CosmicHorrorDev)
- Switches away from an unmaintained crate
- #184 Add editor config file matching rustfmt config (@CosmicHorrorDev)
- Adds an `.editorconfig` file matching the settings listed in the
`.rustfmt.toml` file
- #185 Fix warnings and clippy lints (@CosmicHorrorDev)
- #188 Switch `atty` for `is-terminal` (@CosmicHorrorDev)
- Switches away from an unmaintained crate
- #189 Replace structopt with clap v4 (@CosmicHorrorDev)
- Switches away from a defacto deprecated crate
- #190 Change how all shell variants are expressed (@CosmicHorrorDev)
- Tiny tidying up PR
- #196 Move generating static assets to a `cargo-xtask` task (@CosmicHorrorDev)
- Moves the generation of the man page and shell completions from a build
script to a [`cargo-xtask`](https://github.com/matklad/cargo-xtask) task
- #197 Add a release checklist (@CosmicHorrorDev)
- #209 Dependency updates (@yahkbar)
- #235 Update generated assets (@CosmicHorrorDev)
- #236 Tone down dependabot (@CosmicHorrorDev)
- #245 Update sd to 2021 edition (@CosmicHorrorDev)
- Updates `sd` to the Rust 2021 edition
- #248 Misc Cargo.toml tweaks (@CosmicHorrorDev)
- Switches to use workspace edition and dependencies where appropriate
- #249 Resolve CI warnings (@CosmicHorrorDev)
- Switched from `actions-rs` actions to `dtolnay@rust-toolchain`
- Switched from using `::set-output` to `$GITHUB_ENV`
- #251 Update dependencies (@CosmicHorrorDev)
- A lot of sad CI tweaking:
- #252 Fix build target usage in CI (@CosmicHorrorDev)
- #253 Improve publishing CI job (@CosmicHorrorDev)
- #256 More CI tweaks (@CosmicHorrorDev)
- #257 Fix publish action (@CosmicHorrorDev)
- #267 Rework the replacements flag (@CosmicHorrorDev)
- #269 Make modified text blue instead of green (@CosmicHorrorDev)
- #271 Fix release checklist indentation (@CosmicHorrorDev)
- #272 Remove outdated release checklist step (@CosmicHorrorDev)
- #274 Prepare 1.0.0-beta.0 release (@CosmicHorrorDev)
- #275 Update `sd` version in lockfile (@CosmicHorrorDev)

## (History listed in here is missing from v0.6.3 - v0.7.6)

## [0.6.2]

- Fixed pre-allocated memmap buffer size
Expand Down

0 comments on commit 38d42d4

Please sign in to comment.