mirror of
https://github.com/javalsai/lidm.git
synced 2025-07-05 15:28:42 +02:00
feat|fix: improve all ci behavior
This commit is contained in:
parent
521a7c295e
commit
f3ae85bb94
145
.github/workflows/check-and-build.yml
vendored
145
.github/workflows/check-and-build.yml
vendored
@ -2,11 +2,6 @@ name: Check and Build
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
|
||||||
set-statuses:
|
|
||||||
required: false
|
|
||||||
default: true
|
|
||||||
type: boolean
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
spellcheck:
|
spellcheck:
|
||||||
@ -54,36 +49,13 @@ jobs:
|
|||||||
needs: [spellcheck, shellcheck, clangcheck]
|
needs: [spellcheck, shellcheck, clangcheck]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: myrotvorets/set-commit-status-action@master
|
|
||||||
if: inputs.set-statuses
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
status: pending
|
|
||||||
description: ${{ steps.build.outputs.DESCR }}
|
|
||||||
context: Build for amd64
|
|
||||||
- uses: awalsh128/cache-apt-pkgs-action@latest
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
||||||
with:
|
with:
|
||||||
packages: "git libpam0g-dev"
|
packages: "git libpam0g-dev"
|
||||||
version: 1.0
|
version: 1.0
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- id: build
|
- id: build
|
||||||
run: |
|
run: ARCH=amd64 assets/github_scripts/build.sh
|
||||||
make -j$(nproc) 2> /tmp/stderr || (ERR=$?; cat /tmp/stderr >&2; exit $ERR)
|
|
||||||
cat /tmp/stderr >&2
|
|
||||||
|
|
||||||
HSIZE="$(stat --printf="%s" lidm | numfmt --to=iec-i)B"
|
|
||||||
WARNS="$(cat /tmp/stderr | grep '^[^ ]*\.[ch]:' | wc -l)"
|
|
||||||
mv lidm lidm-amd64
|
|
||||||
|
|
||||||
echo "DESCR='$HSIZE, $WARNS warnings'" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- uses: myrotvorets/set-commit-status-action@master
|
|
||||||
if: inputs.set-statuses
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
status: ${{ job.status }}
|
|
||||||
description: ${{ steps.build.outputs.DESCR }}
|
|
||||||
context: Build for amd64
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -98,13 +70,6 @@ jobs:
|
|||||||
needs: [spellcheck, shellcheck, clangcheck]
|
needs: [spellcheck, shellcheck, clangcheck]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: myrotvorets/set-commit-status-action@master
|
|
||||||
if: inputs.set-statuses
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
status: pending
|
|
||||||
description: ${{ steps.build.outputs.DESCR }}
|
|
||||||
context: Build for i386
|
|
||||||
- uses: awalsh128/cache-apt-pkgs-action@latest
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
||||||
with:
|
with:
|
||||||
packages: "git libpam0g-dev gcc-multilib"
|
packages: "git libpam0g-dev gcc-multilib"
|
||||||
@ -116,23 +81,7 @@ jobs:
|
|||||||
sudo apt-get install -y libpam0g-dev:i386
|
sudo apt-get install -y libpam0g-dev:i386
|
||||||
|
|
||||||
- id: build
|
- id: build
|
||||||
run: |
|
run: ARCH=i386 assets/github_scripts/build.sh CFLAGS="-O3 -Wall -m32"
|
||||||
make -j$(nproc) CFLAGS="-O3 -Wall -m32" 2> /tmp/stderr || (ERR=$?; cat /tmp/stderr >&2; exit $ERR)
|
|
||||||
cat /tmp/stderr >&2
|
|
||||||
|
|
||||||
HSIZE="$(stat --printf="%s" lidm | numfmt --to=iec-i)B"
|
|
||||||
WARNS="$(cat /tmp/stderr | grep '^[^ ]*\.[ch]:' | wc -l)"
|
|
||||||
mv lidm lidm-i386
|
|
||||||
|
|
||||||
echo "DESCR='$HSIZE, $WARNS warnings'" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- uses: myrotvorets/set-commit-status-action@master
|
|
||||||
if: inputs.set-statuses
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
status: ${{ job.status }}
|
|
||||||
description: ${{ steps.build.outputs.DESCR }}
|
|
||||||
context: Build for i386
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -146,13 +95,6 @@ jobs:
|
|||||||
permissions: write-all
|
permissions: write-all
|
||||||
needs: [spellcheck, shellcheck, clangcheck]
|
needs: [spellcheck, shellcheck, clangcheck]
|
||||||
steps:
|
steps:
|
||||||
- uses: myrotvorets/set-commit-status-action@master
|
|
||||||
if: inputs.set-statuses
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
status: pending
|
|
||||||
description: ${{ steps.status.outputs.DESCR }}
|
|
||||||
context: Build for aarch64
|
|
||||||
- uses: awalsh128/cache-apt-pkgs-action@latest
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
||||||
with:
|
with:
|
||||||
packages: "git"
|
packages: "git"
|
||||||
@ -166,27 +108,8 @@ jobs:
|
|||||||
install: |
|
install: |
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install -y make gcc libpam0g-dev
|
apt-get install -y make gcc libpam0g-dev
|
||||||
run: |
|
run: ARCH=aarch64 GITHUB_STEP_SUMMARY=gss.out GITHUB_OUTPUT=go.out assets/github_scripts/build.sh
|
||||||
make -j$(nproc) 2> /tmp/stderr || (ERR=$?; cat /tmp/stderr >&2; exit $ERR)
|
- run: set +e; cat gss.out >>"$GITHUB_STEP_SUMMARY"; cat go.out >>"$GITHUB_OUTPUT"
|
||||||
|
|
||||||
cat /tmp/stderr >&2
|
|
||||||
mv lidm lidm-aarch64
|
|
||||||
|
|
||||||
- if: inputs.set-statuses
|
|
||||||
id: status
|
|
||||||
run: |
|
|
||||||
HSIZE="$(stat --printf="%s" lidm-aarch64 | numfmt --to=iec-i)B"
|
|
||||||
WARNS="$(cat /tmp/stderr | grep '^[^ ]*\.[ch]:' | wc -l)"
|
|
||||||
|
|
||||||
echo "DESCR='$HSIZE, $WARNS warnings'" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- uses: myrotvorets/set-commit-status-action@master
|
|
||||||
if: inputs.set-statuses
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
status: ${{ job.status }}
|
|
||||||
description: ${{ steps.status.outputs.DESCR }}
|
|
||||||
context: Build for aarch64
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -200,13 +123,6 @@ jobs:
|
|||||||
permissions: write-all
|
permissions: write-all
|
||||||
needs: [spellcheck, shellcheck, clangcheck]
|
needs: [spellcheck, shellcheck, clangcheck]
|
||||||
steps:
|
steps:
|
||||||
- uses: myrotvorets/set-commit-status-action@master
|
|
||||||
if: inputs.set-statuses
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
status: pending
|
|
||||||
description: ${{ steps.status.outputs.DESCR }}
|
|
||||||
context: Build for armv7
|
|
||||||
- uses: awalsh128/cache-apt-pkgs-action@latest
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
||||||
with:
|
with:
|
||||||
packages: "git"
|
packages: "git"
|
||||||
@ -220,27 +136,8 @@ jobs:
|
|||||||
install: |
|
install: |
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install -y make gcc libpam0g-dev
|
apt-get install -y make gcc libpam0g-dev
|
||||||
run: |
|
run: ARCH=armv7 GITHUB_STEP_SUMMARY=gss.out GITHUB_OUTPUT=go.out assets/github_scripts/build.sh
|
||||||
make -j$(nproc) 2> /tmp/stderr || (ERR=$?; cat /tmp/stderr >&2; exit $ERR)
|
- run: set +e; cat gss.out >>"$GITHUB_STEP_SUMMARY"; cat go.out >>"$GITHUB_OUTPUT"
|
||||||
|
|
||||||
cat /tmp/stderr >&2
|
|
||||||
mv lidm lidm-armv7
|
|
||||||
|
|
||||||
- if: inputs.set-statuses
|
|
||||||
id: status
|
|
||||||
run: |
|
|
||||||
HSIZE="$(stat --printf="%s" lidm-armv7 | numfmt --to=iec-i)B"
|
|
||||||
WARNS="$(cat /tmp/stderr | grep '^[^ ]*\.[ch]:' | wc -l)"
|
|
||||||
|
|
||||||
echo "DESCR='$HSIZE, $WARNS warnings'" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- uses: myrotvorets/set-commit-status-action@master
|
|
||||||
if: inputs.set-statuses
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
status: ${{ job.status }}
|
|
||||||
description: ${{ steps.status.outputs.DESCR }}
|
|
||||||
context: Build for armv7
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -254,13 +151,6 @@ jobs:
|
|||||||
permissions: write-all
|
permissions: write-all
|
||||||
needs: [spellcheck, shellcheck, clangcheck]
|
needs: [spellcheck, shellcheck, clangcheck]
|
||||||
steps:
|
steps:
|
||||||
- uses: myrotvorets/set-commit-status-action@master
|
|
||||||
if: inputs.set-statuses
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
status: pending
|
|
||||||
description: ${{ steps.status.outputs.DESCR }}
|
|
||||||
context: Build for riscv64
|
|
||||||
- uses: awalsh128/cache-apt-pkgs-action@latest
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
||||||
with:
|
with:
|
||||||
packages: "git"
|
packages: "git"
|
||||||
@ -274,27 +164,8 @@ jobs:
|
|||||||
install: |
|
install: |
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install -y make gcc libpam0g-dev
|
apt-get install -y make gcc libpam0g-dev
|
||||||
run: |
|
run: ARCH=riscv64 GITHUB_STEP_SUMMARY=gss.out GITHUB_OUTPUT=go.out assets/github_scripts/build.sh
|
||||||
make -j$(nproc) 2> /tmp/stderr || (ERR=$?; cat /tmp/stderr >&2; exit $ERR)
|
- run: set +e; cat gss.out >>"$GITHUB_STEP_SUMMARY"; cat go.out >>"$GITHUB_OUTPUT"
|
||||||
|
|
||||||
cat /tmp/stderr >&2
|
|
||||||
mv lidm lidm-riscv64
|
|
||||||
|
|
||||||
- if: inputs.set-statuses
|
|
||||||
id: status
|
|
||||||
run: |
|
|
||||||
HSIZE="$(stat --printf="%s" lidm-riscv64 | numfmt --to=iec-i)B"
|
|
||||||
WARNS="$(cat /tmp/stderr | grep '^[^ ]*\.[ch]:' | wc -l)"
|
|
||||||
|
|
||||||
echo "DESCR='$HSIZE, $WARNS warnings'" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- uses: myrotvorets/set-commit-status-action@master
|
|
||||||
if: inputs.set-statuses
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
status: ${{ job.status }}
|
|
||||||
description: ${{ steps.status.outputs.DESCR }}
|
|
||||||
context: Build for riscv64
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
2
.github/workflows/make-release.yml
vendored
2
.github/workflows/make-release.yml
vendored
@ -13,8 +13,6 @@ jobs:
|
|||||||
name: Check and Build
|
name: Check and Build
|
||||||
uses: ./.github/workflows/check-and-build.yml
|
uses: ./.github/workflows/check-and-build.yml
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
with:
|
|
||||||
set-statuses: false
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Make Release v${{ inputs.version }}
|
name: Make Release v${{ inputs.version }}
|
||||||
|
47
assets/github_scripts/build.sh
Executable file
47
assets/github_scripts/build.sh
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [ -z "$ARCH" ]; then
|
||||||
|
echo "\$ARCH not present" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ERR=0
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
make -j"$(nproc)" "$@" 2> /tmp/stderr || ERR=$?
|
||||||
|
|
||||||
|
BSIZE=$(stat --printf="%s" lidm)
|
||||||
|
HSIZE=$(numfmt --to=iec-i<<<"$BSIZE")B
|
||||||
|
WARNS=$(
|
||||||
|
{ grep -E '^[^ ]+\.[ch]:[0-9]+:[0-9]+: [a-z]+:' /tmp/stderr || :; } \
|
||||||
|
| sed -E 's/^([^ ]+\.[ch]):([0-9]+):([0-9]+): ([a-z]+): (.*)$/::\4 file=\1,line=\2,col=\3::\5/'
|
||||||
|
)
|
||||||
|
WARNS_NUM=$({ [[ "$WARNS" == "" ]] && echo 0; } || wc -l <<<"$WARNS")
|
||||||
|
|
||||||
|
echo "$WARNS"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "# Build for $ARCH"
|
||||||
|
echo ""
|
||||||
|
if [ -s "/tmp/stderr" ]; then
|
||||||
|
echo "<details><summary><code>stderr</code></summary>"
|
||||||
|
echo ""
|
||||||
|
echo "\`\`\`"
|
||||||
|
cat "/tmp/stderr"
|
||||||
|
echo "\`\`\`"
|
||||||
|
echo ""
|
||||||
|
echo "</details>"
|
||||||
|
else
|
||||||
|
echo "*no \`stderr\` to show*"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
echo "## Stats"
|
||||||
|
echo "* **Filesize:** $HSIZE ($BSIZE B)"
|
||||||
|
echo "* **Warnings & Errors:** $WARNS_NUM"
|
||||||
|
} >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
|
||||||
|
if [ "$ERR" -ne 0 ]; then exit "$ERR"; fi
|
||||||
|
|
||||||
|
mv lidm lidm-"$ARCH"
|
||||||
|
|
||||||
|
echo "DESCR='$HSIZE, $WARNS_NUM warnings'" >> "$GITHUB_OUTPUT"
|
Loading…
x
Reference in New Issue
Block a user