Skip to content

Commit bcc7ea8

Browse files
committed
Update workflow and stuff
1 parent 2a3660c commit bcc7ea8

5 files changed

Lines changed: 105 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ jobs:
1818
config: generic.config no-jump-label.config
1919
bindgen: latest
2020
rustc: stable
21+
- arch: riscv
22+
config: generic.config no-mmu.config
23+
bindgen: latest
24+
rustc: stable
2125
- arch: x86_64
2226
config: generic.config
2327
bindgen: latest
@@ -108,20 +112,24 @@ jobs:
108112
with:
109113
components: rustfmt, rust-src
110114
- name: Check formatting
111-
run: make -C linux LLVM=1 rustfmt
115+
run: make -C linux LLVM=1 rustfmtcheck
112116

113117
checkpatch:
114118
runs-on: ubuntu-latest
115119
steps:
116120
- uses: actions/checkout@v4
117121
with:
118122
submodules: true
119-
fetch-depth: 2
123+
fetch-depth: 20
120124
- name: Fetch referenced commits
121125
working-directory: linux
122126
env:
123127
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
124128
run: |
129+
if git rev-parse --verify HEAD^2 >/dev/null 2>&1; then
130+
git checkout --detach HEAD^1
131+
fi
132+
125133
HASHES=$(git log -1 --pretty=%B | tr '\n' ' ' | grep -oP '(?:commit|[\w-]+:)\s+\K[0-9a-f]{12,40}' | sort -u)
126134
127135
for HASH in $HASHES; do

configs/generic.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CONFIG_JUMP_LABEL=y
66
CONFIG_RUST_FW_LOADER_ABSTRACTIONS=y
77
CONFIG_KUNIT=y
88
CONFIG_RUST_KERNEL_DOCTESTS=y
9+
CONFIG_WERROR=y
910

1011
CONFIG_DRM=y
1112
CONFIG_DRM_NOVA=m
@@ -31,4 +32,4 @@ CONFIG_SAMPLE_RUST_DRIVER_PLATFORM=m
3132
CONFIG_SAMPLE_RUST_DRIVER_USB=m
3233
CONFIG_SAMPLE_RUST_DRIVER_FAUX=m
3334
CONFIG_SAMPLE_RUST_DRIVER_AUXILIARY=m
34-
CONFIG_SAMPLE_RUST_HOSTPROGS=y
35+
CONFIG_SAMPLE_RUST_HOSTPROGS=y

configs/no-mmu.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# CONFIG_MMU is not set

submit_ci.sh

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/bin/bash
2+
set -e
3+
4+
SLEEP_SEC=""
5+
while [[ $# -gt 0 ]]; do
6+
case $1 in
7+
-s|--sleep)
8+
SLEEP_SEC="$2"
9+
shift 2
10+
;;
11+
*)
12+
break
13+
;;
14+
esac
15+
done
16+
17+
if [[ $# -lt 2 ]]; then
18+
echo "Usage: $0 [-s seconds] <base-commit> <tip-commit>"
19+
echo "Example: $0 origin/master b4/driver-types"
20+
exit 1
21+
fi
22+
23+
BASE_COMMIT="$1"
24+
TIP_COMMIT="$2"
25+
26+
# Fix commits to apply (hardcoded for now)
27+
# 780b05710047: rust_binder: Fix build failure if !CONFIG_COMPAT
28+
# c658b7542cb9: rust: bitops: fix missing _find_* functions on 32-bit ARM
29+
FIXES="780b05710047 c658b7542cb9"
30+
31+
# Prepare Fixes Branch
32+
echo "Preparing fixes branch based on $BASE_COMMIT..."
33+
(
34+
cd linux
35+
# Create/Reset ci/base-fixes branch
36+
git checkout -B ci/base-fixes "$BASE_COMMIT" > /dev/null 2>&1
37+
for FIX in $FIXES; do
38+
git cherry-pick "$FIX" > /dev/null
39+
done
40+
)
41+
42+
# Get list of commits to test (oldest to newest)
43+
echo "Generating list of commits between $BASE_COMMIT and $TIP_COMMIT..."
44+
COMMITS=$(cd linux && git rev-list --reverse "${BASE_COMMIT}..${TIP_COMMIT}")
45+
46+
if [[ -z "$COMMITS" ]]; then
47+
echo "No commits found in range."
48+
exit 0
49+
fi
50+
51+
echo "Found $(echo "$COMMITS" | wc -l) commits to test."
52+
53+
for COMMIT in $COMMITS; do
54+
SHORT_COMMIT=$(echo "$COMMIT" | cut -c1-12)
55+
echo "========================================"
56+
echo "Processing submodule commit $SHORT_COMMIT"
57+
echo "========================================"
58+
59+
# 1. Prepare Submodule
60+
echo "Preparing submodule..."
61+
(
62+
cd linux
63+
git checkout --detach "$COMMIT" > /dev/null 2>&1
64+
# Merge fixes
65+
git merge --no-edit ci/base-fixes > /dev/null
66+
# Push to a stable ref for the submodule
67+
git push --force origin HEAD:refs/heads/ci/fixes
68+
)
69+
70+
# 2. Update Parent
71+
echo "Updating parent repository..."
72+
git add linux
73+
# Amend the previous commit to avoid creating a huge history in the parent if running repeatedly?
74+
# But we want to test each one.
75+
git commit -m "ci: Update submodule to $SHORT_COMMIT (testing)"
76+
77+
# 3. Push Parent
78+
echo "Pushing to CI..."
79+
git push --force origin ci/actions
80+
81+
# 4. Wait
82+
if [[ -n "$SLEEP_SEC" ]]; then
83+
echo "Sleeping for $SLEEP_SEC seconds..."
84+
sleep "$SLEEP_SEC"
85+
else
86+
echo "Check GitHub Actions: https://github.com/Darksonn/linux/actions"
87+
read -p "Press Enter when the CI job has started to proceed to the next commit..."
88+
fi
89+
done
90+
91+
echo "Done!"

0 commit comments

Comments
 (0)