Modernise the Github Actions workflow & test Python

- It now also tests the --early-preseed and --repo options implicitly.
- Upgraded all actions to v4.
- Test Python bootstrap separately.
This commit is contained in:
fosslinux 2024-12-17 18:50:53 +11:00
parent c9fa9a00f4
commit 86bd8de815
3 changed files with 86 additions and 51 deletions

View file

@ -13,13 +13,13 @@ on:
jobs: jobs:
pass1: pass1:
name: Run up to Linux build under bubblewrap name: Run up to bash under bubblewrap
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Install bubblewrap - name: Install bubblewrap
run: sudo apt install bubblewrap run: sudo apt install bubblewrap
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
# There is a strange bug(?) in nongnu, when you clone a git repository # There is a strange bug(?) in nongnu, when you clone a git repository
@ -27,7 +27,7 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Query cache for sources - name: Query cache for sources
id: cache id: cache
uses: actions/cache/restore@v3 uses: actions/cache/restore@v4
with: with:
path: | path: |
distfiles distfiles
@ -37,50 +37,42 @@ jobs:
run: ./download-distfiles.sh run: ./download-distfiles.sh
- name: Cache sources - name: Cache sources
if: steps.cache.outputs.cache-hit != 'true' if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3 uses: actions/cache/save@v4
with: with:
path: | path: |
distfiles distfiles
key: cache-${{ hashFiles('steps/*/sources') }} key: cache-${{ hashFiles('steps/*/sources') }}
- name: Run bootstrap - name: Run bootstrap
run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass1 run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass1
- name: Archive created packages - name: Create early-preseed.tar
if: failure() # archive failed builds progress run: rm -rf target/external target/steps && tar -C target/ -cf early-preseed.tar .
uses: actions/upload-artifact@v3 - name: Archive early-preseed
uses: actions/upload-artifact@v4
with: with:
name: packages name: early-preseed
path: target/external/repo/** path: early-preseed.tar
- 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: pass2:
name: Run up to Python bootstrap under bubblewrap name: Run up to just before GCC 10 under bubblewrap
needs: pass1 needs: pass1
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Install bubblewrap - name: Install bubblewrap
run: sudo apt install bubblewrap run: sudo apt install bubblewrap
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
# There is a strange bug(?) in nongnu, when you clone a git repository # There is a strange bug(?) in nongnu, when you clone a git repository
# against a commit != HEAD with depth=1, it errors out. # against a commit != HEAD with depth=1, it errors out.
fetch-depth: 0 fetch-depth: 0
- name: Get pass1_image - name: Get early_preseed
uses: actions/download-artifact@v3 uses: actions/download-artifact@v4
with: with:
name: internal_pass1_image name: early-preseed
- name: Extract pass1_image
run: tar -xf pass1_image.tar
- name: Query cache for sources - name: Query cache for sources
id: cache id: cache
uses: actions/cache/restore@v3 uses: actions/cache/restore@v4
with: with:
path: | path: |
distfiles distfiles
@ -90,26 +82,18 @@ jobs:
run: ./download-distfiles.sh run: ./download-distfiles.sh
- name: Cache sources - name: Cache sources
if: steps.cache.outputs.cache-hit != 'true' if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3 uses: actions/cache/save@v4
with: with:
path: | path: |
distfiles distfiles
key: cache-${{ hashFiles('steps/*/sources') }} key: cache-${{ hashFiles('steps/*/sources') }}
- name: Run bootstrap - name: Run bootstrap
run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass2 run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass2 --early-preseed early-preseed.tar
- name: Archive created packages - name: Archive created packages
if: failure() # archive failed builds progress uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with: with:
name: internal_packages_pass2 name: internal_packages_pass2
path: target/external/repo/** 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: pass3:
name: Run remaining builds under bubblewrap name: Run remaining builds under bubblewrap
@ -119,21 +103,24 @@ jobs:
- name: Install bubblewrap - name: Install bubblewrap
run: sudo apt install bubblewrap run: sudo apt install bubblewrap
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
# There is a strange bug(?) in nongnu, when you clone a git repository # There is a strange bug(?) in nongnu, when you clone a git repository
# against a commit != HEAD with depth=1, it errors out. # against a commit != HEAD with depth=1, it errors out.
fetch-depth: 0 fetch-depth: 0
- name: Get pass2_image - name: Get early_preseed
uses: actions/download-artifact@v3 uses: actions/download-artifact@v4
with:
name: early-preseed
- name: Get pass2 packages
uses: actions/download-artifact@v4
with: with:
name: internal_pass2_image name: internal_pass2_image
- name: Extract pass2_image path: repo/
run: tar -xf pass2_image.tar
- name: Query cache for sources - name: Query cache for sources
id: cache id: cache
uses: actions/cache/restore@v3 uses: actions/cache/restore@v4
with: with:
path: | path: |
distfiles distfiles
@ -143,16 +130,67 @@ jobs:
run: ./download-distfiles.sh run: ./download-distfiles.sh
- name: Cache sources - name: Cache sources
if: steps.cache.outputs.cache-hit != 'true' if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3 uses: actions/cache/save@v4
with: with:
path: | path: |
distfiles distfiles
key: cache-${{ hashFiles('steps/*/sources') }} key: cache-${{ hashFiles('steps/*/sources') }}
- name: Run bootstrap - name: Run bootstrap
run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass3 run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass3 --early-preseed early_preseed.tar --repo repo
- name: Archive created packages - name: Archive created packages
if: always() # archive both failed and successful builds if: always() # archive both failed and successful builds
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with:
name: packages
path: target/external/repo/**
python:
name: Run the Python bootstrap
needs: pass3
runs-on: ubuntu-latest
steps:
- name: Install bubblewrap
run: sudo apt install bubblewrap
- name: Checkout repo
uses: actions/checkout@v4
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 early_preseed
uses: actions/download-artifact@v4
with:
name: early-preseed
- name: Get full set of packages
uses: actions/download-artifact@v4
with:
name: packages
path: repo/
- name: Query cache for sources
id: cache
uses: actions/cache/restore@v4
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@v4
with:
path: |
distfiles
key: cache-${{ hashFiles('steps/*/sources') }}
- name: Run bootstrap
run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --early-preseed early_preseed.tar --repo repo --extras python
- name: Remove non-new packages
run: comm -12 <(ls -1 repo) <(ls -1 target/external/repo) | xargs -I{} rm target/external/repo/{}
- name: Archive Python packages
if: always() # archive both failed and successful builds
uses: actions/upload-artifact@v4
with: with:
name: packages name: packages
path: target/external/repo/** path: target/external/repo/**

View file

@ -220,13 +220,10 @@ print(shutil.which('chroot'))
elif args.bwrap: elif args.bwrap:
init = '/init' init = '/init'
if not args.internal_ci or args.internal_ci == "pass1": generator.prepare(target, using_kernel=False)
generator.prepare(target, using_kernel=False)
arch = stage0_arch_map.get(args.arch, args.arch) arch = stage0_arch_map.get(args.arch, args.arch)
init = os.path.join(os.sep, 'bootstrap-seeds', 'POSIX', arch, 'kaem-optional-seed') init = os.path.join(os.sep, 'bootstrap-seeds', 'POSIX', arch, 'kaem-optional-seed')
else:
generator.reuse(target)
run('env', '-i', 'bwrap', '--unshare-user', run('env', '-i', 'bwrap', '--unshare-user',
'--uid', '0', '--uid', '0',

View file

@ -52,6 +52,7 @@ build: bzip2-1.0.8
build: coreutils-5.0 build: coreutils-5.0
build: byacc-20240109 build: byacc-20240109
build: bash-2.05b build: bash-2.05b
jump: break ( INTERNAL_CI == pass1 )
improve: setup_repo improve: setup_repo
improve: update_env improve: update_env
improve: merged_usr improve: merged_usr
@ -127,7 +128,6 @@ build: kexec-tools-2.0.22 ( BUILD_LINUX == True )
improve: clean_sources improve: clean_sources
improve: clean_artifacts improve: clean_artifacts
build: linux-4.14.341-openela ( BUILD_LINUX == True ) build: linux-4.14.341-openela ( BUILD_LINUX == True )
jump: break ( INTERNAL_CI == pass1 )
improve: populate_device_nodes improve: populate_device_nodes
jump: linux ( CHROOT == False ) jump: linux ( CHROOT == False )
jump: move_disk ( KERNEL_BOOTSTRAP == True ) jump: move_disk ( KERNEL_BOOTSTRAP == True )