From 98a37163de742cfbffefe336198b0cfe00e8691f Mon Sep 17 00:00:00 2001 From: keyboard-slayer Date: Mon, 26 Aug 2024 22:27:16 +0200 Subject: [PATCH] meta: add distrib script and Gh action --- .github/workflows/build.yml | 33 +++++++++++++++++++++++++++++++++ .gitignore | 3 ++- meta/plugins/dist.py | 17 +++++++++++++++++ meta/targets/efi-x86_64.json | 5 +++-- 4 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 meta/plugins/dist.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..c71e7b3 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +name: Nightly Build +on: [push] + +jobs: + ubuntu: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + sudo apt-get update -y && \ + sudo apt-get install -y install build-essential git ninja-build nasm gcc-multilib + bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" llvm 18 + + - name: Build + run: | + ./build.sh dist + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: bootx64.efi + path: .cutekit/dist/bootx64.efi + if-no-files-found: error \ No newline at end of file diff --git a/.gitignore b/.gitignore index 04a20af..1710761 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -.cutekit +.cutekit/ +__pycache__/ .DS_Store diff --git a/meta/plugins/dist.py b/meta/plugins/dist.py new file mode 100644 index 0000000..5c113a3 --- /dev/null +++ b/meta/plugins/dist.py @@ -0,0 +1,17 @@ +from pathlib import Path +from cutekit import cli, model, builder, shell, const + + +@cli.command("d", "dist", "Make booboot easier to distribute") +def _(args: model.TargetArgs): + registry = model.Registry.use(args) + component = registry.lookup("booboot", model.Component) + dist = Path(const.PROJECT_CK_DIR) / "dist" + dist.mkdir(parents=True, exist_ok=True) + + for target in registry.iter(model.Target): + scope = builder.TargetScope(registry, target) + shell.cp( + builder.build(scope, component)[0].path, + str(dist / target.props["filename"]), + ) diff --git a/meta/targets/efi-x86_64.json b/meta/targets/efi-x86_64.json index 94bc248..e383573 100644 --- a/meta/targets/efi-x86_64.json +++ b/meta/targets/efi-x86_64.json @@ -8,7 +8,8 @@ "sys": "efi", "abi": "ms", "freestanding": false, - "host": false + "host": false, + "filename": "bootx64.efi" }, "tools": { "cc": { @@ -63,4 +64,4 @@ ] } } -} +} \ No newline at end of file