mirror of
https://github.com/javalsai/lidm.git
synced 2025-07-03 06:15:03 +02:00
ci: lots of ci features
This commit is contained in:
parent
aa70fc8090
commit
a2b2434445
54
.github/actions/build/action.yml
vendored
54
.github/actions/build/action.yml
vendored
@ -1,54 +0,0 @@
|
||||
name: Build Project
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
# TODO: make arch_name optional (dont upload artifact)
|
||||
inputs:
|
||||
arch_name:
|
||||
description: "Architecture Name"
|
||||
required: true
|
||||
cc:
|
||||
description: "The compiler to use"
|
||||
required: false
|
||||
default: "gcc"
|
||||
cflags:
|
||||
description: "Compiler flags"
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# cache-apt-pkgs-action try to cache :i386 packages challenge impossible
|
||||
- if: ${{ inputs.arch_name == 'x86' }}
|
||||
shell: bash
|
||||
run: |
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y libpam0g-dev:i386
|
||||
|
||||
- uses: awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
packages: "libpam0g-dev gcc-multilib"
|
||||
version: 1.0
|
||||
|
||||
- name: Build Code
|
||||
shell: bash
|
||||
run: |
|
||||
make CC=${{ inputs.cc }} CFLAGS="-O3 ${{ inputs.cflags }}" \
|
||||
2> stderr-${{ inputs.arch_name }}
|
||||
mv lidm lidm-${{ inputs.arch_name }}
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-${{ inputs.arch_name }}
|
||||
path: |
|
||||
lidm-${{ inputs.arch_name }}
|
||||
stderr-${{ inputs.arch_name }}
|
||||
retention-days: 1
|
65
.github/workflows/build-check.yml
vendored
65
.github/workflows/build-check.yml
vendored
@ -1,65 +0,0 @@
|
||||
name: Test Build
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
check_build:
|
||||
permissions: write-all
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- arch_name: x86_64
|
||||
cc: gcc
|
||||
cflags:
|
||||
- arch_name: x86
|
||||
cc: gcc
|
||||
cflags: -m32
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: myrotvorets/set-commit-status-action@master
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
status: pending
|
||||
context: Build (${{ matrix.arch_name }})
|
||||
|
||||
- name: Attempt Build (${{ matrix.arch_name }})
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
arch_name: ${{ matrix.arch_name }}
|
||||
cc: ${{ matrix.cc }}
|
||||
cflags: "-Wall ${{ matrix.cflags }}"
|
||||
|
||||
- name: Download Build Results
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-${{ matrix.arch_name }}
|
||||
path: build-results
|
||||
|
||||
- name: Process Results
|
||||
id: get-stats
|
||||
if: always()
|
||||
run: |
|
||||
if ! [ -d "build-results" ]; then
|
||||
# Build failed
|
||||
echo "DESCR=" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
# Build Succeeded
|
||||
cd "build-results"
|
||||
ls -lah
|
||||
cat stderr-* >&2
|
||||
WARNS="$(cat stderr-* | grep '^[^ ]*\.[ch]:' | wc -l)"
|
||||
HSIZE="$(stat --printf="%s" lidm-* | numfmt --to=iec-i)B"
|
||||
|
||||
echo "DESCR='$HSIZE, $WARNS warnings'" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Set final commit status
|
||||
uses: myrotvorets/set-commit-status-action@master
|
||||
if: always()
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
status: ${{ job.status }}
|
||||
context: Build (${{ matrix.arch_name }})
|
||||
description: ${{ steps.get-stats.outputs.DESCR }}
|
113
.github/workflows/check-and-build.yml
vendored
Normal file
113
.github/workflows/check-and-build.yml
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
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
|
||||
|
||||
build-linux-amd64:
|
||||
name: Build for amd64
|
||||
runs-on: ubuntu-24.04
|
||||
permissions: write-all
|
||||
needs: [spellcheck, shellcheck]
|
||||
|
||||
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]
|
||||
|
||||
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
|
39
.github/workflows/make-release.yml
vendored
Normal file
39
.github/workflows/make-release.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
name: Check and Build Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
required: true
|
||||
default: ''
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Check and Build
|
||||
uses: ./.github/workflows/check-and-build.yml
|
||||
permissions: write-all
|
||||
with:
|
||||
set-statuses: false
|
||||
|
||||
release:
|
||||
name: Make Release v${{ inputs.version }}
|
||||
runs-on: ubuntu-24.04
|
||||
permissions: write-all
|
||||
needs: build
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: builds
|
||||
pattern: build-*
|
||||
merge-multiple: true
|
||||
|
||||
- uses: ncipollo/release-action@v1
|
||||
with:
|
||||
tag: v${{ inputs.version }}
|
||||
commit: ${{ github.sha }}
|
||||
artifacts: builds/lidm-*
|
||||
artifactsErrorsFailBuild: true
|
||||
body: Release notes not generated yet.
|
||||
|
||||
# TODO: get checksums and commit new AUR pkgbuilds
|
91
.github/workflows/push.yml
vendored
91
.github/workflows/push.yml
vendored
@ -1,89 +1,10 @@
|
||||
name: Test Build
|
||||
name: Push Checks
|
||||
|
||||
on: push
|
||||
on:
|
||||
push
|
||||
|
||||
jobs:
|
||||
spellcheck:
|
||||
name: Check Grammar
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
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-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/check_build@v4
|
||||
- uses: awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
packages: "shellcheck"
|
||||
version: 1.0
|
||||
- run: shellcheck -P $(find . -type f -name '*.sh' -not -path './assets/pkg/aur/*/src/*')
|
||||
|
||||
check_build:
|
||||
check-and-build:
|
||||
name: Check and Build
|
||||
uses: ./.github/workflows/check-and-build.yml
|
||||
permissions: write-all
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- arch_name: x86_64
|
||||
cc: gcc
|
||||
cflags:
|
||||
- arch_name: x86
|
||||
cc: gcc
|
||||
cflags: -m32
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: myrotvorets/set-commit-status-action@master
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
status: pending
|
||||
context: Build (${{ matrix.arch_name }})
|
||||
|
||||
- name: Attempt Build (${{ matrix.arch_name }})
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
arch_name: ${{ matrix.arch_name }}
|
||||
cc: ${{ matrix.cc }}
|
||||
cflags: "-Wall ${{ matrix.cflags }}"
|
||||
|
||||
- name: Download Build Results
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-${{ matrix.arch_name }}
|
||||
path: build-results
|
||||
|
||||
- name: Process Results
|
||||
id: get-stats
|
||||
if: always()
|
||||
run: |
|
||||
if ! [ -d "build-results" ]; then
|
||||
# Build failed
|
||||
echo "DESCR=" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
# Build Succeeded
|
||||
cd "build-results"
|
||||
ls -lah
|
||||
cat stderr-* >&2
|
||||
WARNS="$(cat stderr-* | grep '^[^ ]*\.[ch]:' | wc -l)"
|
||||
HSIZE="$(stat --printf="%s" lidm-* | numfmt --to=iec-i)B"
|
||||
|
||||
echo "DESCR='$HSIZE, $WARNS warnings'" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Set final commit status
|
||||
uses: myrotvorets/set-commit-status-action@master
|
||||
if: always()
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
status: ${{ job.status }}
|
||||
context: Build (${{ matrix.arch_name }})
|
||||
description: ${{ steps.get-stats.outputs.DESCR }}
|
||||
|
56
.github/workflows/release.yml
vendored
56
.github/workflows/release.yml
vendored
@ -1,56 +0,0 @@
|
||||
name: Build for Release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- arch_name: x86_64
|
||||
cc: gcc
|
||||
cflags:
|
||||
- arch_name: x86
|
||||
cc: gcc
|
||||
cflags: -m32
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build Project
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
arch_name: ${{ matrix.arch_name }}
|
||||
cc: ${{ matrix.cc }}
|
||||
cflags: ${{ matrix.cflags }}
|
||||
|
||||
upload:
|
||||
permissions: write-all
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Merge Build Artifacts
|
||||
uses: actions/upload-artifact/merge@v4
|
||||
with:
|
||||
name: all-builds
|
||||
pattern: build-*
|
||||
delete-merged: true
|
||||
retention-days: 1
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: all-builds
|
||||
path: builds
|
||||
|
||||
- name: Upload Builds to Release
|
||||
run: |
|
||||
cd builds
|
||||
for file in ./*; do
|
||||
echo "Uploading $file..."
|
||||
gh release upload ${{ github.event.release.tag_name }} "$file" --clobber
|
||||
done
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@ -1,4 +1,4 @@
|
||||
#/usr/bin/env bash
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
MYSELF=$(realpath "$0")
|
||||
|
Loading…
x
Reference in New Issue
Block a user