Skip to content

.github: miscellaneous workflow fixes #1089

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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))"
Expand Down
79 changes: 79 additions & 0 deletions .github/workflows/generic-x86-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Generic X86 GitHub Build

on:
push:
pull_request:

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: Build test spec
run: |
make test-spec

- 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

6 changes: 5 additions & 1 deletion .github/workflows/trigger.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Self Trigger
name: Kernelkit Trigger

on:
pull_request:
Expand All @@ -11,27 +11,31 @@ on:

jobs:
build-x86_64:
if: startsWith(github.repository, 'kernelkit/')
uses: ./.github/workflows/build.yml
with:
target: "x86_64"
name: "infix"
flavor: "_minimal"

build-aarch64:
if: startsWith(github.repository, 'kernelkit/')
uses: ./.github/workflows/build.yml
with:
target: "aarch64"
name: "infix"
flavor: "_minimal"

test-run-x86_64:
if: startsWith(github.repository, 'kernelkit/')
needs: build-x86_64
uses: ./.github/workflows/test.yml
with:
target: "x86_64"
name: "infix"

test-publish-x86_64:
if: startsWith(github.repository, 'kernelkit/')
needs: test-run-x86_64
uses: ./.github/workflows/publish.yml

16 changes: 16 additions & 0 deletions src/statd/python/yanger/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ def run(self, cmd, default=None, log=True):

return out

def exists(self, path):
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)

Expand Down Expand Up @@ -199,6 +211,10 @@ def run(self, cmd, default=None, log=True):
common.LOG.error(f"No recording found for run \"{path}\"")
raise

def exists(self, path):
path = os.path.join(self.replaydir, "rootfs", path[1:])
return os.path.isfile(path)

def read(self, path):
path = os.path.join(self.replaydir, "rootfs", path[1:])
try:
Expand Down
22 changes: 10 additions & 12 deletions src/statd/python/yanger/ietf_hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions test/case/statd/system/cli/show-hardware
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
USB PORTS 
NAME STATE 
USB unlocked
USB2 unlocked
USB locked
USB2 locked
4 changes: 2 additions & 2 deletions test/case/statd/system/ietf-hardware.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
},
{
"state": {
"admin-state": "unlocked",
"admin-state": "locked",
"oper-state": "enabled"
},
"name": "USB",
"class": "infix-hardware:usb"
},
{
"state": {
"admin-state": "unlocked",
"admin-state": "locked",
"oper-state": "enabled"
},
"name": "USB2",
Expand Down
8 changes: 4 additions & 4 deletions test/case/statd/system/ietf-system.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@
"search": []
},
"clock": {
"boot-datetime": "2025-04-30T09:47:32+00:00",
"current-datetime": "2025-04-30T09:48:01+00:00"
"boot-datetime": "2025-08-05T12:38:12+00:00",
"current-datetime": "2025-08-05T13:35:53+00:00"
},
"platform": {
"os-name": "Infix",
"os-version": "v25.04.0-rc1-3-g8daf1571-dirty",
"os-release": "v25.04.0-rc1-3-g8daf1571-dirty",
"os-version": "v25.06.0",
"os-release": "v25.06.0",
"machine": "x86_64"
}
}
Expand Down
12 changes: 6 additions & 6 deletions test/case/statd/system/operational.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"class": "infix-hardware:usb",
"name": "USB",
"state": {
"admin-state": "unlocked",
"admin-state": "locked",
"oper-state": "enabled"
}
},
{
"class": "infix-hardware:usb",
"name": "USB2",
"state": {
"admin-state": "unlocked",
"admin-state": "locked",
"oper-state": "enabled"
}
}
Expand All @@ -39,8 +39,8 @@
},
"ietf-system:system-state": {
"clock": {
"boot-datetime": "2025-04-30T09:47:32+00:00",
"current-datetime": "2025-04-30T09:48:01+00:00"
"boot-datetime": "2025-08-05T12:38:12+00:00",
"current-datetime": "2025-08-05T13:35:53+00:00"
},
"infix-system:dns-resolver": {
"options": {},
Expand Down Expand Up @@ -150,8 +150,8 @@
"platform": {
"machine": "x86_64",
"os-name": "Infix",
"os-release": "v25.04.0-rc1-3-g8daf1571-dirty",
"os-version": "v25.04.0-rc1-3-g8daf1571-dirty"
"os-release": "v25.06.0",
"os-version": "v25.06.0"
}
}
}
8 changes: 4 additions & 4 deletions test/case/statd/system/system/rootfs/etc/os-release
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
NAME="Infix"
ID=infix
PRETTY_NAME="Infix OS — Immutable.Friendly.Secure v25.04.0-rc1-3-g8daf1571-dirty"
PRETTY_NAME="Infix OS — Immutable.Friendly.Secure v25.06.0"
ID_LIKE="buildroot"
DEFAULT_HOSTNAME=ix
VERSION="v25.04.0-rc1-3-g8daf1571-dirty"
VERSION_ID=v25.04.0-rc1-3-g8daf1571-dirty
BUILD_ID="v25.04.0-rc1-3-g8daf1571-dirty"
VERSION="v25.06.0"
VERSION_ID=v25.06.0
BUILD_ID="v25.06.0"
IMAGE_ID="infix-x86_64"
ARCHITECTURE="x86_64"
HOME_URL=https://github.com/kernelkit/infix/
Expand Down
2 changes: 1 addition & 1 deletion test/case/statd/system/system/rootfs/proc/uptime
Original file line number Diff line number Diff line change
@@ -1 +1 @@
28.16 15.60
3460.54 3350.38
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
2 changes: 1 addition & 1 deletion test/case/statd/system/system/timestamp
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1746006481
1754400953

Loading