From 3dc8d31d577d2da24647e4a73e1c0b73ffe0568d Mon Sep 17 00:00:00 2001 From: Gideon <87426140+GideonBear@users.noreply.github.com> Date: Tue, 8 Apr 2025 13:13:35 +0200 Subject: [PATCH] Sort `Step` enum and keep it sorted in the `ci.yml` workflow (#1104) * Add `step-enum-sorted` to `ci.yml` workflow * Sort `Step` enum * Sort `Step` enum --- .github/workflows/ci.yml | 21 +++++++++++++++++++-- src/config.rs | 10 +++++----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f70e69d6..186ec39d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,8 +24,25 @@ jobs: run: | cargo fmt --all -- --check + step-enum-sorted: + name: Step enum sorted + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Check if `Step` enum is sorted + run: | + ENUM_NAME="Step" + FILE="src/config.rs" + awk "/enum $ENUM_NAME/,/}/" "$FILE" | \ + grep -E '^\s*[A-Za-z_][A-Za-z0-9_]*\s*,?$' | \ + sed 's/[, ]//g' > original.txt + sort original.txt > sorted.txt + diff original.txt sorted.txt + main: - needs: fmt + needs: [fmt, step-enum-sorted] name: ${{ matrix.target_name }} (check, clippy) runs-on: ${{ matrix.os }} strategy: @@ -84,4 +101,4 @@ jobs: - name: Run cargo test # ONLY run test with cargo if: matrix.use_cross == false - run: cargo test --locked --target ${{ matrix.target }} + run: cargo test --locked --target ${{ matrix.target }} diff --git a/src/config.rs b/src/config.rs index 7b2dc4b5..c7870630 100644 --- a/src/config.rs +++ b/src/config.rs @@ -53,9 +53,9 @@ pub type Commands = BTreeMap; pub enum Step { AM, AppMan, + Aqua, Asdf, Atom, - Aqua, Audit, AutoCpufreq, Bin, @@ -90,12 +90,13 @@ pub enum Step { Gcloud, Gem, Ghcup, - GithubCliExtensions, GitRepos, + GithubCliExtensions, GnomeShellExtensions, Go, Guix, Haxelib, + Helix, Helm, HomeManager, JetBrainsToolbox, @@ -103,17 +104,16 @@ pub enum Step { Julia, Juliaup, Kakoune, - Helix, Krew, - Lure, Lensfun, + Lure, Macports, Mamba, - Miktex, Mas, Maza, Micro, MicrosoftStore, + Miktex, Mise, Myrepos, Nix,