From 1145c2b05e95faf5dd6a5711d85fdae9f6ce96dd Mon Sep 17 00:00:00 2001 From: mrabine Date: Sun, 20 Sep 2026 11:34:54 +0200 Subject: [PATCH 1/3] GitHub actions --- .github/workflows/build.yml | 175 ++++++++++++++++++ .github/workflows/cache.yml | 24 +++ .github/workflows/cd.yml | 22 +++ .github/workflows/ci.yml | 18 ++ .gitignore | 2 +- .../conf/distro/include/chronos.inc | 4 +- 6 files changed, 242 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/cache.yml create mode 100644 .github/workflows/cd.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7012d2a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,175 @@ +name: build + +on: + workflow_call: + inputs: + machine: + type: string + default: 'all' + release: + type: boolean + default: false + cache: + type: boolean + default: false + sdk: + type: boolean + default: false + dry_run: + type: boolean + default: false + + secrets: + YOCTOCACHE_KNOWN_HOST: + required: false + YOCTOCACHE_DEPLOY_KEY: + required: false + YOCTOCACHE_DEST: + required: false + YOCTOCACHE_PORT: + required: false + + workflow_dispatch: + inputs: + machine: + type: choice + options: + - all + - daytona + - tank + default: 'all' + release: + type: boolean + default: false + cache: + type: boolean + default: false + sdk: + type: boolean + default: false + dry_run: + type: boolean + default: false + +jobs: + image: + runs-on: ubuntu-latest + + container: + image: joinframework/chronos-ci:latest + options: --privileged --user root --sysctl net.ipv6.conf.all.disable_ipv6=0 + + strategy: + fail-fast: false + matrix: + machine: ${{ inputs.machine == 'all' && fromJson('["daytona", "tank"]') || fromJson(format('["{0}"]', inputs.machine)) }} + + defaults: + run: + shell: setpriv --reuid=chronos --regid=chronos --init-groups env HOME=/home/chronos bash --noprofile --norc -eo pipefail {0} + + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + submodules: recursive + + - name: Set Workspace Ownership + shell: bash + run: chown -R chronos:chronos "$GITHUB_WORKSPACE" + + - name: Setup Build Environment + run: | + source ./meta-chronos-distro/chronos-init-build-env + if [ "${{ inputs.release }}" = "true" ]; then + echo "EXTRA_IMAGE_FEATURES:remove = \"debug-tweaks chronos-debug\"" >> conf/local.conf + fi + + - name: Build Image + run: | + source ./meta-chronos-distro/chronos-init-build-env + MACHINE=${{ matrix.machine }} bitbake --quiet chronos-image + + # - name: Run Test Image + # run: | + # source ./meta-chronos-distro/chronos-init-build-env + # MACHINE=${{ matrix.machine }} bitbake chronos-image:do_testimage + + - name: Build SDK + if: inputs.sdk + run: | + source ./meta-chronos-distro/chronos-init-build-env + MACHINE=${{ matrix.machine }} bitbake --quiet chronos-image:do_populate_sdk + + - name: Setup Sync + if: inputs.cache + env: + KNOWN_HOST: ${{ secrets.YOCTOCACHE_KNOWN_HOST }} + DEPLOY_KEY: ${{ secrets.YOCTOCACHE_DEPLOY_KEY }} + run: | + mkdir -p "$HOME/.ssh" + chmod 700 "$HOME/.ssh" + printf '%s\n' "$KNOWN_HOST" >> "$HOME/.ssh/known_hosts" + printf '%s\n' "$DEPLOY_KEY" > "$HOME/.ssh/id_deploy" + chmod 600 "$HOME/.ssh/known_hosts" "$HOME/.ssh/id_deploy" + + - name: Sync Sources + if: inputs.cache + env: + DEST: ${{ secrets.YOCTOCACHE_DEST }} + PORT: ${{ secrets.YOCTOCACHE_PORT }} + run: | + cd build/downloads + rsync -rlptD --quiet --mkpath ${{ inputs.dry_run && '--dry-run --stats' || '' }} \ + --partial-dir=.rsync-partial-${{ matrix.machine }} \ + --include='/uninative/***' \ + --exclude='/*/' \ + --exclude='*.tmp' \ + --exclude='*.lock' \ + --exclude='*.done' \ + -e "ssh -p $PORT -i $HOME/.ssh/id_deploy -o IdentitiesOnly=yes -o UserKnownHostsFile=$HOME/.ssh/known_hosts -o StrictHostKeyChecking=yes" \ + ./ "$DEST/source-mirror/" + + - name: Sync Cache + if: inputs.cache + env: + DEST: ${{ secrets.YOCTOCACHE_DEST }} + PORT: ${{ secrets.YOCTOCACHE_PORT }} + run: | + cd build/sstate-cache + rsync -rlptD --quiet --mkpath ${{ inputs.dry_run && '--dry-run --stats' || '' }} --delete --delete-after \ + --partial-dir=.rsync-partial \ + --exclude='/.rsync-partial/' \ + -e "ssh -p $PORT -i $HOME/.ssh/id_deploy -o IdentitiesOnly=yes -o UserKnownHostsFile=$HOME/.ssh/known_hosts -o StrictHostKeyChecking=yes" \ + ./ "$DEST/sstate-mirror/${{ matrix.machine }}/" + + - name: Collect Artifacts + if: inputs.release + run: | + mkdir -p artifacts/${{ matrix.machine }} + cp build/tmp/deploy/images/${{ matrix.machine }}/*.rootfs.ext4.gz artifacts/${{ matrix.machine }}/ + if [ -f "build/tmp/deploy/images/${{ matrix.machine }}/bzImage" ]; then + cp "build/tmp/deploy/images/${{ matrix.machine }}/bzImage" "artifacts/${{ matrix.machine }}/" + else + cp "build/tmp/deploy/images/${{ matrix.machine }}/Image.gz" "artifacts/${{ matrix.machine }}/" + fi + if [ "${{ inputs.sdk }}" = "true" ]; then + cp build/tmp/deploy/sdk/*.sh artifacts/${{ matrix.machine }}/ + fi + + - name: Upload Artifacts to GitHub + if: inputs.release + uses: actions/upload-artifact@v7 + with: + name: ${{ matrix.machine }}-artifacts + path: artifacts/${{ matrix.machine }}/ + if-no-files-found: error + + - name: Cleanup Workspace + if: always() + run: | + rm -rf -- "$GITHUB_WORKSPACE"/* + rm -rf -- "$GITHUB_WORKSPACE"/.[!.]* "$GITHUB_WORKSPACE"/..?* + if [ "${{ inputs.cache }}" = "true" ]; then + shred -u "$HOME/.ssh/id_deploy" 2>/dev/null || rm -f "$HOME/.ssh/id_deploy" + fi diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml new file mode 100644 index 0000000..435b1f7 --- /dev/null +++ b/.github/workflows/cache.yml @@ -0,0 +1,24 @@ +name: cache + +on: + schedule: + - cron: "0 13 * * 0" + + workflow_dispatch: + +jobs: + cache: + uses: ./.github/workflows/build.yml + + permissions: + contents: read + + secrets: + YOCTOCACHE_KNOWN_HOST: ${{ secrets.YOCTOCACHE_KNOWN_HOST }} + YOCTOCACHE_DEPLOY_KEY: ${{ secrets.YOCTOCACHE_DEPLOY_KEY }} + YOCTOCACHE_PORT: ${{ secrets.YOCTOCACHE_PORT }} + YOCTOCACHE_DEST: ${{ secrets.YOCTOCACHE_DEST }} + + with: + cache: true + sdk: true diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..be2b5a5 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,22 @@ +name: cd + +on: + push: + branches: [ main ] + + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + deploy: + uses: ./.github/workflows/build.yml + + permissions: + contents: read + + with: + release: true + sdk: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..14a2ea4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,18 @@ +name: ci + +on: + pull_request: + branches: [ main ] + + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + check: + uses: ./.github/workflows/build.yml + + permissions: + contents: read diff --git a/.gitignore b/.gitignore index 76cd11c..1151886 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,5 @@ .cproject .project -build/ +build*/ __pycache__/ diff --git a/meta-chronos-distro/conf/distro/include/chronos.inc b/meta-chronos-distro/conf/distro/include/chronos.inc index ba2f379..03c82ee 100644 --- a/meta-chronos-distro/conf/distro/include/chronos.inc +++ b/meta-chronos-distro/conf/distro/include/chronos.inc @@ -23,8 +23,8 @@ BB_HASHSERVE = "" # cache INHERIT += "own-mirrors" BB_GENERATE_MIRROR_TARBALLS = "1" -SOURCE_MIRROR_URL ?= "https://yocto.dorale.fr/source-mirror/" -SSTATE_MIRRORS ?= "file://.* https://yocto.dorale.fr/sstate-mirror/${MACHINE}/PATH;downloadfilename=PATH" +SOURCE_MIRROR_URL ?= "https://yocto.joinframework.net/source-mirror/" +SSTATE_MIRRORS ?= "file://.* https://yocto.joinframework.net/sstate-mirror/${MACHINE}/PATH;downloadfilename=PATH" # users USERADDEXTENSION = "useradd-staticids" From dd8aafb7f9732bca6b65bfcee15b7a12c3edbb23 Mon Sep 17 00:00:00 2001 From: mrabine Date: Sun, 20 Sep 2026 11:50:01 +0200 Subject: [PATCH 2/3] capabilities --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7012d2a..6eeae09 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,7 +66,7 @@ jobs: defaults: run: - shell: setpriv --reuid=chronos --regid=chronos --init-groups env HOME=/home/chronos bash --noprofile --norc -eo pipefail {0} + shell: setpriv --reuid=chronos --regid=chronos --init-groups --inh-caps=+sys_admin --ambient-caps=+sys_admin env HOME=/home/chronos bash --noprofile --norc -eo pipefail {0} steps: - name: Checkout From 1488de9719103483fb6684d82f9edc8440845d67 Mon Sep 17 00:00:00 2001 From: mrabine Date: Sun, 20 Sep 2026 12:23:03 +0200 Subject: [PATCH 3/3] Pin actions --- .github/workflows/build.yml | 7 +++++-- .github/workflows/cache.yml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6eeae09..e6b5562 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,6 +55,9 @@ jobs: image: runs-on: ubuntu-latest + permissions: + contents: read + container: image: joinframework/chronos-ci:latest options: --privileged --user root --sysctl net.ipv6.conf.all.disable_ipv6=0 @@ -70,7 +73,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v7 + uses: actions/checkout@v7.0.1 with: submodules: recursive @@ -159,7 +162,7 @@ jobs: - name: Upload Artifacts to GitHub if: inputs.release - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@v7.0.1 with: name: ${{ matrix.machine }}-artifacts path: artifacts/${{ matrix.machine }}/ diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml index 435b1f7..2fe775d 100644 --- a/.github/workflows/cache.yml +++ b/.github/workflows/cache.yml @@ -16,8 +16,8 @@ jobs: secrets: YOCTOCACHE_KNOWN_HOST: ${{ secrets.YOCTOCACHE_KNOWN_HOST }} YOCTOCACHE_DEPLOY_KEY: ${{ secrets.YOCTOCACHE_DEPLOY_KEY }} - YOCTOCACHE_PORT: ${{ secrets.YOCTOCACHE_PORT }} YOCTOCACHE_DEST: ${{ secrets.YOCTOCACHE_DEST }} + YOCTOCACHE_PORT: ${{ secrets.YOCTOCACHE_PORT }} with: cache: true