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