mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-31 13:03:02 +02:00
.github: refactor, simplify, and reduce duplication in actions
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
|||||||
|
name: 'Restore Build Caches'
|
||||||
|
description: 'Restore dl/ and .ccache/ caches for Buildroot builds'
|
||||||
|
inputs:
|
||||||
|
target:
|
||||||
|
description: 'Build target for cache key differentiation'
|
||||||
|
required: true
|
||||||
|
dl-prefix:
|
||||||
|
description: 'Prefix for dl/ cache key (e.g., "dl", "dl-boot")'
|
||||||
|
required: false
|
||||||
|
default: 'dl'
|
||||||
|
ccache-prefix:
|
||||||
|
description: 'Prefix for .ccache/ cache key (e.g., "ccache", "ccache-boot")'
|
||||||
|
required: false
|
||||||
|
default: 'ccache'
|
||||||
|
enabled:
|
||||||
|
description: 'Set to false to skip cache restoration'
|
||||||
|
required: false
|
||||||
|
default: 'true'
|
||||||
|
runs:
|
||||||
|
using: 'composite'
|
||||||
|
steps:
|
||||||
|
- name: Restore Cache of dl/
|
||||||
|
if: ${{ inputs.enabled == 'true' }}
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: dl/
|
||||||
|
key: ${{ inputs.dl-prefix }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ inputs.dl-prefix }}-
|
||||||
|
dl-
|
||||||
|
|
||||||
|
- name: Restore Cache of .ccache/
|
||||||
|
if: ${{ inputs.enabled == 'true' }}
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: .ccache/
|
||||||
|
key: ${{ inputs.ccache-prefix }}-${{ inputs.target }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ inputs.ccache-prefix }}-${{ inputs.target }}-
|
||||||
|
${{ inputs.ccache-prefix }}-
|
||||||
|
ccache-
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
name: 'Podman Cleanup'
|
||||||
|
description: 'Clean up stale podman state from previous runs'
|
||||||
|
runs:
|
||||||
|
using: 'composite'
|
||||||
|
steps:
|
||||||
|
- name: Cleanup podman state
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
podman ps -a || true
|
||||||
|
podman stop -a || true
|
||||||
|
podman rm -a -f || true
|
||||||
|
podman volume prune -f || true
|
||||||
|
podman system prune -a -f || true
|
||||||
|
podman system migrate || true
|
||||||
@@ -64,24 +64,11 @@ jobs:
|
|||||||
|
|
||||||
echo "Building ${defconfig}_defconfig, version ${version}-${rev}, artifact ${archive} ..."
|
echo "Building ${defconfig}_defconfig, version ${version}-${rev}, artifact ${archive} ..."
|
||||||
|
|
||||||
- name: Restore Cache of dl/
|
- uses: ./.github/actions/cache-restore
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
with:
|
||||||
path: dl/
|
target: ${{ matrix.defconfig }}
|
||||||
key: dl-boot-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
|
dl-prefix: dl-boot
|
||||||
restore-keys: |
|
ccache-prefix: ccache-boot
|
||||||
dl-boot-
|
|
||||||
dl-
|
|
||||||
|
|
||||||
- name: Restore Cache of .ccache/
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: .ccache/
|
|
||||||
key: ccache-boot-${{ matrix.defconfig }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
|
|
||||||
restore-keys: |
|
|
||||||
ccache-boot-${{ matrix.defconfig }}-
|
|
||||||
ccache-boot-
|
|
||||||
ccache-
|
|
||||||
|
|
||||||
- name: Configure ${{ matrix.defconfig }}_defconfig
|
- name: Configure ${{ matrix.defconfig }}_defconfig
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -23,21 +23,13 @@ jobs:
|
|||||||
target: [aarch64, arm, x86_64]
|
target: [aarch64, arm, x86_64]
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
steps:
|
steps:
|
||||||
- name: Cleanup podman state
|
|
||||||
run: |
|
|
||||||
set -x
|
|
||||||
podman ps -a || true
|
|
||||||
podman stop -a || true
|
|
||||||
podman rm -a -f || true
|
|
||||||
podman volume prune -f || true
|
|
||||||
podman system prune -a -f || true
|
|
||||||
podman system migrate || true
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
clean: true
|
clean: true
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
|
- uses: ./.github/actions/podman-cleanup
|
||||||
|
|
||||||
- name: Set Release Variables
|
- name: Set Release Variables
|
||||||
id: vars
|
id: vars
|
||||||
run: |
|
run: |
|
||||||
@@ -48,24 +40,10 @@ jobs:
|
|||||||
echo "dir=infix-$target" >> $GITHUB_OUTPUT
|
echo "dir=infix-$target" >> $GITHUB_OUTPUT
|
||||||
echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT
|
echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Restore Cache of dl/
|
- uses: ./.github/actions/cache-restore
|
||||||
if: ${{ inputs.use_cache }}
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
with:
|
||||||
path: dl/
|
target: ${{ matrix.target }}
|
||||||
key: dl-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
|
enabled: ${{ inputs.use_cache }}
|
||||||
restore-keys: |
|
|
||||||
dl-
|
|
||||||
|
|
||||||
- name: Restore Cache of .ccache/
|
|
||||||
if: ${{ inputs.use_cache }}
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: .ccache/
|
|
||||||
key: ccache-${{ matrix.target }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
|
|
||||||
restore-keys: |
|
|
||||||
ccache-${{ matrix.target }}-
|
|
||||||
ccache-
|
|
||||||
|
|
||||||
- name: Configure & Build
|
- name: Configure & Build
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -78,15 +78,6 @@ jobs:
|
|||||||
rm -rf ./* || true
|
rm -rf ./* || true
|
||||||
rm -rf ./.??* || true
|
rm -rf ./.??* || true
|
||||||
ls -la ./
|
ls -la ./
|
||||||
- name: Cleanup podman state
|
|
||||||
run: |
|
|
||||||
set -x
|
|
||||||
podman ps -a || true
|
|
||||||
podman stop -a || true
|
|
||||||
podman rm -a -f || true
|
|
||||||
podman volume prune -f || true
|
|
||||||
podman system prune -a -f || true
|
|
||||||
podman system migrate || true
|
|
||||||
|
|
||||||
- name: Checkout infix repo
|
- name: Checkout infix repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -98,6 +89,8 @@ jobs:
|
|||||||
submodules: recursive
|
submodules: recursive
|
||||||
token: ${{ secrets.CHECKOUT_TOKEN || github.token }}
|
token: ${{ secrets.CHECKOUT_TOKEN || github.token }}
|
||||||
|
|
||||||
|
- uses: ./.github/actions/podman-cleanup
|
||||||
|
|
||||||
- name: Run pre-build script
|
- name: Run pre-build script
|
||||||
if: ${{ inputs.pre_build_script != '' }}
|
if: ${{ inputs.pre_build_script != '' }}
|
||||||
run: |
|
run: |
|
||||||
@@ -127,22 +120,9 @@ jobs:
|
|||||||
echo "tgz=${name}-${target}.tar.gz" >> $GITHUB_OUTPUT
|
echo "tgz=${name}-${target}.tar.gz" >> $GITHUB_OUTPUT
|
||||||
echo "Building target ${target}_defconfig"
|
echo "Building target ${target}_defconfig"
|
||||||
|
|
||||||
- name: Restore Cache of dl/
|
- uses: ./.github/actions/cache-restore
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
with:
|
||||||
path: dl/
|
target: ${{ env.TARGET }}
|
||||||
key: dl-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
|
|
||||||
restore-keys: |
|
|
||||||
dl-
|
|
||||||
|
|
||||||
- name: Restore Cache of .ccache/
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: .ccache/
|
|
||||||
key: ccache-${{ env.TARGET }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
|
|
||||||
restore-keys: |
|
|
||||||
ccache-${{ env.TARGET }}-
|
|
||||||
ccache-
|
|
||||||
|
|
||||||
- name: Configure ${{ env.TARGET }}
|
- name: Configure ${{ env.TARGET }}
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -45,22 +45,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Restore Cache of dl/
|
- uses: ./.github/actions/cache-restore
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
with:
|
||||||
path: dl/
|
target: x86_64
|
||||||
key: dl-netconf-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
|
dl-prefix: dl-netconf
|
||||||
restore-keys: |
|
|
||||||
dl-netconf-
|
|
||||||
dl-
|
|
||||||
- name: Restore Cache of .ccache/
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: .ccache/
|
|
||||||
key: ccache-x86_64-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
|
|
||||||
restore-keys: |
|
|
||||||
ccache-x86_64-
|
|
||||||
ccache-
|
|
||||||
- name: Disk inventory (2/2) ...
|
- name: Disk inventory (2/2) ...
|
||||||
run: |
|
run: |
|
||||||
echo "df -h ========================================================================="
|
echo "df -h ========================================================================="
|
||||||
|
|||||||
@@ -48,20 +48,12 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
discussions: write
|
discussions: write
|
||||||
steps:
|
steps:
|
||||||
- name: Cleanup podman state
|
|
||||||
run: |
|
|
||||||
set -x
|
|
||||||
podman ps -a || true
|
|
||||||
podman stop -a || true
|
|
||||||
podman rm -a -f || true
|
|
||||||
podman volume prune -f || true
|
|
||||||
podman system prune -a -f || true
|
|
||||||
podman system migrate || true
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: 'true'
|
submodules: 'true'
|
||||||
|
|
||||||
|
- uses: ./.github/actions/podman-cleanup
|
||||||
|
|
||||||
- name: Set Release Variables
|
- name: Set Release Variables
|
||||||
id: rel
|
id: rel
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -60,16 +60,6 @@ jobs:
|
|||||||
name: Regression Test ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.name || inputs.name }} ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target || inputs.target }}
|
name: Regression Test ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.name || inputs.name }} ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target || inputs.target }}
|
||||||
runs-on: [self-hosted, regression]
|
runs-on: [self-hosted, regression]
|
||||||
steps:
|
steps:
|
||||||
- name: Cleanup podman state
|
|
||||||
run: |
|
|
||||||
set -x
|
|
||||||
podman ps -a || true
|
|
||||||
podman stop -a || true
|
|
||||||
podman rm -a -f || true
|
|
||||||
podman volume prune -f || true
|
|
||||||
podman system prune -a -f || true
|
|
||||||
podman system migrate || true
|
|
||||||
|
|
||||||
- name: Checkout infix repo
|
- name: Checkout infix repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@@ -80,6 +70,8 @@ jobs:
|
|||||||
submodules: recursive
|
submodules: recursive
|
||||||
token: ${{ secrets.CHECKOUT_TOKEN || github.token }}
|
token: ${{ secrets.CHECKOUT_TOKEN || github.token }}
|
||||||
|
|
||||||
|
- uses: ./.github/actions/podman-cleanup
|
||||||
|
|
||||||
- name: Run pre-test script
|
- name: Run pre-test script
|
||||||
if: ${{ inputs.pre_test_script != '' }}
|
if: ${{ inputs.pre_test_script != '' }}
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Kernelkit Trigger
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|||||||
Reference in New Issue
Block a user