fixing the build pipeline
This commit is contained in:
1 parent
c08668058e
commit
cd3a347823
5 files changed
+18
-149
No files matched your search
@@ -1,75 +0,0 @@
|
|||||||
name: Generate and publish developer Wiki
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: openunifi-wiki
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
code: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
validate-wiki:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Check out source repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 2
|
|
||||||
path: source
|
|
||||||
- name: Check patch whitespace
|
|
||||||
run: git -C source diff --check HEAD^ HEAD
|
|
||||||
- name: Validate documentation generator
|
|
||||||
run: |
|
|
||||||
mkdir -p "$RUNNER_TEMP/openuf-wiki"
|
|
||||||
python3 source/scripts/docs/generate-wiki.py --output "$RUNNER_TEMP/openuf-wiki"
|
|
||||||
python3 source/scripts/docs/generate-wiki.py --check --output "$RUNNER_TEMP/openuf-wiki"
|
|
||||||
|
|
||||||
publish-wiki:
|
|
||||||
if: gitea.event_name != 'pull_request'
|
|
||||||
needs: validate-wiki
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
code: read
|
|
||||||
wiki: write
|
|
||||||
steps:
|
|
||||||
- name: Check out source repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
path: source
|
|
||||||
- name: Clone Wiki Git repository
|
|
||||||
env:
|
|
||||||
GITEA_REPOSITORY: ${{ gitea.repository }}
|
|
||||||
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
repository_owner=${GITEA_REPOSITORY%%/*}
|
|
||||||
repository_name=${GITEA_REPOSITORY##*/}
|
|
||||||
wiki_name=$(printf '%s' "$repository_name" | tr '[:upper:]' '[:lower:]')
|
|
||||||
wiki_url="${GITEA_SERVER_URL%/}/${repository_owner}/${wiki_name}.wiki.git"
|
|
||||||
git clone -- "$wiki_url" wiki
|
|
||||||
- name: Generate and verify Gitea Wiki pages
|
|
||||||
run: |
|
|
||||||
python3 source/scripts/docs/generate-wiki.py --output wiki
|
|
||||||
python3 source/scripts/docs/generate-wiki.py --check --output wiki
|
|
||||||
- name: Publish changed Wiki pages
|
|
||||||
working-directory: wiki
|
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
git config user.name "openUF documentation bot"
|
|
||||||
git config user.email "actions@openuf.invalid"
|
|
||||||
git add -- Home.md Developer-Guide.md Call-Graph.md Runtime-Flow.md _Sidebar.md
|
|
||||||
if git diff --cached --quiet; then
|
|
||||||
echo "Gitea Wiki is already current"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
git commit -m "docs: update generated developer wiki"
|
|
||||||
basic_auth=$(printf 'x-access-token:%s' "$GITEA_TOKEN" | base64 | tr -d '\n')
|
|
||||||
git -c http.extraHeader="Authorization: Basic $basic_auth" push origin HEAD
|
|
||||||
@@ -15,7 +15,7 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
metadata:
|
metadata:
|
||||||
runs-on: ubuntu-latest
|
runs-on: debian-13
|
||||||
outputs:
|
outputs:
|
||||||
version: ${{ steps.release.outputs.version }}
|
version: ${{ steps.release.outputs.version }}
|
||||||
steps:
|
steps:
|
||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
|
|
||||||
create-release:
|
create-release:
|
||||||
needs: metadata
|
needs: metadata
|
||||||
runs-on: ubuntu-latest
|
runs-on: debian-13
|
||||||
outputs:
|
outputs:
|
||||||
release-id: ${{ steps.create.outputs.release-id }}
|
release-id: ${{ steps.create.outputs.release-id }}
|
||||||
steps:
|
steps:
|
||||||
@@ -73,7 +73,7 @@ jobs:
|
|||||||
|
|
||||||
build:
|
build:
|
||||||
needs: [metadata, create-release]
|
needs: [metadata, create-release]
|
||||||
runs-on: ubuntu-latest
|
runs-on: debian-13
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install SDK build dependencies
|
- name: Install SDK build dependencies
|
||||||
@@ -81,11 +81,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
packages=(build-essential clang flex bison g++ gawk gettext git libncurses-dev libssl-dev python3 rsync unzip zlib1g-dev file wget patch time curl jq zstd)
|
packages=(build-essential clang flex bison g++ gawk gettext git libncurses-dev libssl-dev python3 rsync unzip zlib1g-dev file wget patch time curl jq zstd)
|
||||||
case "$(uname -m)" in
|
|
||||||
aarch64|arm64|armv7l|armv8l)
|
|
||||||
packages+=(qemu-user-static)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
sudo apt-get install --yes "${packages[@]}"
|
sudo apt-get install --yes "${packages[@]}"
|
||||||
- name: Build and upload configured packages
|
- name: Build and upload configured packages
|
||||||
env:
|
env:
|
||||||
@@ -102,7 +97,7 @@ jobs:
|
|||||||
|
|
||||||
publish-release:
|
publish-release:
|
||||||
needs: [metadata, create-release, build]
|
needs: [metadata, create-release, build]
|
||||||
runs-on: ubuntu-latest
|
runs-on: debian-13
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Publish completed release
|
- name: Publish completed release
|
||||||
|
|||||||
@@ -114,11 +114,9 @@ behavior that still needs manual testing.
|
|||||||
- Ordinary read-only commands may fail with the same `bwrap` namespace error.
|
- Ordinary read-only commands may fail with the same `bwrap` namespace error.
|
||||||
When the command is safe and required, rerun it using the environment's normal
|
When the command is safe and required, rerun it using the environment's normal
|
||||||
escalation/approval mechanism instead of investigating the namespace setup.
|
escalation/approval mechanism instead of investigating the namespace setup.
|
||||||
- OpenWrt's release SDK host tools and preload libraries are x86-64. When using
|
- The release pipeline intentionally requires an x86-64 runner because OpenWrt's
|
||||||
them through QEMU on an ARM runner, never export the SDK's fakeroot library as
|
SDK host tools are x86-64. Do not reintroduce QEMU wrapper rewriting or host
|
||||||
host `LD_PRELOAD`; carry it in a private variable and pass it to the bundled
|
`LD_PRELOAD` workarounds unless ARM-hosted CI is explicitly required again.
|
||||||
x86 loader with `--preload`. Validate changes with an emulated build through
|
|
||||||
mbedTLS packaging, where a broken handoff appears as a `library/...` dependency.
|
|
||||||
|
|
||||||
Agents must preserve useful environment knowledge for later agents. When a new
|
Agents must preserve useful environment knowledge for later agents. When a new
|
||||||
pitfall or workaround is verified to be deterministic or repeatedly encountered,
|
pitfall or workaround is verified to be deterministic or repeatedly encountered,
|
||||||
|
|||||||
@@ -93,11 +93,9 @@ Add an object with a unique `architecture` label and a valid OpenWrt
|
|||||||
required. The generic ARM entries select ARMv7 and ARMv8 ABIs; use a
|
required. The generic ARM entries select ARMv7 and ARMv8 ABIs; use a
|
||||||
device-specific OpenWrt target when necessary.
|
device-specific OpenWrt target when necessary.
|
||||||
|
|
||||||
OpenWrt publishes its release SDKs with x86-64 host tools, even when the target
|
The release workflow requires an x86-64 build agent because OpenWrt publishes
|
||||||
is ARM or PowerPC. On an ARM build agent, the workflow installs
|
its release SDKs with x86-64 host tools, even when the target is ARM or
|
||||||
`qemu-user-static` and the build script runs the SDK host tools explicitly
|
PowerPC. Target architecture does not need to match the build agent.
|
||||||
through `qemu-x86_64-static`; privileged `binfmt_misc` registration is not
|
|
||||||
required. Native x86-64 agents skip emulation and remain faster.
|
|
||||||
|
|
||||||
Releases use the next available `MAJOR.MINOR.PATCH` tag. `MAJOR` and `MINOR`
|
Releases use the next available `MAJOR.MINOR.PATCH` tag. `MAJOR` and `MINOR`
|
||||||
live in the release config; the workflow finds the highest existing
|
live in the release config; the workflow finds the highest existing
|
||||||
|
|||||||
@@ -39,41 +39,13 @@ sdk_dir=$(find "$work_dir" -mindepth 1 -maxdepth 1 -type d -name 'openwrt-sdk-*'
|
|||||||
|
|
||||||
cd "$sdk_dir"
|
cd "$sdk_dir"
|
||||||
|
|
||||||
# OpenWrt publishes relocatable SDKs whose host tools are x86-64 binaries.
|
# OpenWrt release SDK host tools are x86-64 binaries. Keep the runner
|
||||||
# On ARM runners, invoke the SDK's bundled x86-64 loader explicitly through
|
# requirement explicit so an incompatible host fails with a useful error.
|
||||||
# QEMU. This works without privileged binfmt_misc registration on the host.
|
case "$(uname -m)" in
|
||||||
build_host=$(uname -m)
|
|
||||||
case $build_host in
|
|
||||||
x86_64|amd64)
|
x86_64|amd64)
|
||||||
;;
|
;;
|
||||||
aarch64|arm64|armv7l|armv8l)
|
|
||||||
qemu_x86_64=$(command -v qemu-x86_64-static || command -v qemu-x86_64 || true)
|
|
||||||
[[ -n $qemu_x86_64 ]] || {
|
|
||||||
echo "ARM build host requires qemu-x86_64-static (install qemu-user-static)" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
mapfile -d '' sdk_wrappers < <(
|
|
||||||
find staging_dir -type f -exec grep -IlZ 'ld-linux-x86-64\.so\.2' {} +
|
|
||||||
)
|
|
||||||
[[ ${#sdk_wrappers[@]} -gt 0 ]] || {
|
|
||||||
echo "no relocatable x86-64 SDK wrappers found" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
sed -i -E \
|
|
||||||
-e 's|^export LD_PRELOAD=.*(\$dir/.*runas\.so)"$|sdk_preload="${SDK_GUEST_LD_PRELOAD:+$SDK_GUEST_LD_PRELOAD:}\1"\nunset LD_PRELOAD SDK_GUEST_LD_PRELOAD|' \
|
|
||||||
-e "s|^exec (\"\\\$dir/.*ld-linux-x86-64\\.so\\.2\")|exec ${qemu_x86_64} \\1 --preload \"\\\$sdk_preload\"|" \
|
|
||||||
"${sdk_wrappers[@]}"
|
|
||||||
|
|
||||||
# fakeroot normally exports its x86-64 preload before invoking a wrapped
|
|
||||||
# command. Carry it in a private variable so ARM-native env/bash never try
|
|
||||||
# to load it; the wrapper above passes it directly to the guest loader.
|
|
||||||
fakeroot_script=staging_dir/host/bin/fakeroot
|
|
||||||
sed -i 's/LD_PRELOAD="$FAKEROOT_LIB"/SDK_GUEST_LD_PRELOAD="$FAKEROOT_LIB"/g' "$fakeroot_script"
|
|
||||||
grep -q 'SDK_GUEST_LD_PRELOAD="$FAKEROOT_LIB"' "$fakeroot_script"
|
|
||||||
staging_dir/host/bin/sed --version >/dev/null
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo "unsupported build host architecture: $build_host" >&2
|
echo "OpenWrt release builds require an x86-64 host" >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -84,17 +56,6 @@ esac
|
|||||||
./scripts/feeds update base packages
|
./scripts/feeds update base packages
|
||||||
./scripts/feeds install mbedtls uci usteer
|
./scripts/feeds install mbedtls uci usteer
|
||||||
|
|
||||||
# openuf needs the mbedTLS libraries, not its optional example/utility
|
|
||||||
# executables. Under x86 user emulation on ARM, linking those large programs is
|
|
||||||
# unreliable and unnecessary, so keep the library build and omit the programs.
|
|
||||||
mbedtls_makefile=feeds/base_root/package/libs/mbedtls/Makefile
|
|
||||||
[[ -f $mbedtls_makefile ]] || {
|
|
||||||
echo "mbedTLS feed Makefile not found: $mbedtls_makefile" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
sed -i 's/-DENABLE_PROGRAMS:Bool=ON/-DENABLE_PROGRAMS:Bool=OFF/' "$mbedtls_makefile"
|
|
||||||
grep -q -- '-DENABLE_PROGRAMS:Bool=OFF' "$mbedtls_makefile"
|
|
||||||
|
|
||||||
mkdir -p package/openuf
|
mkdir -p package/openuf
|
||||||
(cd "$repo_root" && tar --exclude=.git --exclude="$output_dir" -cf - .) | (cd package/openuf && tar -xf -)
|
(cd "$repo_root" && tar --exclude=.git --exclude="$output_dir" -cf - .) | (cd package/openuf && tar -xf -)
|
||||||
sed -i -E "s/^(PKG_VERSION[[:space:]]*:?=[[:space:]]*).*/\\1${version}/" package/openuf/Makefile
|
sed -i -E "s/^(PKG_VERSION[[:space:]]*:?=[[:space:]]*).*/\\1${version}/" package/openuf/Makefile
|
||||||
@@ -115,18 +76,10 @@ printf '%s\n' \
|
|||||||
'CONFIG_PACKAGE_openuf=m' >.config
|
'CONFIG_PACKAGE_openuf=m' >.config
|
||||||
make defconfig
|
make defconfig
|
||||||
build_jobs=$(nproc)
|
build_jobs=$(nproc)
|
||||||
case $build_host in
|
if ! make -j"$build_jobs" package/openuf/compile; then
|
||||||
aarch64|arm64|armv7l|armv8l)
|
echo "parallel build failed; retrying serially with verbose diagnostics" >&2
|
||||||
(( build_jobs <= 2 )) || build_jobs=2
|
make -j1 package/openuf/compile V=sc
|
||||||
make -j"$build_jobs" package/openuf/compile V=sc
|
fi
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if ! make -j"$build_jobs" package/openuf/compile; then
|
|
||||||
echo "parallel build failed; retrying serially with verbose diagnostics" >&2
|
|
||||||
make -j1 package/openuf/compile V=sc
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
mapfile -t packages < <(find bin/packages -type f -name "openuf-${version}-*.apk")
|
mapfile -t packages < <(find bin/packages -type f -name "openuf-${version}-*.apk")
|
||||||
if [[ ${#packages[@]} -ne 1 ]]; then
|
if [[ ${#packages[@]} -ne 1 ]]; then
|
||||||
|
|||||||
Reference in new issue
Block a user