mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-23 03:26:31 +01:00
Add CI workflow for wrap and fix lint warnings
This commit is contained in:
parent
cdd1114dc5
commit
fc2c576dde
3 changed files with 172 additions and 6 deletions
153
.github/workflows/wrap.yml
vendored
Normal file
153
.github/workflows/wrap.yml
vendored
Normal file
|
|
@ -0,0 +1,153 @@
|
||||||
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||||
|
# SPDX-FileCopyrightText: 2024 Max Hearnden <maxoscarhearnden@gmail.com>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
name: Run under wrap
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pass1:
|
||||||
|
name: Run up to Linux build under wrap
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
# There is a strange bug(?) in nongnu, when you clone a git repository
|
||||||
|
# against a commit != HEAD with depth=1, it errors out.
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Query cache for sources
|
||||||
|
id: cache
|
||||||
|
uses: actions/cache/restore@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
distfiles
|
||||||
|
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||||
|
- name: Get sources
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: ./download-distfiles.sh
|
||||||
|
- name: Cache sources
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
uses: actions/cache/save@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
distfiles
|
||||||
|
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||||
|
- name: Run bootstrap
|
||||||
|
run: ./rootfs.py --wrap --external-sources --build-kernels --cores 2 --internal-ci pass1
|
||||||
|
- name: Archive created packages
|
||||||
|
if: failure() # archive failed builds progress
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: packages
|
||||||
|
path: target/external/repo/**
|
||||||
|
- name: Tar pass1 image
|
||||||
|
run: tar -cf pass1_image.tar target
|
||||||
|
- name: Archive pass1_image
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: internal_pass1_image
|
||||||
|
path: pass1_image.tar
|
||||||
|
|
||||||
|
pass2:
|
||||||
|
name: Run up to Python bootstrap under wrap
|
||||||
|
needs: pass1
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
# There is a strange bug(?) in nongnu, when you clone a git repository
|
||||||
|
# against a commit != HEAD with depth=1, it errors out.
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Get pass1_image
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: internal_pass1_image
|
||||||
|
- name: Extract pass1_image
|
||||||
|
run: tar -xf pass1_image.tar
|
||||||
|
- name: Query cache for sources
|
||||||
|
id: cache
|
||||||
|
uses: actions/cache/restore@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
distfiles
|
||||||
|
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||||
|
- name: Get sources
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: ./download-distfiles.sh
|
||||||
|
- name: Cache sources
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
uses: actions/cache/save@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
distfiles
|
||||||
|
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||||
|
- name: Run bootstrap
|
||||||
|
run: ./rootfs.py --wrap --external-sources --build-kernels --cores 2 --internal-ci pass2
|
||||||
|
- name: Archive created packages
|
||||||
|
if: failure() # archive failed builds progress
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: internal_packages_pass2
|
||||||
|
path: target/external/repo/**
|
||||||
|
- name: Tar pass2 image
|
||||||
|
run: tar -cf pass2_image.tar target
|
||||||
|
- name: Archive pass2_image
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: internal_pass2_image
|
||||||
|
path: pass2_image.tar
|
||||||
|
|
||||||
|
pass3:
|
||||||
|
name: Run remaining builds under wrap
|
||||||
|
needs: pass2
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
# There is a strange bug(?) in nongnu, when you clone a git repository
|
||||||
|
# against a commit != HEAD with depth=1, it errors out.
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Get pass2_image
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: internal_pass2_image
|
||||||
|
- name: Extract pass2_image
|
||||||
|
run: tar -xf pass2_image.tar
|
||||||
|
- name: Query cache for sources
|
||||||
|
id: cache
|
||||||
|
uses: actions/cache/restore@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
distfiles
|
||||||
|
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||||
|
- name: Get sources
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: ./download-distfiles.sh
|
||||||
|
- name: Cache sources
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
uses: actions/cache/save@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
distfiles
|
||||||
|
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||||
|
- name: Run bootstrap
|
||||||
|
run: ./rootfs.py --wrap --external-sources --build-kernels --cores 2 --internal-ci pass3
|
||||||
|
- name: Archive created packages
|
||||||
|
if: always() # archive both failed and successful builds
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: packages
|
||||||
|
path: target/external/repo/**
|
||||||
|
|
@ -42,7 +42,13 @@ class Generator():
|
||||||
self.external_dir = os.path.join(self.target_dir, 'external')
|
self.external_dir = os.path.join(self.target_dir, 'external')
|
||||||
self.distfiles()
|
self.distfiles()
|
||||||
|
|
||||||
def prepare(self, target, using_kernel=False, kernel_bootstrap=False, wrap=False, target_size=0):
|
# pylint: disable=too-many-arguments
|
||||||
|
def prepare(self,
|
||||||
|
target,
|
||||||
|
using_kernel=False,
|
||||||
|
kernel_bootstrap=False,
|
||||||
|
wrap=False,
|
||||||
|
target_size=0):
|
||||||
"""
|
"""
|
||||||
Prepare basic media of live-bootstrap.
|
Prepare basic media of live-bootstrap.
|
||||||
/steps -- contains steps to be built
|
/steps -- contains steps to be built
|
||||||
|
|
@ -141,8 +147,10 @@ class Generator():
|
||||||
if os.path.isfile(os.path.join(seed_dir, entry)):
|
if os.path.isfile(os.path.join(seed_dir, entry)):
|
||||||
shutil.copy2(os.path.join(seed_dir, entry), os.path.join(self.target_dir, entry))
|
shutil.copy2(os.path.join(seed_dir, entry), os.path.join(self.target_dir, entry))
|
||||||
if wrap:
|
if wrap:
|
||||||
shutil.copy2(os.path.join(seed_dir, 'after-wrap.kaem'), os.path.join(self.target_dir, 'after.kaem'))
|
shutil.copy2(os.path.join(seed_dir, 'after-wrap.kaem'),
|
||||||
shutil.copy2(os.path.join(seed_dir, 'after.kaem'), os.path.join(self.target_dir, 'after-wrapped.kaem'))
|
os.path.join(self.target_dir, 'after.kaem'))
|
||||||
|
shutil.copy2(os.path.join(seed_dir, 'after.kaem'),
|
||||||
|
os.path.join(self.target_dir, 'after-wrapped.kaem'))
|
||||||
|
|
||||||
def distfiles(self):
|
def distfiles(self):
|
||||||
"""Copy in distfiles"""
|
"""Copy in distfiles"""
|
||||||
|
|
|
||||||
11
rootfs.py
11
rootfs.py
|
|
@ -243,10 +243,15 @@ print(shutil.which('chroot'))
|
||||||
init)
|
init)
|
||||||
|
|
||||||
elif args.wrap:
|
elif args.wrap:
|
||||||
generator.prepare(target, wrap = True)
|
|
||||||
arch = stage0_arch_map.get(args.arch, args.arch)
|
arch = stage0_arch_map.get(args.arch, args.arch)
|
||||||
init = os.path.join('bootstrap-seeds', 'POSIX', arch, 'kaem-optional-seed')
|
if not args.internal_ci or args.internal_ci == "pass1":
|
||||||
run(init, cwd = generator.target_dir)
|
generator.prepare(target, wrap = True)
|
||||||
|
arg_list = [os.path.join('bootstrap-seeds', 'POSIX', arch, 'kaem-optional-seed')]
|
||||||
|
else:
|
||||||
|
generator.reuse(target)
|
||||||
|
arg_list = [os.path.join(arch, 'bin', 'wrap'), '/init']
|
||||||
|
|
||||||
|
run(*arg_list, cwd = generator.target_dir)
|
||||||
|
|
||||||
elif args.bare_metal:
|
elif args.bare_metal:
|
||||||
if args.kernel:
|
if args.kernel:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue