6 - '.github/workflows/check-kernel-patches.yml'
7 - '.github/workflows/build.yml'
8 - '.github/workflows/kernel.yml'
14 - '.github/workflows/check-kernel-patches.yml'
15 - '.github/workflows/build.yml'
16 - '.github/workflows/kernel.yml'
27 group: ${{ github.workflow }}-${{ github.ref }}
28 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
33 runs-on: ubuntu-latest
35 targets_subtargets: ${{ steps.find_targets.outputs.targets_subtargets }}
36 targets: ${{ steps.find_targets.outputs.targets }}
40 uses: actions/checkout@v3
44 - name: Get changed files
46 uses: tj-actions/changed-files@v35
51 ALL_TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null)"
52 CHANGED_FILES="$(echo ${{ steps.changed-files.outputs.all_changed_files }} | tr ' ' '\n')"
54 TARGETS_SUBTARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1 | awk '{ print $1 }')"
55 TARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1,1 | awk '{ print $1 }')"
57 # On testing non-specific target, skip testing each subtarget if we are testing pr
58 if [ ${{ github.event_name }} != 'push' ]; then
59 if echo "$CHANGED_FILES" | grep -v -q target/linux ||
60 echo "$CHANGED_FILES" | grep -q target/linux/generic; then
61 TARGETS_SUBTARGETS=$TARGETS
65 JSON_TARGETS_SUBTARGETS='['
67 for TARGET in $TARGETS_SUBTARGETS; do
68 if echo "$CHANGED_FILES" | grep -v -q target/linux ||
69 echo "$CHANGED_FILES" | grep -q target/linux/generic ||
70 echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then
71 TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}'
72 [[ $FIRST -ne 1 ]] && JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"','
73 JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS""$TUPLE"
77 JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"']'
81 for TARGET in $TARGETS; do
82 if echo "$CHANGED_FILES" | grep -v -q target/linux ||
83 echo "$CHANGED_FILES" | grep -q target/linux/generic ||
84 echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then
85 TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}'
86 [[ $FIRST -ne 1 ]] && JSON_TARGETS="$JSON_TARGETS"','
87 JSON_TARGETS="$JSON_TARGETS""$TUPLE"
91 JSON_TARGETS="$JSON_TARGETS"']'
93 echo -e "\n---- targets to build ----\n"
94 echo "$JSON_TARGETS_SUBTARGETS"
95 echo -e "\n---- targets to build ----\n"
97 echo -e "\n---- targets to check patch ----\n"
99 echo -e "\n---- targets to check patch ----\n"
101 echo "targets_subtargets=$JSON_TARGETS_SUBTARGETS" >> $GITHUB_OUTPUT
102 echo "targets=$JSON_TARGETS" >> $GITHUB_OUTPUT
105 name: Build Kernel with external toolchain
106 needs: determine_targets
114 include: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}}
115 uses: ./.github/workflows/build.yml
117 container_name: toolchain
118 target: ${{ matrix.target }}
119 subtarget: ${{ matrix.subtarget }}
121 build_all_kmods: true
122 upload_ccache_cache: ${{ github.repository_owner == 'openwrt' }}
124 check-kernel-patches:
125 name: Check Kernel patches
126 needs: determine_targets
133 include: ${{fromJson(needs.determine_targets.outputs.targets)}}
134 uses: ./.github/workflows/check-kernel-patches.yml
136 target: ${{ matrix.target }}
137 subtarget: ${{ matrix.subtarget }}
139 upload-ccache-cache-in-s3:
140 if: github.event_name == 'push' && github.repository_owner == 'openwrt'
141 name: Upload ccache cache to s3
142 needs: [determine_targets, build]
146 include: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}}
148 s3_access_key: ${{ secrets.GCS_S3_ACCESS_KEY }}
149 s3_secret_key: ${{ secrets.GCS_S3_SECRET_KEY }}
150 uses: ./.github/workflows/upload-file-s3.yml
152 endpoint: https://storage.googleapis.com
153 bucket: openwrt-ci-cache
154 download_id: ${{ matrix.target }}-${{ matrix.subtarget }}-ccache-cache
155 filename: ccache-kernel-${{ matrix.target }}-${{ matrix.subtarget }}.tar