From b7cdae4d430cb5c1a7aa7a20b2bb711ec732ce99 Mon Sep 17 00:00:00 2001 From: teor Date: Fri, 1 Dec 2023 11:06:41 +1000 Subject: [PATCH] Actually sort the jobs --- .github/workflows/ci-build-crates.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-build-crates.yml b/.github/workflows/ci-build-crates.yml index 7076ca57905..4e92a54ad92 100644 --- a/.github/workflows/ci-build-crates.yml +++ b/.github/workflows/ci-build-crates.yml @@ -61,17 +61,18 @@ jobs: # This step is meant to dynamically create a JSON containing the values of each crate # available in this repo in the root directory. We use `cargo tree` to accomplish this task. # - # The result from `cargo tree` is then transform to JSON values between double quotes, - # and separated by commas, then added to a `crates.txt` and assigned to a $JSON_CRATES variable. + # The result from `cargo tree` is then sorted so the longest job (zebrad) runs first, + # transformed to JSON values between double quotes, and separated by commas, + # then added to a `crates.txt`. # - # A JSON object is created and assigned to a $MATRIX variable, which is use to create an output - # named `matrix`, which is then used as the input in following steps, + # A JSON object is created and assigned to a $MATRIX variable, which is use to create an + # output named `matrix`, which is then used as the input in following steps, # using ` ${{ fromJson(needs.matrix.outputs.matrix) }}` - id: set-matrix name: Dynamically build crates JSON run: | TEMP_DIR=$(mktemp -d) - echo "$(cargo tree --depth 0 --edges no-normal,no-dev,no-build,no-proc-macro --prefix none | cut -d ' ' -f1 | sed '/^$/d' | awk '{ printf "\"%s\",\n", $0 }' | sed '$ s/.$//')" > $TEMP_DIR/crates.txt + cargo tree --depth 0 --edges no-normal,no-dev,no-build,no-proc-macro --prefix none | cut -d ' ' -f1 | sed '/^$/d' | LC_ALL=C sort --reverse | awk '{ printf "\"%s\",\n", $0 }' | sed '$ s/.$//' > $TEMP_DIR/crates.txt MATRIX=$( ( echo '{ "crate" : [' echo "$(cat $TEMP_DIR/crates.txt)"