Skip to content

Commit 300cc4c

Browse files
committed
.github: Add workflows
Moves workflows from main branch to ci to reduce number of ci commits on each branch. Signed-off-by: Jorge Marques <jorge.marques@analog.com>
0 parents  commit 300cc4c

File tree

9 files changed

+725
-0
lines changed

9 files changed

+725
-0
lines changed

.github/workflows.mirror/sync.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Synchronize branches
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
adi-main:
8+
uses: ./.github/workflows/sync_mirror.yml@ci
9+
secrets: inherit
10+
permissions:
11+
contents: write
12+
actions: write
13+
with:
14+
remote_name: "analogdevicesinc/linux"
15+
fetch_url: "https://github.com/analogdevicesinc/linux.git"
16+
branch: "main"
17+
patch_ci: "false"
18+
19+
adi-ci:
20+
uses: ./.github/workflows/sync_mirror.yml@ci
21+
secrets: inherit
22+
permissions:
23+
contents: write
24+
actions: write
25+
with:
26+
remote_name: "analogdevicesinc/linux"
27+
fetch_url: "https://github.com/analogdevicesinc/linux.git"
28+
branch: "ci"
29+
patch_ci: "false"
30+
is_mirror_ci: "true"
31+
32+
adi-rpi-6-12-y:
33+
uses: ./.github/workflows/sync_mirror.yml@ci
34+
secrets: inherit
35+
permissions:
36+
contents: write
37+
actions: write
38+
with:
39+
remote_name: "analogdevicesinc/linux"
40+
fetch_url: "https://github.com/analogdevicesinc/linux.git"
41+
branch: "rpi-6.12.y"
42+
patch_ci: "false"
43+
44+
next-linux-next-master:
45+
uses: ./.github/workflows/sync_mirror.yml@ci
46+
needs: [adi-main]
47+
secrets: inherit
48+
permissions:
49+
contents: write
50+
actions: write
51+
with:
52+
remote_name: "next/linux-next"
53+
fetch_url: "https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git"
54+
branch: "master"
55+
top_level_branch: "mirror/analogdevicesinc/linux/main"
56+
57+
jic23-iio-testing:
58+
uses: ./.github/workflows/sync_mirror.yml@ci
59+
needs: [adi-main]
60+
secrets: inherit
61+
permissions:
62+
contents: write
63+
actions: write
64+
with:
65+
remote_name: "jic23/iio"
66+
fetch_url: "https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git"
67+
branch: "testing"
68+
top_level_branch: "mirror/analogdevicesinc/linux/main"
69+

.github/workflows/build.yml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
name: Kernel build
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
CXX:
7+
type: string
8+
default: ""
9+
LLVM:
10+
type: string
11+
default: ""
12+
CROSS_COMPILE:
13+
type: string
14+
default: ""
15+
ARCH:
16+
required: true
17+
type: string
18+
DEFCONFIG:
19+
required: true
20+
type: string
21+
CHECKS:
22+
type: boolean
23+
default: false
24+
AUTO_FROM_RANGE:
25+
type: boolean
26+
default: true
27+
outputs:
28+
fail:
29+
value: ${{ jobs.build.outputs.fail }}
30+
warn:
31+
value: ${{ jobs.build.outputs.warn }}
32+
33+
env:
34+
run_id: ${{ github.run_id }}
35+
36+
jobs:
37+
build:
38+
timeout-minutes: 7200
39+
runs-on: [self-hosted, v1]
40+
continue-on-error: true
41+
42+
outputs:
43+
fail: ${{ steps.assert.outputs.fail }}
44+
warn: ${{ steps.assert.outputs.warn }}
45+
46+
steps:
47+
- uses: analogdevicesinc/doctools/checkout@v1
48+
49+
- name: Prepare env
50+
run: |
51+
if [[ ! -z "${{ inputs.CXX }}" ]]; then
52+
echo "CXX=gcc-${{ inputs.CXX }}" >> $GITHUB_ENV
53+
echo "CID=gcc_${{ inputs.CXX }}" >> $GITHUB_ENV
54+
fi
55+
if [[ ! -z "${{ inputs.LLVM }}" ]]; then
56+
echo "LLVM=-${{ inputs.LLVM }}" >> $GITHUB_ENV
57+
echo "CID=llvm_${{ inputs.LLVM }}" >> $GITHUB_ENV
58+
fi
59+
if [[ "${{ inputs.CHECKS }}" == "true" ]]; then
60+
if [[ ! -z "${{ inputs.CXX }}" ]]; then
61+
echo "CHECKS_SPARCE=true" >> $GITHUB_ENV
62+
echo "CHECKS_GCC_FANALYZER=true" >> $GITHUB_ENV
63+
echo "CHECKS_SMATCH=true" >> $GITHUB_ENV
64+
fi
65+
if [[ ! -z "${{ inputs.LLVM }}" ]]; then
66+
echo "CHECKS_CLANG_ANALYZER=true" >> $GITHUB_ENV
67+
fi
68+
fi
69+
echo "CROSS_COMPILE=${{ inputs.CROSS_COMPILE }}" >> $GITHUB_ENV
70+
echo "ARCH=${{ inputs.ARCH }}" >> $GITHUB_ENV
71+
echo "AUTO_FROM_RANGE=${{ inputs.AUTO_FROM_RANGE }}" >> $GITHUB_ENV
72+
73+
- name: Make defconfig
74+
run: |
75+
if [[ -f "arch/$ARCH/configs/${{ inputs.DEFCONFIG }}" ]] || \
76+
[[ "${{ inputs.DEFCONFIG }}" == "allnoconfig" ]]; then
77+
make ${{ inputs.DEFCONFIG }}
78+
else
79+
make defconfig
80+
fi
81+
82+
- name: Imply driver config
83+
if: ${{ env.AUTO_FROM_RANGE == 'true' }}
84+
run: |
85+
source ./ci/build.sh
86+
auto_set_kconfig
87+
88+
- name: Apply cocci/bash and save defconfig
89+
run: |
90+
source ./ci/build.sh
91+
apply_prerun
92+
make savedefconfig
93+
94+
- name: Compile devicetrees
95+
if: ${{ env.AUTO_FROM_RANGE == 'true' }}
96+
run: |
97+
source ./ci/build.sh
98+
compile_devicetree
99+
100+
- name: Compile kernel
101+
run: |
102+
source ./ci/build.sh
103+
compile_kernel
104+
105+
- name: Prepare dist
106+
run: |
107+
if [[ -d dist ]]; then
108+
rm -r dist
109+
fi
110+
mkdir -p dist/modules
111+
cp defconfig dist
112+
cp arch/${{ inputs.ARCH }}/boot/*Image dist
113+
find . -type f -name *.ko | \
114+
xargs -I % cp --parents % dist/modules
115+
116+
- name: Assert state
117+
if: ${{ failure() }}
118+
run: |
119+
source ./ci/build.sh
120+
set_step_fail "assert_state"
121+
echo "fatal=true" >> "$GITHUB_ENV"
122+
123+
- name: Assert compiled
124+
if: ${{ !cancelled() && env.fatal != 'true' && env.AUTO_FROM_RANGE == 'true' }}
125+
run: |
126+
source ./ci/build.sh
127+
assert_compiled
128+
129+
- name: Sparse
130+
if: ${{ !cancelled() && env.fatal != 'true' && env.CHECKS_SPARCE == 'true' }}
131+
run: |
132+
source ./ci/build.sh
133+
compile_kernel_sparse
134+
135+
- name: GCC fanalyzer
136+
if: ${{ !cancelled() && env.fatal != 'true' && env.CHECKS_GCC_FANALYZER == 'true' }}
137+
run: |
138+
source ./ci/build.sh
139+
compile_gcc_fanalyzer
140+
141+
- name: Clang analyzer
142+
if: ${{ !cancelled() && env.fatal != 'true' && env.CHECKS_CLANG_ANALYZER == 'true' }}
143+
run: |
144+
source ./ci/build.sh
145+
compile_clang_analyzer
146+
147+
- name: Smatch
148+
if: ${{ !cancelled() && env.fatal != 'true' && env.CHECKS_SMATCH == 'true' }}
149+
run: |
150+
source ./ci/build.sh
151+
compile_kernel_smatch
152+
153+
- name: Store the distribution packages
154+
if: ${{ !cancelled() }}
155+
uses: actions/upload-artifact@v4
156+
with:
157+
name: dist-${{ inputs.DEFCONFIG }}-${{ env.CID }}-${{ inputs.ARCH }}
158+
path: dist
159+
160+
- name: Export labels
161+
if: ${{ !cancelled() }}
162+
id: assert
163+
run: |
164+
source ./ci/runner_env.sh
165+
export_labels

.github/workflows/checks.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Checks
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
ref_branch:
7+
required: true
8+
type: string
9+
outputs:
10+
fatal:
11+
value: ${{ jobs.checks.outputs.fatal}}
12+
fail:
13+
value: ${{ jobs.checks.outputs.fail }}
14+
warn:
15+
value: ${{ jobs.checks.outputs.warn }}
16+
17+
jobs:
18+
checks:
19+
timeout-minutes: 7200
20+
runs-on: [self-hosted, v1]
21+
continue-on-error: true
22+
23+
outputs:
24+
fatal: ${{ steps.assert.outputs.fatal }}
25+
fail: ${{ steps.assert.outputs.fail }}
26+
warn: ${{ steps.assert.outputs.warn }}
27+
28+
steps:
29+
- uses: analogdevicesinc/doctools/checkout@v1
30+
31+
- name: Apply cocci
32+
run: |
33+
source ./ci/build.sh
34+
apply_prerun
35+
36+
- name: Assert state
37+
if: ${{ failure() }}
38+
run: |
39+
source ./ci/build.sh
40+
set_step_fail "assert_state"
41+
echo "fatal=true" >> "$GITHUB_ENV"
42+
43+
- name: License
44+
if: ${{ !cancelled() && env.fatal != 'true' }}
45+
run: |
46+
source ./ci/build.sh
47+
check_license
48+
49+
- name: Check patch
50+
if: ${{ !cancelled() && env.fatal != 'true' }}
51+
run: |
52+
status=0; timeout 1d bash -c "source ./ci/build.sh ; check_checkpatch" || status=$?
53+
[ $status -eq 124 ] && echo "step_fail_checkpatch_timeout=true" >> "$GITHUB_ENV"
54+
exit $status
55+
56+
- name: Coccicheck
57+
if: ${{ !cancelled() && env.fatal != 'true' }}
58+
run: |
59+
status=0; timeout 1d bash -c "source ./ci/build.sh ; check_coccicheck" || status=$?
60+
[ $status -eq 124 ] && echo "step_fail_coccicheck_timeout=true" >> "$GITHUB_ENV"
61+
exit $status
62+
63+
- name: Checkout and patch reference branch
64+
if: ${{ !cancelled() && env.fatal != 'true' && !startsWith(github.base_ref, 'mirror/') && !startsWith(github.ref_name, 'mirror/') }}
65+
run: |
66+
git fetch origin --depth=1 "${{ inputs.ref_branch }}" &&
67+
git reset --hard origin/${{ inputs.ref_branch }} ||
68+
(echo "::error ::check_checkout_reference_branch: Failed to fetch ${{ inputs.ref_branch }}" ;
69+
echo "step_fail_checkout_reference_branch=true" >> "$GITHUB_ENV")
70+
71+
git checkout $head_sha -- ci/build.sh
72+
73+
# Only Documentation/devicetree/bindings/**/.yaml (touched) and
74+
# include/dt-bindings/**/.h (touched and only on source branch) files
75+
# are checked-out, in the case of other changes the check may falsely
76+
# fail. Please, when doing heavy dt bindings work, target the
77+
# upstream mirrors
78+
79+
files=$(git diff --diff-filter=ACM --no-renames --name-only $base_sha..$head_sha)
80+
81+
while read file; do
82+
case "$file" in
83+
*.yaml)
84+
relative_file=${file#Documentation/devicetree/bindings/}
85+
86+
if [[ ! "$relative_file" = "$file" ]]; then
87+
git checkout $head_sha -- $file
88+
fi
89+
;;
90+
*.h)
91+
relative_file=${file#include/dt-bindings/}
92+
93+
if [[ ! "$relative_file" = "$file" ]]; then
94+
git checkout $head_sha -- $file
95+
fi
96+
;;
97+
esac
98+
done <<< "$files"
99+
100+
files=$(comm -13 \
101+
<(git ls-tree -r --name-only origin/${{ inputs.ref_branch }} include/dt-bindings | sort) \
102+
<(git ls-tree -r --name-only $head_sha include/dt-bindings | sort))
103+
104+
while read file; do
105+
case "$file" in
106+
*.h)
107+
git checkout $head_sha -- $file
108+
;;
109+
esac
110+
done <<< "$files"
111+
112+
- name: Check dt-bindings
113+
if: ${{ !cancelled() && env.fatal != 'true' }}
114+
run: |
115+
source ./ci/build.sh
116+
check_dt_binding_check
117+
118+
- name: Revert patch reference branch
119+
if: ${{ !cancelled() && env.fatal != 'true' && !startsWith(github.base_ref, 'mirror/') && !startsWith(github.ref_name, 'mirror/') }}
120+
run: |
121+
git reset --hard $head_sha
122+
123+
- name: Export labels
124+
if: ${{ !cancelled() }}
125+
id: assert
126+
run: |
127+
echo "fatal=$fatal" >> "$GITHUB_OUTPUT"
128+
source ./ci/runner_env.sh
129+
export_labels
130+

0 commit comments

Comments
 (0)