7 - '.github/workflows/tools.yml'
11 - '.github/workflows/tools.yml'
18 if: github.event_name != 'push'
23 uses: actions/checkout@v3
29 echo "WORKPATH=/Volumes/OpenWrt" >> "$GITHUB_ENV"
30 hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage
31 hdiutil attach OpenWrt.sparseimage
32 mv "$GITHUB_WORKSPACE/openwrt" /Volumes/OpenWrt/
34 - name: Install required prereq on MacOS
35 working-directory: ${{ env.WORKPATH }}/openwrt
50 echo "/bin" >> "$GITHUB_PATH"
51 echo "/sbin/Library/Apple/usr/bin" >> "$GITHUB_PATH"
52 echo "/usr/bin" >> "$GITHUB_PATH"
53 echo "/opt/homebrew/bin" >> "$GITHUB_PATH"
54 echo "/opt/homebrew/opt/coreutils/bin" >> "$GITHUB_PATH"
55 echo "/opt/homebrew/opt/findutils/libexec/gnubin" >> "$GITHUB_PATH"
56 echo "/opt/homebrew/opt/gnu-getopt/bin" >> "$GITHUB_PATH"
57 echo "/opt/homebrew/opt/make/libexec/gnubin" >> "$GITHUB_PATH"
58 echo "/usr/sbin" >> "$GITHUB_PATH"
61 working-directory: ${{ env.WORKPATH }}/openwrt
64 - name: Build tools MacOS
65 working-directory: ${{ env.WORKPATH }}/openwrt
66 run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
70 uses: actions/upload-artifact@v3
72 name: macos-latest-logs
73 path: ${{ env.WORKPATH }}/openwrt/logs
77 uses: actions/upload-artifact@v3
79 name: macos-latest-config
80 path: ${{ env.WORKPATH }}/openwrt/.config
83 runs-on: ubuntu-latest
84 container: registry.gitlab.com/openwrt/buildbot/buildworker-3.4.1
88 uses: actions/checkout@v3
92 - name: Fix permission
94 chown -R buildbot:buildbot openwrt
96 - name: Set configs for tools container
97 if: github.event_name == 'push'
98 shell: su buildbot -c "sh -e {0}"
99 working-directory: openwrt
102 echo CONFIG_DEVEL=y >> .config
103 echo CONFIG_AUTOREMOVE=y >> .config
104 echo CONFIG_CCACHE=y >> .config
107 shell: su buildbot -c "sh -e {0}"
108 working-directory: openwrt
111 - name: Build tools BuildBot Container
112 shell: su buildbot -c "sh -e {0}"
113 working-directory: openwrt
114 run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
118 uses: actions/upload-artifact@v3
120 name: linux-buildbot-logs
123 - name: Upload config
125 uses: actions/upload-artifact@v3
127 name: linux-buildbot-config
128 path: openwrt/.config
130 - name: Archive prebuilt tools
131 if: github.event_name == 'push'
132 shell: su buildbot -c "sh -e {0}"
133 working-directory: openwrt
134 run: tar --mtime=now -cf tools.tar staging_dir/host build_dir/host dl
136 - name: Upload prebuilt tools
137 if: github.event_name == 'push'
138 uses: actions/upload-artifact@v3
140 name: linux-buildbot-prebuilt-tools
141 path: openwrt/tools.tar
144 push-tools-container:
145 needs: build-linux-buildbot
146 runs-on: ubuntu-latest
147 if: github.event_name == 'push'
154 - name: Set lower case owner name
156 OWNER: ${{ github.repository_owner }}
158 echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV"
160 # Per branch tools container tag
161 # By default stick to latest
162 # For official test targetting openwrt stable branch
163 # Get the branch or parse the tag and push dedicated tools containers
164 # Any branch that will match this pattern openwrt-[0-9][0-9].[0-9][0-9]
165 # will refresh the tools container with the matching tag.
166 # (example branch openwrt-22.03 -> tools:openwrt-22.03)
167 # (example branch openwrt-22.03-test -> tools:openwrt-22.03)
168 - name: Determine tools container tag
172 if [ ${{ github.ref_type }} == "branch" ]; then
173 if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then
174 CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\).*/\1/')"
176 elif [ ${{ github.ref_type }} == "tag" ]; then
177 if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then
178 CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
182 echo "Tools container to push tools:$CONTAINER_TAG"
183 echo "CONTAINER_TAG=$CONTAINER_TAG" >> "$GITHUB_ENV"
186 uses: actions/checkout@v3
190 - name: Download prebuilt tools from build job
191 uses: actions/download-artifact@v3
193 name: linux-buildbot-prebuilt-tools
196 - name: Login to GitHub Container Registry
197 uses: docker/login-action@v2
200 username: ${{ github.actor }}
201 password: ${{ secrets.GITHUB_TOKEN }}
203 - name: Build and push
204 uses: docker/build-push-action@v3
208 tags: ghcr.io/${{ env.OWNER_LC }}/tools:${{ env.CONTAINER_TAG }}
209 file: openwrt/.github/workflows/Dockerfile.tools