Merge pull request #1092 from kernelkit/github-wokflow-impovments

GitHub wokflow impovments
This commit is contained in:
Joachim Wiberg
2025-08-12 11:38:24 +02:00
committed by GitHub
10 changed files with 124 additions and 20 deletions
+3 -1
View File
@@ -55,6 +55,8 @@ jobs:
build:
name: Build ${{ 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, latest ]
env:
PARALLEL: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.parallel == 'true' || github.event_name != 'workflow_dispatch' && inputs.parallel == true }}
strategy:
fail-fast: false
outputs:
@@ -126,7 +128,7 @@ jobs:
id: parallel
run: |
if [ "${{ ((github.event.inputs.parallel == 'true' && github.event_name == 'workflow_dispatch') || (github.ref_name != 'main' && github.event_name != 'workflow_dispatch')) }}" == "true" ]; then
if [ "$PARALLEL" == "true" ]; then
echo "BR2_PER_PACKAGE_DIRECTORIES=y" >> output/.config
MAKE="make -j$((`getconf _NPROCESSORS_ONLN` / 2 + 2))"
echo "Building in parallel with -j$((`getconf _NPROCESSORS_ONLN` / 2 + 2))"
+74
View File
@@ -0,0 +1,74 @@
name: Generic X86 GitHub Build
on:
push:
jobs:
build:
if: github.repository != 'kernelkit/infix'
name: Infix x86_64
runs-on: ubuntu-latest
steps:
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
bc binutils build-essential bzip2 cpio \
diffutils file findutils git gzip \
libncurses-dev libssl-dev perl patch \
python3 rsync sed tar unzip wget \
autopoint bison flex autoconf automake \
mtools
- name: Checkout infix repo
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
ref: ${{ github.ref }}
fetch-depth: 0
submodules: recursive
- name: Set Build Variables
id: vars
run: |
echo "INFIX_BUILD_ID=${{ github.run_id }}" >> $GITHUB_OUTPUT
echo "dir=Infix-x86_64" >> $GITHUB_OUTPUT
echo "tgz=Infix-x86_64.tar.gz" >> $GITHUB_OUTPUT
echo "flv=_minimal" >> $GITHUB_OUTPUT
- name: Configure x86_64_minimal
run: |
make x86_64_minimal_defconfig
- name: Unit Test x86_64
run: |
make test-unit
- name: Build x86_64_minimal
run: |
make
- name: Check SBOM
run: |
make legal-info
- name: Report Build Size
run: |
du -sh .
du -sh output
du -sh dl || true
ls -l output/images/
- name: Prepare Artifact
run: |
cd output/
mv images Infix-x86_64
ln -s Infix-x86_64 images
tar cfz Infix-x86_64.tar.gz Infix-x86_64
- uses: actions/upload-artifact@v4
with:
path: output/Infix-x86_64.tar.gz
name: artifact-x86_64
+5 -1
View File
@@ -1,4 +1,4 @@
name: Self Trigger
name: Kernelkit Trigger
on:
pull_request:
@@ -11,6 +11,7 @@ on:
jobs:
build-x86_64:
if: startsWith(github.repository, 'kernelkit/')
uses: ./.github/workflows/build.yml
with:
target: "x86_64"
@@ -18,6 +19,7 @@ jobs:
flavor: "_minimal"
build-aarch64:
if: startsWith(github.repository, 'kernelkit/')
uses: ./.github/workflows/build.yml
with:
target: "aarch64"
@@ -25,6 +27,7 @@ jobs:
flavor: "_minimal"
test-run-x86_64:
if: startsWith(github.repository, 'kernelkit/')
needs: build-x86_64
uses: ./.github/workflows/test.yml
with:
@@ -32,6 +35,7 @@ jobs:
name: "infix"
test-publish-x86_64:
if: startsWith(github.repository, 'kernelkit/')
needs: test-run-x86_64
uses: ./.github/workflows/publish.yml
+24
View File
@@ -116,6 +116,11 @@ class Localhost(Host):
return None
def exists(self, path: str) -> bool:
try:
return os.path.exists(path)
except OSError:
return False
class Remotehost(Localhost):
def __init__(self, prefix, capdir):
@@ -159,6 +164,18 @@ class Remotehost(Localhost):
return out
def exists(self, path: str) -> bool:
if not self._run(("ls", path), default="", log=False):
return False
if self.capdir:
dirname = os.path.join(self.capdir, "rootfs", os.path.dirname(path[1:]))
filname = os.path.join(self.capdir, "rootfs", path[1:])
os.makedirs(dirname, exist_ok=True)
open(filname, "w", encoding='utf-8').close() # Create empty file
return True
def read(self, path):
out = self._run(("cat", path), default="", log=False)
@@ -199,6 +216,13 @@ class Replayhost(Host):
common.LOG.error(f"No recording found for run \"{path}\"")
raise
def exists(self, path: str) -> bool:
path = os.path.join(self.replaydir, "rootfs", path[1:])
try:
return os.path.exists(path)
except OSError:
return False
def read(self, path):
path = os.path.join(self.replaydir, "rootfs", path[1:])
try:
+10 -12
View File
@@ -61,18 +61,16 @@ def usb_port_components(systemjson):
path = usb_port["path"]
if os.path.basename(path) == "authorized_default":
# TODO: Untestable. Should be done via the host API
if os.path.exists(path):
with open(path, "r") as f:
names.append(usb_port["name"])
data = int(f.readline().strip())
enabled = "unlocked" if data == 1 else "locked"
port["state"] = {}
port["state"]["admin-state"] = enabled
port["name"] = usb_port["name"]
port["class"] = "infix-hardware:usb"
port["state"]["oper-state"] = "enabled"
ports.append(port)
if HOST.exists(path):
names.append(usb_port["name"])
data = int(HOST.read(path))
enabled = "unlocked" if data == 1 else "locked"
port["state"] = {}
port["state"]["admin-state"] = enabled
port["name"] = usb_port["name"]
port["class"] = "infix-hardware:usb"
port["state"]["oper-state"] = "enabled"
ports.append(port)
return ports
+2 -2
View File
@@ -1,4 +1,4 @@
USB PORTS 
NAME STATE 
USB unlocked
USB2 unlocked
USB locked
USB2 locked
+2 -2
View File
@@ -7,7 +7,7 @@
},
{
"state": {
"admin-state": "unlocked",
"admin-state": "locked",
"oper-state": "enabled"
},
"name": "USB",
@@ -15,7 +15,7 @@
},
{
"state": {
"admin-state": "unlocked",
"admin-state": "locked",
"oper-state": "enabled"
},
"name": "USB2",
+2 -2
View File
@@ -9,7 +9,7 @@
"class": "infix-hardware:usb",
"name": "USB",
"state": {
"admin-state": "unlocked",
"admin-state": "locked",
"oper-state": "enabled"
}
},
@@ -17,7 +17,7 @@
"class": "infix-hardware:usb",
"name": "USB2",
"state": {
"admin-state": "unlocked",
"admin-state": "locked",
"oper-state": "enabled"
}
}