Compare commits

...

7 Commits

Author SHA1 Message Date
madonuko 628aea0af3 Merge branch 'ci/rabo-evolved-real' of github.com:terrapkg/packages into ci/rabo-evolved-real 2026-02-13 18:26:52 +08:00
madonuko 70314d8216 idk 2026-02-13 18:25:59 +08:00
madonuko 3d216224e9 idk 2026-02-12 22:01:46 +08:00
madonuko 8421a422fc maybe like this? 2026-02-10 18:40:51 +08:00
madonuko cb8ef5fd3b fix(ci): need to pass in labels separately 2026-02-07 16:30:29 +08:00
madonuko 257d028dac fix(ci): add special case for PRing to branch, no backports required 2026-02-07 16:09:17 +08:00
madonuko cc11a162ce feat(ci): make rabo PR bumps 2026-02-07 16:04:31 +08:00
7 changed files with 133 additions and 60 deletions
+82 -4
View File
@@ -4,15 +4,19 @@ name: Automatically build packages
permissions:
contents: read
on:
push:
# push:
# paths:
# - anda/**
# branches:
# - frawhide
pull_request:
paths:
- anda/**
branches:
- frawhide
pull_request:
branches:
- frawhide
merge_group:
paths:
- anda/**
branches:
- frawhide
workflow_dispatch:
@@ -44,6 +48,14 @@ jobs:
packages: ${{ needs.manifest.outputs.build_matrix }}
publish: ${{ github.event_name == 'push' }}
automerge:
needs: build
runs-on: ubuntu-24.04-arm
steps:
- name: Merge PR on Success Build
if: github.event.pull_request.commits == 1 && github.event.pull_request.user.login == 'raboneko'
run: gh pr merge ${{ github.event.number }} --admin --squash
appstream:
needs: build
runs-on: ubuntu-latest
@@ -106,3 +118,69 @@ jobs:
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
done
lintUpdate:
needs: manifest
runs-on: ubuntu-24.04-arm
permissions:
contents: read
pull-requests: write
container:
image: ghcr.io/terrapkg/builder:frawhide
options: --cap-add=SYS_ADMIN --privileged
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 2
ssh-key: ${{ secrets.SSH_AUTHENTICATION_KEY }}
- name: Install SSH signing key & Set up git repository
run: |
mkdir -p ${{ runner.temp }}
echo "${{ secrets.SSH_SIGNING_KEY }}" > ${{ runner.temp }}/signing_key
chmod 0700 ${{ runner.temp }}/signing_key
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Collect update scripts from last commit
id: last_commit_update_scripts
run: |
scripts=$(git diff-tree --no-commit-id --name-only HEAD -r | grep -E '/update\.rhai$' || true)
scripts=$(printf "%s" "$scripts" | tr '\n' ' ')
echo "upd_scripts=${scripts}" >> $GITHUB_OUTPUT
- name: Run update scripts from last commit
if: steps.last_commit_update_scripts.outputs.upd_scripts != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
pr_number="${{ github.event.pull_request.number }}"
for script in ${{ steps.last_commit_update_scripts.outputs.upd_scripts }}; do
echo "Running update script: $script"
dir=$(dirname "$script")
hcl="$dir/anda.hcl"
if [ ! -f "$hcl" ]; then
echo "Missing anda.hcl for $script"
continue
fi
backup="$hcl.autobuild_upd_test.bak"
cp $hcl $backup
if ! grep -qE 'labels {' $hcl; then
sed -E '/rpm\s*{/i labels { autobuild_upd_test = 1 }' -i $hcl
else
sed -E '/labels\s*{/a autobuild_upd_test = 1' -i $hcl
fi
output=$(anda run "$script" -f autobuild_upd_test=1 2>&1) || status=$?
status=${status:-0}
echo "$output"
mv "$backup" "$hcl" # do we want to commit this too?
if echo "$output" | grep -q "ERROR" || [ "$status" -ne 0 ]; then
gh pr comment ${{ github.event.pull_request.number }} --body "Update script failed: $script\n\n\`\`\`\n$output\n\`\`\`"
exit 1
fi
done
+4 -3
View File
@@ -1,6 +1,7 @@
name: Update per branch
permissions:
contents: write
pull-requests: write
on:
schedule:
- cron: "*/30 * * * *"
@@ -50,7 +51,7 @@ jobs:
git config user.email "raboneko@fyralabs.com"
git config gpg.format "ssh"
git config user.signingkey "${{ runner.temp }}/signing_key"
msg="bump(branch): $(anda run andax/ci/update_commit_message.rhai)"
git commit -S -a -m "$msg"
git push -u origin --all
anda run andax/ci/update_pr.rhai -l scope=branch
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+4 -13
View File
@@ -1,6 +1,7 @@
name: Nightly Update
permissions:
contents: write
pull-requests: write
on:
schedule:
- cron: "0 0 * * *"
@@ -39,17 +40,7 @@ jobs:
git config user.email "raboneko@fyralabs.com"
git config gpg.format "ssh"
git config user.signingkey "${{ runner.temp }}/signing_key"
msg="bump(nightly): $(anda run andax/ci/update_commit_message.rhai)"
git commit -S -a -m "$msg"
git format-patch HEAD^
copy_over () {
git checkout $1
git apply *.patch || true
git add anda
git commit -S -a -m "$msg"
}
copy_over f43 || true
copy_over f42 || true
copy_over el10 || true
git push -u origin --all
anda run andax/ci/update_pr.rhai -l scope=nightly
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+4 -13
View File
@@ -1,6 +1,7 @@
name: Weekly Update
permissions:
contents: write
pull-requests: write
on:
schedule:
- cron: "0 0 * * *"
@@ -39,17 +40,7 @@ jobs:
git config user.email "raboneko@fyralabs.com"
git config gpg.format "ssh"
git config user.signingkey "${{ runner.temp }}/signing_key"
msg="bump(weekly): $(anda run andax/ci/update_commit_message.rhai)"
git commit -S -a -m "$msg"
git format-patch HEAD^
copy_over () {
git checkout $1
git apply *.patch || true
git add anda
git commit -S -a -m "$msg"
}
copy_over f43 || true
copy_over f42 || true
copy_over el10 || true
git push -u origin --all
anda run andax/ci/update_pr.rhai -l scope=weekly
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+5 -14
View File
@@ -1,6 +1,7 @@
name: Update
permissions:
contents: write
pull-requests: write
on:
schedule:
- cron: "*/10 * * * *"
@@ -27,7 +28,7 @@ jobs:
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Run Update
run: anda update --excludes nightly=1 --excludes weekly=1 --excludes updbranch=1
run: anda update -e nightly=1 -e updbranch=1 -e weekly=0 -e weekly=1 -e weekly=2 -e weekly=3 -e weekly=4 -e weekly=5 -e weekly=6
env:
GITHUB_TOKEN: ${{ secrets.AUTOUPDATE_GH_TOKEN }}
RUST_BACKTRACE: full
@@ -39,17 +40,7 @@ jobs:
git config user.email "raboneko@fyralabs.com"
git config gpg.format "ssh"
git config user.signingkey "${{ runner.temp }}/signing_key"
msg="bump: $(anda run andax/ci/update_commit_message.rhai)"
git commit -S -a -m "$msg"
git format-patch HEAD^
copy_over () {
git checkout $1
git apply *.patch || true
git add anda
git commit -S -a -m "$msg"
}
copy_over f43 || true
copy_over f42 || true
copy_over el10 || true
git push -u origin --all
anda run andax/ci/update_pr.rhai -l scope=auto
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-13
View File
@@ -1,13 +0,0 @@
import "anda::cfg" as cfg;
let cmd = `git status | sed -nE '/^\tmodified:/{s@^\tmodified:\s+@@;s@[^/]+$@@;p}' | sort -u`;
let filelist = sh(cmd, #{ "stdout": "piped" }).ctx.stdout.split('\n');
let modified_list = "";
for file in filelist {
if file.is_empty() { continue; }
let spec = cfg::load_file(`${file}/anda.hcl`).project.pkg.rpm.spec;
spec.pop(5); // remove `.spec` suffix
modified_list += `${spec} `;
}
print(modified_list[..modified_list.len()-1]);
+34
View File
@@ -0,0 +1,34 @@
import "anda::cfg" as cfg;
fn pr(branch, dir, spec, scope) {
sh(`git checkout ${branch}`, #{});
if sh(`git stash apply`, #{}).ctx.rc != 0 {
sh(`git reset HEAD ${dir}`, #{});
return;
}
if sh(`git commit -S -m "bump(${scope}): ${spec}" ${dir}`, #{}).ctx.rc != 0 {
sh(`git reset HEAD ${dir}`, #{});
return;
}
sh(`gh pr create --title '[${branch}] bump(${scope}): ${spec}' --body 'Automatic bump from CI\n\nnosync'`, #{});
sh(`git reset --hard HEAD^`, #{});
}
let cmd = `git status | sed -nE '/^\tmodified:/{s@^\tmodified:\s+@@;s@[^/]+$@@;p}' | sort -u`;
let filelist = sh(cmd, #{ "stdout": "piped" }).ctx.stdout.split('\n');
for dir in filelist {
if dir.is_empty() { continue; }
let spec = cfg::load_file(`${dir}/anda.hcl`).project.pkg.rpm.spec;
spec.pop(5); // remove `.spec` suffix
if labels.scope == "branch" {
sh(`git commit -S -m "bump(${labels.scope}): ${spec}" ${dir}`, #{});
continue;
}
sh(`git stash push -m "bump(${labels.scope}): ${spec}" -- ${dir}`, #{});
pr("frawhide", dir, spec, labels.scope);
pr("f43", dir, spec, labels.scope);
pr("f42", dir, spec, labels.scope);
pr("el10", dir, spec, labels.scope);
sh(`git stash drop`, #{});
}