Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: azzamsa/dryip-of-rust
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.6.0
Choose a base ref
...
head repository: azzamsa/dryip-of-rust
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Oct 30, 2022

  1. ci: update task version

    azzamsa committed Oct 30, 2022
    Copy the full SHA
    aba402f View commit details

Commits on Nov 3, 2022

  1. feat: filter non unique

    azzamsa committed Nov 3, 2022
    Copy the full SHA
    9671606 View commit details
  2. refactor: use itertools crate

    `std::iter` has very few handy functions compared to other languages
    such as Python. Using only `std::iter` will create a longer implementation
    code compared to Python implementation.
    
    Rust `std` is designed to be slim. Many important modules are separated
    into standalone crate such as `time`. The use of `itertools` here is okay.
    Even cargo itself uses it.
    azzamsa committed Nov 3, 2022
    Copy the full SHA
    5d54aec View commit details

Commits on Dec 11, 2022

  1. Copy the full SHA
    3a6094d View commit details
  2. Copy the full SHA
    76ec998 View commit details
  3. build: denest release script

    azzamsa committed Dec 11, 2022
    Copy the full SHA
    9af140a View commit details
  4. refactor: clippy

    used consecutive `str::replace` call
    azzamsa committed Dec 11, 2022
    Copy the full SHA
    4d4bcf1 View commit details

Commits on Dec 19, 2022

  1. Copy the full SHA
    d2cfe9b View commit details
  2. ci: set-output is deprecated

    azzamsa committed Dec 19, 2022
    Copy the full SHA
    6317aa1 View commit details
  3. ci: update release steps

    azzamsa committed Dec 19, 2022
    Copy the full SHA
    3e9ccf4 View commit details

Commits on Dec 22, 2022

  1. Copy the full SHA
    e7814d9 View commit details
  2. ci: dprint not found

    azzamsa committed Dec 22, 2022
    Copy the full SHA
    9b8252b View commit details

Commits on Dec 28, 2022

  1. Copy the full SHA
    d746ca9 View commit details

Commits on Jan 4, 2023

  1. ci: better workflow

    azzamsa committed Jan 4, 2023
    Copy the full SHA
    28d8f87 View commit details

Commits on Jan 29, 2023

  1. build: bump msrv

    azzamsa committed Jan 29, 2023
    Copy the full SHA
    a738661 View commit details
  2. refactor: new clippy lints

    azzamsa committed Jan 29, 2023
    Copy the full SHA
    76fd5e9 View commit details

Commits on Oct 6, 2024

  1. build: put formatter and linter configs in the root directory

    Otherwise, we would have to deal with a custom `--config-path` for every possible formatter on Earth.
    It's okay to let them clutter the directory (check out other popular repos!).
    Even if they are visible on the GitHub repo, locally they are hidden by your favorite editor.
    azzamsa committed Oct 6, 2024
    Copy the full SHA
    8f72907 View commit details
  2. Copy the full SHA
    411fc9a View commit details

Commits on Oct 7, 2024

  1. refactor: clippy

    azzamsa committed Oct 7, 2024
    Copy the full SHA
    e0d0452 View commit details
  2. fix: remove date module

    So far the contents are too trivial.
    azzamsa committed Oct 7, 2024
    Copy the full SHA
    e7b791d View commit details
  3. feat(strings): byte_size

    azzamsa committed Oct 7, 2024
    Copy the full SHA
    39ac30c View commit details
  4. build: update workflow

    azzamsa committed Oct 7, 2024
    Copy the full SHA
    ca54b00 View commit details
  5. build: upgrade deps

    azzamsa committed Oct 7, 2024
    Copy the full SHA
    f42e31b View commit details
Showing with 278 additions and 484 deletions.
  1. +0 βˆ’3 .cargo-husky/hooks/pre-commit
  2. +17 βˆ’7 configs/cliff.toml β†’ .cliff.toml
  3. +2 βˆ’2 configs/dprint.json β†’ .dprint.jsonc
  4. +39 βˆ’66 .github/workflows/ci.yml
  5. +69 βˆ’35 .github/workflows/release.yml
  6. +8 βˆ’7 Cargo.toml
  7. 0 LICENSE-MIT β†’ LICENSE
  8. +0 βˆ’201 LICENSE-APACHE
  9. +0 βˆ’1 clippy.toml
  10. +22 βˆ’7 docs/dev/README.md
  11. +47 βˆ’42 justfile
  12. +19 βˆ’18 scripts/release.sh
  13. +36 βˆ’18 src/arrays.rs
  14. +0 βˆ’43 src/dates.rs
  15. +0 βˆ’27 src/lib.rs
  16. +19 βˆ’7 src/strings.rs
3 changes: 0 additions & 3 deletions .cargo-husky/hooks/pre-commit

This file was deleted.

24 changes: 17 additions & 7 deletions configs/cliff.toml β†’ .cliff.toml
Original file line number Diff line number Diff line change
@@ -16,14 +16,20 @@ body = """
### {{ group | striptags | trim | upper_first }}
{% for commit in commits %}
{%- if commit.scope -%}
- **{{commit.scope}}:** {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }}))
- **{{ commit.scope }}:** {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/azzamsa/dryip-of-rust/commit/{{ commit.id }}))
{% if commit.breaking -%}
{% raw %} {% endraw %}- **BREAKING!** ⚠️ : {{commit.breaking_description}}
{% raw %} {% endraw %}- **BREAKING!** ⚠️ : {{ commit.breaking_description }}
{% endif -%}
{% if commit.body -%}
{% raw %}\n{% endraw %}{% raw %} {% endraw %}{{ commit.body | indent(width=4) }}{% raw %}\n{% endraw %}
{% endif -%}
{% else -%}
- {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }}))
- {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/azzamsa/dryip-of-rust/commit/{{ commit.id }}))
{% if commit.breaking -%}
{% raw %} {% endraw %}- **BREAKING!** ⚠️ : {{commit.breaking_description}}
{% raw %} {% endraw %}- **BREAKING!** ⚠️ : {{ commit.breaking_description }}
{% endif -%}
{% if commit.body -%}
{% raw %}\n{% endraw %}{% raw %} {% endraw %}{{ commit.body | indent(width=4) }}{% raw %}\n{% endraw %}
{% endif -%}
{% endif -%}
{% endfor -%}
@@ -41,9 +47,13 @@ footer = """"""
conventional_commits = true
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat*", group = "<!-- 0 -->Features" },
{ message = "^fix*", group = "<!-- 1 -->Bug fixes" },
{ message = "^perf*", group = "<!-- 2 -->Performance" },
# Distro, theme migrations
{ message = "^migrate", group = "<!-- 0 --> 🚚 Migrations" },
{ message = "^feat", group = "<!-- 1 -->⛰️ Features" },
{ message = "^fix", group = "<!-- 2 -->πŸ› Bug Fixes" },
{ message = "^perf", group = "<!-- 3 -->⚑ Performance" },
# Ditching or replacing an app
{ message = "^rm", group = "<!-- 4 -->🧹 Cleanup" },
]
# filter out the commits that are not matched by commit parsers
filter_commits = true
4 changes: 2 additions & 2 deletions configs/dprint.json β†’ .dprint.jsonc
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
"./target",
],
"plugins": [
"https://plugins.dprint.dev/markdown-0.13.3.wasm",
"https://plugins.dprint.dev/toml-0.5.4.wasm"
"https://plugins.dprint.dev/markdown-0.17.8.wasm",
"https://plugins.dprint.dev/toml-0.6.3.wasm"
]
}
105 changes: 39 additions & 66 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,112 +1,85 @@
name: CI

env:
MIN_SUPPORTED_RUST_VERSION: "1.63.0"

on: [push, pull_request]

jobs:
code_quality:
name: Code Quality
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install rust toolchain
uses: actions-rs/toolchain@v1
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
default: true
profile: minimal # no documentation
components: clippy, rustfmt

- name: Install latest just release
uses: extractions/setup-just@v1

- name: Install latest dprint release
uses: taiki-e/install-action@v1
- uses: taiki-e/install-action@just
- uses: taiki-e/install-action@dprint
- uses: taiki-e/install-action@v2
with:
tool: dprint
tool: typos-cli

- name: Cache
uses: Swatinem/rust-cache@v2
- name: Show version information
shell: bash
run: |
just -V
dprint --version
- name: Ensure `fmt` has been run
run: just fmt-check

- name: Ensure MSRV is set in `clippy.toml`
run: grep "^msrv = \"${{ env.MIN_SUPPORTED_RUST_VERSION }}\"\$" clippy.toml

- name: Run clippy
run: just lint

msrv:
name: Minimum Supported Rust Version
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }})
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }}
default: true
profile: minimal

- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Install latest just release
uses: extractions/setup-just@v1
- uses: taiki-e/install-action@just
- uses: taiki-e/install-action@nextest

- name: Cache
uses: Swatinem/rust-cache@v2

- name: Run tests
run: just test
- run: just test

build:
name: Build (${{ matrix.job.os }}, ${{ matrix.job.target }})
runs-on: ${{ matrix.job.os }}
name: Build for ${{ matrix.build }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
job:
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu }
- { os: ubuntu-latest, target: x86_64-unknown-linux-musl , use-cross: true }
- { os: macos-latest , target: x86_64-apple-darwin }
- { os: windows-latest, target: x86_64-pc-windows-msvc }
include:
- { build: linux-gnu, os: ubuntu-22.04, target: x86_64-unknown-linux-gnu }
- { build: linux-musl, os: ubuntu-22.04, target: x86_64-unknown-linux-musl }
- { build: win-gnu, os: windows-2022, target: x86_64-pc-windows-gnu }
- { build: win-msvc, os: windows-2022, target: x86_64-pc-windows-msvc }
- { build: win32-msvc, os: windows-2022, target: i686-pc-windows-msvc }
- { build: macos, os: macos-12 , target: x86_64-apple-darwin }

steps:
- name: Checkout source code
uses: actions/checkout@v3

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

- name: Cache
uses: Swatinem/rust-cache@v2
target: ${{ matrix.target }}

- name: Show version information
shell: bash
run: |
gcc --version || true
rustup -V
rustup toolchain list
rustup default
cargo -V
rustc -V
rustc --version
cargo --version
- name: Install musl-tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
--allow-unauthenticated musl-tools
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.job.use-cross }}
command: build
args: --release --target=${{ matrix.job.target }}
run: cargo build --release --target ${{ matrix.target }}
104 changes: 69 additions & 35 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -4,44 +4,85 @@ on:
push:
tags:
- 'v*'
env:
PROJECT_NAME: dryip

jobs:
release:
name: Release
runs-on: ubuntu-latest
create-github-release:
name: Create GitHub Release
runs-on: ubuntu-22.04
steps:
- name: Checkout source code

- name: Checkout
uses: actions/checkout@v3
with:
# it is a must!
fetch-depth: 0

- name: Extract crate information
- name: Set the release version
shell: bash
run: |
echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
echo ${{ env.RELEASE_VERSION }}
- name: Checkout current tag
shell: bash
run: |
echo "PROJECT_NAME=dryip" >> $GITHUB_ENV
echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
git checkout v${{ env.RELEASE_VERSION }}
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
- name: Generate a changelog
uses: orhun/git-cliff-action@v2
id: git-cliff
with:
toolchain: stable
default: true
profile: minimal # no documentation
components: clippy, rustfmt
config: configs/cliff.toml
args: -vv --strip header --current
env:
OUTPUT: CHANGELOG.md.tmp

- name: Cache
uses: Swatinem/rust-cache@v2
- name: Print the changelog
run: cat "${{ steps.git-cliff.outputs.changelog }}"

- name: Publish to crates.io
uses: katyo/publish-crates@v1
- name: Release
uses: softprops/action-gh-release@v1
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
token: ${{ secrets.GH_TOKEN }}
name: "v${{ env.RELEASE_VERSION }}"
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
generate_release_notes: true
body_path: "${{ steps.git-cliff.outputs.changelog }}"

publish:
name: Publish
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Set the release version
shell: bash
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV

- name: Show release version
shell: bash
run: |
echo ${{ env.RELEASE_VERSION }}
- name: Extract crate information
shell: bash
run: |
echo "PROJECT_NAME=${{ env.PROJECT_NAME }}" >> $GITHUB_ENV
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}

- name: Create tarball
id: package
run: |
PKG_suffix=".tar.gz"
PKG_BASENAME=${PROJECT_NAME}-v${PROJECT_VERSION}
PKG_BASENAME=${PROJECT_NAME}-${RELEASE_VERSION}
PKG_NAME=${PKG_BASENAME}${PKG_suffix}
echo ::set-output name=PKG_NAME::${PKG_NAME}
echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_OUTPUT
PKG_STAGING="/tmp/package"
ARCHIVE_DIR="${PKG_STAGING}/${PKG_BASENAME}/"
@@ -50,28 +91,21 @@ jobs:
# Source
cp -r "src" "$ARCHIVE_DIR"
# README, LICENSE and CHANGELOG files
cp "README.md" "LICENSE-MIT" "LICENSE-APACHE" "CHANGELOG.md" "$ARCHIVE_DIR"
cp "README.md" "LICENSE" "CHANGELOG.md" "$ARCHIVE_DIR"
# Compress
pushd "${PKG_STAGING}/" >/dev/null
tar czf "${PKG_NAME}" "${PKG_BASENAME}"/
popd >/dev/null
# Let subsequent steps know where to find the compressed package
echo ::set-output name=PKG_PATH::"${PKG_STAGING}/${PKG_NAME}"
- name: Get CHANGELOG.md entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v1
with:
version: ${{ steps.tag.outputs.current_version }}
path: ./CHANGELOG.md
echo "PKG_PATH=${PKG_STAGING}/${PKG_NAME}" >> $GITHUB_OUTPUT
- name: Release
uses: svenstaro/upload-release-action@v2
uses: softprops/action-gh-release@v1
with:
repo_token: ${{ secrets.GH_TOKEN }}
file: ${{ steps.package.outputs.PKG_PATH }}
tag: ${{ github.ref }}
asset_name: ${{ steps.package.outputs.PKG_NAME }}
body: ${{ steps.changelog_reader.outputs.log_entry }}
token: ${{ secrets.GH_TOKEN }}
name: "v${{ env.RELEASE_VERSION }}"
files: ${{ steps.package.outputs.PKG_NAME }}
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
generate_release_notes: false
15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -10,14 +10,15 @@ keywords = ["algorithms", "dryip"]
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/azzamsa/dryip-of-rust"
rust-version = "1.81.0"
description = "Short 🩸 Rust πŸ¦€ code snippets for inspiration."

[dependencies]
time = "0.3.16"
itertools = "0.13.0"

[dev-dependencies]
# git hooks
cargo-husky = { version = "1", features = ["user-hooks"] }

[package.metadata.cargo-udeps.ignore]
development = ["cargo-husky"]
[package.metadata.release]
sign-commit = true
sign-tag = true
tag-message = "v{{version}}"
pre-release-commit-message = "v{{version}}"
pre-release-hook = ["just", "_release-prepare", "{{version}}"]
File renamed without changes.
Loading