mirror of
https://github.com/javalsai/lidm.git
synced 2025-07-03 14:25:03 +02:00
128 lines
3.4 KiB
YAML
128 lines
3.4 KiB
YAML
name: Check and Build
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
set-statuses:
|
|
required: false
|
|
default: true
|
|
type: boolean
|
|
|
|
jobs:
|
|
spellcheck:
|
|
name: Check Grammar
|
|
runs-on: ubuntu-24.04
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: "codespell"
|
|
version: 1.0
|
|
- run: codespell
|
|
|
|
shellcheck:
|
|
name: Shell Check
|
|
runs-on: ubuntu-24.04
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: "shellcheck"
|
|
version: 1.0
|
|
- run: find . -type f -name '*.sh' -not -path './assets/pkg/aur/*/src/*' | xargs shellcheck
|
|
|
|
clangcheck:
|
|
name: Chang Check
|
|
runs-on: ubuntu-24.04
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: "clang-format clang-tidy"
|
|
version: 1.0
|
|
- run: clang-format -ni src/*.c include/*.h
|
|
# TODO: include when the errors/warnings are bearable
|
|
#- run: clang-tidy src/*.c include/*.h
|
|
|
|
build-linux-amd64:
|
|
name: Build for amd64
|
|
runs-on: ubuntu-24.04
|
|
permissions: write-all
|
|
needs: [spellcheck, shellcheck, clangcheck]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: "libpam0g-dev"
|
|
version: 1.0
|
|
- id: build
|
|
run: |
|
|
make CFLAGS="-O3 -Wall" 2> /tmp/stderr
|
|
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
|
|
with:
|
|
name: build-amd64
|
|
path: lidm-amd64
|
|
retention-days: 1
|
|
|
|
build-linux-i386:
|
|
name: Build for i386
|
|
runs-on: ubuntu-24.04
|
|
permissions: write-all
|
|
needs: [spellcheck, shellcheck, clangcheck]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: "libpam0g-dev gcc-multilib"
|
|
version: 1.0
|
|
- run: |
|
|
sudo dpkg --add-architecture i386
|
|
sudo apt-get update -y
|
|
sudo apt-get install -y libpam0g-dev:i386
|
|
|
|
- id: build
|
|
run: |
|
|
make CFLAGS="-O3 -Wall -m32" 2> /tmp/stderr
|
|
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
|
|
with:
|
|
name: build-i386
|
|
path: lidm-i386
|
|
retention-days: 1
|