CI: tools: reogranize and split workflow
[openwrt/staging/stintel.git] / .github / workflows / tools.yml
1 name: Build host tools
2
3 on:
4 pull_request:
5 paths:
6 - 'tools/**'
7 - '.github/workflows/build-tools.yml'
8 - '.github/workflows/tools.yml'
9 push:
10 paths:
11 - 'tools/**'
12 - '.github/workflows/build-tools.yml'
13 - '.github/workflows/tools.yml'
14
15 permissions:
16 contents: read
17
18 jobs:
19 build-macos-latest:
20 name: Build tools with macos latest
21 runs-on: macos-latest
22
23 steps:
24 - name: Checkout
25 uses: actions/checkout@v3
26 with:
27 path: openwrt
28
29 - name: Setup MacOS
30 run: |
31 echo "WORKPATH=/Volumes/OpenWrt" >> "$GITHUB_ENV"
32 hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage
33 hdiutil attach OpenWrt.sparseimage
34 mv "$GITHUB_WORKSPACE/openwrt" /Volumes/OpenWrt/
35
36 - name: Install required prereq on MacOS
37 working-directory: ${{ env.WORKPATH }}/openwrt
38 run: |
39 brew install \
40 autoconf \
41 automake \
42 coreutils \
43 diffutils \
44 findutils \
45 gawk \
46 gettext \
47 git-extras \
48 gmp \
49 gnu-getopt \
50 gnu-sed \
51 gnu-tar \
52 grep \
53 libidn2 \
54 libunistring \
55 m4 \
56 make \
57 mpfr \
58 ncurses \
59 openssl@1.1 \
60 pcre \
61 pkg-config \
62 quilt \
63 readline \
64 wget \
65 zstd
66
67 echo "/bin" >> "$GITHUB_PATH"
68 echo "/sbin/Library/Apple/usr/bin" >> "$GITHUB_PATH"
69 echo "/usr/bin" >> "$GITHUB_PATH"
70 echo "/usr/local/bin" >> "$GITHUB_PATH"
71 echo "/usr/local/opt/coreutils/bin" >> "$GITHUB_PATH"
72 echo "/usr/local/opt/findutils/libexec/gnubin" >> "$GITHUB_PATH"
73 echo "/usr/local/opt/gettext/bin" >> "$GITHUB_PATH"
74 echo "/usr/local/opt/gnu-getopt/bin" >> "$GITHUB_PATH"
75 echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH"
76 echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH"
77 echo "/usr/sbin" >> "$GITHUB_PATH"
78
79 - name: Make prereq
80 working-directory: ${{ env.WORKPATH }}/openwrt
81 run: make defconfig
82
83 - name: Build tools MacOS
84 working-directory: ${{ env.WORKPATH }}/openwrt
85 run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
86
87 - name: Upload logs
88 if: always()
89 uses: actions/upload-artifact@v3
90 with:
91 name: macos-latest-logs
92 path: ${{ env.WORKPATH }}/openwrt/logs
93
94 - name: Upload config
95 if: always()
96 uses: actions/upload-artifact@v3
97 with:
98 name: macos-latest-config
99 path: ${{ env.WORKPATH }}/openwrt/.config
100
101 build-linux-buildbot:
102 name: Build tools with buildbot container
103 uses: ./.github/workflows/build-tools.yml