CI: migrate each workflow to use reusable workflow from dedicated repo
[openwrt/staging/jow.git] / .github / workflows / build-tools.yml
1 name: Build host tools
2
3 on:
4 workflow_call:
5 inputs:
6 generate_prebuilt_artifacts:
7 type: boolean
8
9 permissions:
10 contents: read
11
12 jobs:
13 build:
14 name: Build tools
15 runs-on: ubuntu-latest
16 container: ghcr.io/openwrt/buildbot/buildworker-v3.8.0:v6
17
18 steps:
19 - name: Checkout
20 uses: actions/checkout@v3
21 with:
22 path: openwrt
23
24 - name: Fix permission
25 run: chown -R buildbot:buildbot openwrt
26
27 - name: Set configs for tools container
28 shell: su buildbot -c "sh -e {0}"
29 working-directory: openwrt
30 run: |
31 touch .config
32 echo CONFIG_DEVEL=y >> .config
33 echo CONFIG_AUTOREMOVE=y >> .config
34 echo CONFIG_CCACHE=y >> .config
35 echo CONFIG_BUILD_ALL_HOST_TOOLS=y >> .config
36
37 - name: Make prereq
38 shell: su buildbot -c "sh -e {0}"
39 working-directory: openwrt
40 run: make defconfig
41
42 - name: Build tools
43 shell: su buildbot -c "sh -e {0}"
44 working-directory: openwrt
45 run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
46
47 - name: Upload logs
48 if: always()
49 uses: actions/upload-artifact@v3
50 with:
51 name: linux-buildbot-logs
52 path: openwrt/logs
53
54 - name: Upload config
55 if: always()
56 uses: actions/upload-artifact@v3
57 with:
58 name: linux-buildbot-config
59 path: openwrt/.config
60
61 - name: Archive prebuilt tools
62 if: inputs.generate_prebuilt_artifacts == true
63 shell: su buildbot -c "sh -e {0}"
64 working-directory: openwrt
65 run: tar -cf tools.tar staging_dir/host build_dir/host
66
67 - name: Upload prebuilt tools
68 if: inputs.generate_prebuilt_artifacts == true
69 uses: actions/upload-artifact@v3
70 with:
71 name: linux-buildbot-prebuilt-tools
72 path: openwrt/tools.tar
73 retention-days: 1