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: |
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 }}

View File

@@ -53,9 +53,9 @@ pub type Commands = BTreeMap<String, String>;
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,