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
This commit is contained in:
Gideon
2025-04-08 13:13:35 +02:00
committed by GitHub
parent b308fb92c0
commit 3dc8d31d57
2 changed files with 24 additions and 7 deletions

View File

@@ -24,8 +24,25 @@ jobs:
run: | run: |
cargo fmt --all -- --check 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: main:
needs: fmt needs: [fmt, step-enum-sorted]
name: ${{ matrix.target_name }} (check, clippy) name: ${{ matrix.target_name }} (check, clippy)
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:

View File

@@ -53,9 +53,9 @@ pub type Commands = BTreeMap<String, String>;
pub enum Step { pub enum Step {
AM, AM,
AppMan, AppMan,
Aqua,
Asdf, Asdf,
Atom, Atom,
Aqua,
Audit, Audit,
AutoCpufreq, AutoCpufreq,
Bin, Bin,
@@ -90,12 +90,13 @@ pub enum Step {
Gcloud, Gcloud,
Gem, Gem,
Ghcup, Ghcup,
GithubCliExtensions,
GitRepos, GitRepos,
GithubCliExtensions,
GnomeShellExtensions, GnomeShellExtensions,
Go, Go,
Guix, Guix,
Haxelib, Haxelib,
Helix,
Helm, Helm,
HomeManager, HomeManager,
JetBrainsToolbox, JetBrainsToolbox,
@@ -103,17 +104,16 @@ pub enum Step {
Julia, Julia,
Juliaup, Juliaup,
Kakoune, Kakoune,
Helix,
Krew, Krew,
Lure,
Lensfun, Lensfun,
Lure,
Macports, Macports,
Mamba, Mamba,
Miktex,
Mas, Mas,
Maza, Maza,
Micro, Micro,
MicrosoftStore, MicrosoftStore,
Miktex,
Mise, Mise,
Myrepos, Myrepos,
Nix, Nix,