Skip to content
Merged
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
55 changes: 41 additions & 14 deletions .github/CI.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ flowchart TD
B --> D[Documentation: Sphinx 5 / 7 / 9]
B --> L[Restore verified downloads and compiler cache]
L --> E[Build images and Pages once]
E --> F[Host and build regressions]
E --> F[Product and core regressions]
B --> R[Isolated regressions: kernel / auth / pages]
F --> G[Record commit and SHA-256 / upload products]
G --> H[BIOS: disk / live / installer]
G --> I[UEFI: disk / live / installer]
B --> J[CI result]
C --> J
D --> J
R --> J
H --> J
I --> J
J --> K[Deploy the verified Pages artifact on main]
Expand All @@ -40,18 +42,34 @@ filter's file-count limit. Manual runs default to validation only. Checking

## Products, signatures and deployment

The build job runs `make all pages` and `make test` in one working tree. This
lets product-dependent regressions consume the current SDK, libraries and
staging tree without transferring the entire compiler output between jobs.
The build job runs `make all pages` and then
`make RELIEFOS_CI_TEST_GROUP=core test` in one working tree. This lets
product-dependent regressions consume the current SDK, libraries and staging
tree without transferring the entire compiler output between jobs.
Common runner dependencies live in `scripts/ci/install.sh` and the local setup
action. The build checkout includes full Git history for kernel rollback
regressions. Host development packages include FFmpeg, Cairo, GLib and Xvfb.

Builds start alongside workflow checks and the documentation matrix; the final
gate still requires all selected stages. `make -j"$(nproc)" test` passes the
jobserver through the contract runner to nested Make processes. Suites remain
sequential because some temporarily probe shared source files. Each suite logs
its elapsed seconds, and a dry run never executes its scripts.
Three focused regression jobs start alongside the product build, workflow
checks and documentation matrix. `test-ci-kernel` covers concurrent and
incremental builds, the kernel adapter, header boundaries, reproducibility and
submodule rollback; `test-ci-auth` covers authentication staging;
`test-ci-pages` covers complete site assembly. Each job has its own checkout
and output tree and builds only its group's prerequisites. The final gate
requires the product build, every regression group and both boot jobs.
Focused groups install the compiler, native tools and their specific test
dependencies; they do not install the product build's FFmpeg and GUI stack.
The kernel group also installs image and boot tools because its concurrency
contract checks that the complete `make doctor` can run while a build holds
the output lock.

`tools/ci_test_shards.py` owns the test partition and supplies the workflow
matrix. It checks that each focused suite exists and belongs to exactly one
group; new suites join core automatically. Ordinary `make test` continues to
run every suite. `make -j"$(nproc)"` passes the jobserver through the contract
runner to nested Make processes. Suites within a group remain sequential
because some temporarily probe shared source files. Each suite logs its
elapsed seconds, and a dry run never executes its scripts.

The download cache covers both repositories' `cache/downloads`, keyed by both
dependency locks and runner platform. A fallback can supply unchanged archives
Expand All @@ -61,10 +79,16 @@ so a later test failure does not throw them away. ReliefNT fetch is already
delegated by the parent and is not repeated.

`ccache` wraps the standard compiler names for the build and its nested tests.
Its cache is limited to 1 GiB, checks compiler contents, and retains the default
header, flag and working-directory checks. Path rewriting stays disabled so
Kbuild source/dependency records retain their native paths. Each run saves a new cache, even
after a test failure, and reports hits/misses in the run summary. No output
Compiler caches have separate keys for the product build (4G), kernel tests
(2G), authentication tests (1G) and Pages tests (1G). They check compiler
contents and retain the default header, flag and working-directory checks.
Path rewriting stays disabled so Kbuild source/dependency records retain their
native paths. Each run saves a new cache, even after a test failure, and reports
hits/misses in the run summary. A main-only maintenance job retains at most two
snapshots per role/platform/ref and applies an 8 GiB budget to the new compiler
cache namespace, always preserving the latest main snapshot for each role and
platform. It leaves download, legacy and unrelated caches alone. Only this
maintenance job receives Actions write permission; PR checks do not. No output
tree, signed APK, image or private key is restored from a build cache. GitHub's
cache ref scope separates PR caches from the default branch. The pinned
actionlint binary has a separate platform/version cache; warm runs avoid
Expand All @@ -78,7 +102,9 @@ directory and is removed before artifact upload, including on failure.

`ci/manifest.json` records the source commit, kernel release, sizes and SHA-256
of all three boot media, `.config` and `kernel-install/install.bundle.json`.
The exact same installer must appear in Pages. The public Pages tree contains
The exact same installer must appear in Pages. Image transfer uses ZIP
compression level 1; the manifest continues to identify the uncompressed
image bytes. The public Pages tree contains
the manifest as `build-manifest.json`. Boot jobs verify all five files both
before and after running; they call the existing acceptance runner directly
and never invoke Make or rebuild an image.
Expand All @@ -101,6 +127,7 @@ superseded PR runs. GitHub Release publication remains a separate procedure.
actionlint
shellcheck scripts/ci/*.sh
sh tests/build/test-ci.sh
python3 tools/ci_test_shards.py --check
```

The workflow pins third-party action commits and actionlint's version. Full
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Prepare ReliefOS runner
description: Install the shared build or boot-test environment on Ubuntu 24.04.
inputs:
profile:
description: Runner profile (build or smoke)
description: Runner profile (build, kernel, auth, pages or smoke)
required: true
runs:
using: composite
Expand All @@ -13,7 +13,7 @@ runs:
SETUP_PROFILE: ${{ inputs.profile }}
run: bash scripts/ci/install.sh "$SETUP_PROFILE"
- name: Enable APK staging namespaces
if: inputs.profile == 'build'
if: inputs.profile != 'smoke'
shell: bash
run: |
for setting in kernel.apparmor_restrict_unprivileged_userns kernel.unprivileged_userns_clone; do
Expand All @@ -25,7 +25,7 @@ runs:
done
unshare -Ur true
- name: Enable compiler cache
if: inputs.profile == 'build'
if: inputs.profile != 'smoke'
shell: bash
run: |
sudo update-ccache-symlinks
Expand Down
124 changes: 117 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
build: ${{ steps.scope.outputs.build }}
docs: ${{ steps.scope.outputs.docs }}
publish: ${{ steps.scope.outputs.publish }}
test-groups: ${{ steps.groups.outputs.groups }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand All @@ -45,6 +46,11 @@ jobs:
- name: Select checks for this commit
id: scope
run: python3 tools/ci.py changes
- name: Select every focused regression group
id: groups
run: |
groups=$(python3 tools/ci_test_shards.py --groups-json)
printf 'groups=%s\n' "$groups" >> "$GITHUB_OUTPUT"

checks:
name: Workflow and orchestration checks
Expand Down Expand Up @@ -77,7 +83,7 @@ jobs:
- name: Check CI scripts
run: |
shellcheck scripts/ci/*.sh
python3 -m unittest discover -s tools/tests -p test_ci.py -v
python3 -m unittest discover -s tools/tests -p 'test_ci*.py' -v

documentation:
name: Documentation
Expand All @@ -96,7 +102,7 @@ jobs:
# Kbuild's native source/dependency records retain their absolute paths.
CCACHE_BASEDIR: ''
CCACHE_COMPILERCHECK: content
CCACHE_MAXSIZE: 1G
CCACHE_MAXSIZE: 4G
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand All @@ -122,8 +128,9 @@ jobs:
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }}
key: ccache-v2-${{ runner.os }}-${{ runner.arch }}-build-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: |
ccache-v2-${{ runner.os }}-${{ runner.arch }}-build-
ccache-v1-${{ runner.os }}-${{ runner.arch }}-
- name: Reset compiler cache statistics
run: ccache --zero-stats
Expand Down Expand Up @@ -161,11 +168,11 @@ jobs:
run: |
mkdir -p out/x86_64/release/ci
make -j"$(nproc)" APK_SIGNING_KEY="$APK_SIGNING_KEY" all pages 2>&1 | tee out/x86_64/release/ci/build.log
- name: Run host and build regressions
- name: Run product and core regressions
timeout-minutes: 60
run: |
mkdir -p out/tmp
TMPDIR="$PWD/out/tmp" make -j"$(nproc)" APK_SIGNING_KEY="$APK_SIGNING_KEY" test 2>&1 | tee out/x86_64/release/ci/regressions.log
TMPDIR="$PWD/out/tmp" make -j"$(nproc)" APK_SIGNING_KEY="$APK_SIGNING_KEY" RELIEFOS_CI_TEST_GROUP=core test 2>&1 | tee out/x86_64/release/ci/regressions.log
- name: Verify products and record their identity
run: |
qemu-img info out/x86_64/release/images/reliefos.vmdk
Expand Down Expand Up @@ -198,7 +205,7 @@ jobs:
out/x86_64/release/ci/manifest.json
include-hidden-files: true
if-no-files-found: error
compression-level: 0
compression-level: 1
retention-days: 3
- name: Upload verified Pages tree
if: needs.changes.outputs.publish == 'true'
Expand All @@ -219,6 +226,91 @@ jobs:
if-no-files-found: warn
retention-days: 7

regressions:
name: Regressions (${{ matrix.group }})
needs: changes
if: needs.changes.outputs.build == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
group: ${{ fromJSON(needs.changes.outputs.test-groups) }}
env:
CCACHE_DIR: ${{ github.workspace }}/cache/ccache
CCACHE_BASEDIR: ''
CCACHE_COMPILERCHECK: content
CCACHE_MAXSIZE: ${{ matrix.group == 'kernel' && '2G' || '1G' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
submodules: recursive
persist-credentials: false
- uses: ./.github/actions/setup
with:
profile: ${{ matrix.group }}
- name: Restore locked dependency downloads
id: download-cache
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: |
cache/downloads
kernel/reliefnt/cache/downloads
key: downloads-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('configs/dependencies.lock.json', 'kernel/reliefnt/configs/dependencies.lock.json') }}
restore-keys: |
downloads-v1-${{ runner.os }}-${{ runner.arch }}-
- name: Restore compiler cache for this group
id: compiler-cache
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-v2-${{ runner.os }}-${{ runner.arch }}-${{ matrix.group }}-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: |
ccache-v2-${{ runner.os }}-${{ runner.arch }}-${{ matrix.group }}-
- name: Prepare build configuration
env:
INSTALLER_ROOT_SIZE_MIB: ${{ inputs.installer_root_size_mib || '32' }}
run: bash scripts/ci/configure.sh
- name: Save verified dependency downloads
if: steps.download-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: |
cache/downloads
kernel/reliefnt/cache/downloads
key: ${{ steps.download-cache.outputs.cache-primary-key }}
- name: Validate the complete test partition
run: python3 tools/ci_test_shards.py --check
- name: Reset compiler cache statistics
run: ccache --zero-stats
- name: Run isolated regression group
env:
TEST_GROUP: ${{ matrix.group }}
run: |
mkdir -p out/tmp out/x86_64/release/ci
TMPDIR="$PWD/out/tmp" make -j"$(nproc)" "test-ci-$TEST_GROUP" 2>&1 | tee "out/x86_64/release/ci/regressions-$TEST_GROUP.log"
- name: Report compiler cache usage
if: ${{ !cancelled() && steps.compiler-cache.outcome == 'success' }}
run: ccache --show-stats | tee -a "$GITHUB_STEP_SUMMARY"
- name: Save compiler cache for this group
if: ${{ !cancelled() && steps.compiler-cache.outcome == 'success' }}
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ steps.compiler-cache.outputs.cache-primary-key }}
- name: Preserve regression diagnostics
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: regression-diagnostics-${{ matrix.group }}-${{ github.sha }}
path: |
out/x86_64/release/logs
out/x86_64/release/ci
out/kbuild-migration
if-no-files-found: warn
retention-days: 7

smoke:
name: Boot (${{ matrix.firmware }})
needs: build
Expand Down Expand Up @@ -262,7 +354,7 @@ jobs:

ci:
name: CI result
needs: [changes, checks, documentation, build, smoke]
needs: [changes, checks, documentation, build, regressions, smoke]
if: always()
runs-on: ubuntu-24.04
timeout-minutes: 5
Expand All @@ -275,6 +367,24 @@ jobs:
NEEDS_JSON: ${{ toJSON(needs) }}
run: python3 tools/ci.py summary

cache-maintenance:
name: Maintain compiler cache snapshots
needs: [build, regressions]
if: ${{ !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
actions: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Prune superseded compiler cache snapshots
env:
GH_TOKEN: ${{ github.token }}
run: python3 scripts/ci/cache-prune.py --repo "$GITHUB_REPOSITORY" --apply

deploy:
name: Deploy verified Pages
needs: [changes, ci]
Expand Down
Loading