Skip to content

Commit

Permalink
feat(ci): add commit tracking to mg (#1537) (#1539)
Browse files Browse the repository at this point in the history
close #1429

(cherry picked from commit 0c37ae0)

Co-authored-by: madomado <[email protected]>
  • Loading branch information
lleyton and madonuko authored Jul 18, 2024
1 parent 12afa05 commit 71e5271
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/autobuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
- name: Notify Madoguchi (Success)
if: success() && github.event_name == 'push'
run: ./.github/workflows/mg.sh true ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}}
run: ./.github/workflows/mg.sh true ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} ${{github.sha}}
- name: Notify Madoguchi (Failure)
if: ( cancelled() || failure() ) && github.event_name == 'push'
run: ./.github/workflows/mg.sh false ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}}
run: ./.github/workflows/mg.sh false ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} ${{github.sha}}
30 changes: 14 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ on:
required: false
default: all
type: string



jobs:
parse:
Expand All @@ -28,18 +26,18 @@ jobs:
- name: Parse Input
id: parsing
run: |
echo "${{ inputs.packages }}" | sed 's/ /\n/g' | sed 's/$/\//g' | jq -R . | jq -s . | jq -c . | sed 's/^/pkgs=/' >> $GITHUB_OUTPUT
echo "builder=${{ inputs.custom_builder }}" >> $GITHUB_OUTPUT
arch="${{ inputs.architecture }}"
# Convert to json array using jq
# if arch is not all, convert to array
if [ "$arch" != "all" ]; then
# jq, array with single element as string
arch=$(echo $arch | sed 's/,/\n/g')
echo "arch=$(echo $arch | jq -Rs 'split("\n")' | jq 'map(select(length > 0))' | jq -c .)" >> $GITHUB_OUTPUT
else
echo "arch=$(echo '["aarch64", "x86_64"]' | jq -c .)" >> $GITHUB_OUTPUT
fi
echo "${{ inputs.packages }}" | sed 's/ /\n/g' | sed 's/$/\//g' | jq -R . | jq -s . | jq -c . | sed 's/^/pkgs=/' >> $GITHUB_OUTPUT
echo "builder=${{ inputs.custom_builder }}" >> $GITHUB_OUTPUT
arch="${{ inputs.architecture }}"
# Convert to json array using jq
# if arch is not all, convert to array
if [ "$arch" != "all" ]; then
# jq, array with single element as string
arch=$(echo $arch | sed 's/,/\n/g')
echo "arch=$(echo $arch | jq -Rs 'split("\n")' | jq 'map(select(length > 0))' | jq -c .)" >> $GITHUB_OUTPUT
else
echo "arch=$(echo '["aarch64", "x86_64"]' | jq -c .)" >> $GITHUB_OUTPUT
fi
build:
needs: parse
Expand Down Expand Up @@ -102,7 +100,7 @@ jobs:
- name: Notify Madoguchi (Success)
if: success()
run: ./.github/workflows/mg.sh true ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}}
run: ./.github/workflows/mg.sh true ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} ${{github.sha}}
- name: Notify Madoguchi (Failure)
if: cancelled() || failure()
run: ./.github/workflows/mg.sh false ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}}
run: ./.github/workflows/mg.sh false ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} ${{github.sha}}
4 changes: 2 additions & 2 deletions .github/workflows/json-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- name: Notify Madoguchi (Success)
if: success()
run: ./.github/workflows/mg.sh true ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}}
run: ./.github/workflows/mg.sh true ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} ${{github.sha}}
- name: Notify Madoguchi (Failure)
if: cancelled() || failure()
run: ./.github/workflows/mg.sh false ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}}
run: ./.github/workflows/mg.sh false ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} ${{github.sha}}
2 changes: 1 addition & 1 deletion .github/workflows/mg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set -x

dirs=$2
dirs=${dirs/\/pkg/}
export p="{\"id\":\"$5\",\"ver\":\"%v\",\"rel\":\"%r\",\"arch\":\"$4\",\"dirs\":\"$dirs\",\"succ\":$1}"
export p="{\"id\":\"$5\",\"ver\":\"%v\",\"rel\":\"%r\",\"arch\":\"$4\",\"dirs\":\"$dirs\",\"succ\":$1,\"commit\":\"%6\"}"

if [[ $1 == false ]]; then
d=${p/\%v/?}
Expand Down

0 comments on commit 71e5271

Please sign in to comment.