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
58 if echo "$CHANGED_FILES" | grep -v -q target/linux ||
59 echo "$CHANGED_FILES" | grep -q target/linux/generic; then
60 TARGETS_SUBTARGETS=$TARGETS
63 JSON_TARGETS_SUBTARGETS='['
65 for TARGET in $TARGETS_SUBTARGETS; do
66 if echo "$CHANGED_FILES" | grep -v -q target/linux ||
67 echo "$CHANGED_FILES" | grep -q target/linux/generic ||
68 echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then
69 TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}'
70 [[ $FIRST -ne 1 ]] && JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"','
71 JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS""$TUPLE"
75 JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"']'
79 for TARGET in $TARGETS; do
80 if echo "$CHANGED_FILES" | grep -v -q target/linux ||
81 echo "$CHANGED_FILES" | grep -q target/linux/generic ||
82 echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then
83 TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}'
84 [[ $FIRST -ne 1 ]] && JSON_TARGETS="$JSON_TARGETS"','
85 JSON_TARGETS="$JSON_TARGETS""$TUPLE"
89 JSON_TARGETS="$JSON_TARGETS"']'
91 echo -e "\n---- targets to build ----\n"
92 echo "$JSON_TARGETS_SUBTARGETS"
93 echo -e "\n---- targets to build ----\n"
95 echo -e "\n---- targets to check patch ----\n"
97 echo -e "\n---- targets to check patch ----\n"
99 echo "targets_subtargets=$JSON_TARGETS_SUBTARGETS" >> $GITHUB_OUTPUT
100 echo "targets=$JSON_TARGETS" >> $GITHUB_OUTPUT
103 name: Build Kernel with external toolchain
104 needs: determine_targets
112 include: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}}
113 uses: ./.github/workflows/build.yml
115 container_name: toolchain
116 target: ${{ matrix.target }}
117 subtarget: ${{ matrix.subtarget }}
119 build_all_kmods: true
120 upload_ccache_cache: ${{ github.repository_owner == 'openwrt' }}
122 check-kernel-patches:
123 name: Check Kernel patches
124 needs: determine_targets
131 include: ${{fromJson(needs.determine_targets.outputs.targets)}}
132 uses: ./.github/workflows/check-kernel-patches.yml
134 target: ${{ matrix.target }}
135 subtarget: ${{ matrix.subtarget }}
137 upload-ccache-cache-in-s3:
138 if: github.event_name == 'push' && github.repository_owner == 'openwrt'
139 name: Upload ccache cache to s3
140 needs: [determine_targets, build]
144 include: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}}
146 s3_access_key: ${{ secrets.GCS_S3_ACCESS_KEY }}
147 s3_secret_key: ${{ secrets.GCS_S3_SECRET_KEY }}
148 uses: ./.github/workflows/upload-file-s3.yml
150 endpoint: https://storage.googleapis.com
151 bucket: openwrt-ci-cache
152 download_id: ${{ matrix.target }}-${{ matrix.subtarget }}-ccache-cache
153 filename: ccache-kernel-${{ matrix.target }}-${{ matrix.subtarget }}.tar