CI: ignore master branch for push events
[openwrt/staging/dangole.git] / .github / workflows / toolchain.yml
1 name: Build Toolchains
2
3 on:
4 pull_request:
5 paths:
6 - '.github/workflows/build.yml'
7 - '.github/workflows/toolchain.yml'
8 - 'toolchain/**'
9 push:
10 paths:
11 - '.github/workflows/build.yml'
12 - '.github/workflows/toolchain.yml'
13 - 'toolchain/**'
14 branches-ignore:
15 - master
16
17 permissions:
18 contents: read
19
20 concurrency:
21 group: ${{ github.workflow }}-${{ github.ref }}
22 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
23
24 jobs:
25 determine_targets:
26 name: Set targets
27 runs-on: ubuntu-latest
28 outputs:
29 target: ${{ steps.find_targets.outputs.target }}
30
31 steps:
32 - name: Checkout
33 uses: actions/checkout@v3
34
35 - name: Set targets
36 id: find_targets
37 run: |
38 export TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null \
39 | sort -u -t '/' -k1,1 \
40 | awk '{ print $1 }')"
41
42 JSON='['
43 FIRST=1
44 for TARGET in $TARGETS; do
45 TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}'
46 [[ $FIRST -ne 1 ]] && JSON="$JSON"','
47 JSON="$JSON""$TUPLE"
48 FIRST=0
49 done
50 JSON="$JSON"']'
51
52 echo -e "\n---- targets ----\n"
53 echo "$JSON"
54 echo -e "\n---- targets ----\n"
55
56 echo "target=$JSON" >> $GITHUB_OUTPUT
57
58 build:
59 name: Build Target Toolchain
60 needs: determine_targets
61 permissions:
62 contents: read
63 packages: read
64 strategy:
65 fail-fast: False
66 matrix:
67 include: ${{fromJson(needs.determine_targets.outputs.target)}}
68 uses: ./.github/workflows/build.yml
69 with:
70 target: ${{ matrix.target }}
71 subtarget: ${{ matrix.subtarget }}
72 build_toolchain: true