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:
21
.github/workflows/ci.yml
vendored
21
.github/workflows/ci.yml
vendored
@@ -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:
|
||||||
@@ -84,4 +101,4 @@ jobs:
|
|||||||
- name: Run cargo test
|
- name: Run cargo test
|
||||||
# ONLY run test with cargo
|
# ONLY run test with cargo
|
||||||
if: matrix.use_cross == false
|
if: matrix.use_cross == false
|
||||||
run: cargo test --locked --target ${{ matrix.target }}
|
run: cargo test --locked --target ${{ matrix.target }}
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user