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
65 echo "/bin" >> "$GITHUB_PATH"
66 echo "/sbin/Library/Apple/usr/bin" >> "$GITHUB_PATH"
67 echo "/usr/bin" >> "$GITHUB_PATH"
68 echo "/usr/local/bin" >> "$GITHUB_PATH"
69 echo "/usr/local/opt/coreutils/bin" >> "$GITHUB_PATH"
70 echo "/usr/local/opt/findutils/libexec/gnubin" >> "$GITHUB_PATH"
71 echo "/usr/local/opt/gettext/bin" >> "$GITHUB_PATH"
72 echo "/usr/local/opt/gnu-getopt/bin" >> "$GITHUB_PATH"
73 echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH"
74 echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH"
75 echo "/usr/sbin" >> "$GITHUB_PATH"
78 working-directory: ${{ env.WORKPATH }}/openwrt
81 - name: Build tools MacOS
82 working-directory: ${{ env.WORKPATH }}/openwrt
83 run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
87 uses: actions/upload-artifact@v3
89 name: macos-latest-logs
90 path: ${{ env.WORKPATH }}/openwrt/logs
94 uses: actions/upload-artifact@v3
96 name: macos-latest-config
97 path: ${{ env.WORKPATH }}/openwrt/.config
100 runs-on: ubuntu-latest
101 container: registry.gitlab.com/openwrt/buildbot/buildworker-3.4.1
105 uses: actions/checkout@v3
109 - name: Fix permission
111 chown -R buildbot:buildbot openwrt
113 - name: Set configs for tools container
114 if: github.event_name == 'push'
115 shell: su buildbot -c "sh -e {0}"
116 working-directory: openwrt
119 echo CONFIG_DEVEL=y >> .config
120 echo CONFIG_AUTOREMOVE=y >> .config
121 echo CONFIG_CCACHE=y >> .config
124 shell: su buildbot -c "sh -e {0}"
125 working-directory: openwrt
128 - name: Build tools BuildBot Container
129 shell: su buildbot -c "sh -e {0}"
130 working-directory: openwrt
131 run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
135 uses: actions/upload-artifact@v3
137 name: linux-buildbot-logs
140 - name: Upload config
142 uses: actions/upload-artifact@v3
144 name: linux-buildbot-config
145 path: openwrt/.config
147 - name: Archive prebuilt tools
148 if: github.event_name == 'push'
149 shell: su buildbot -c "sh -e {0}"
150 working-directory: openwrt
151 run: tar --mtime=now -cf tools.tar staging_dir/host build_dir/host dl
153 - name: Upload prebuilt tools
154 if: github.event_name == 'push'
155 uses: actions/upload-artifact@v3
157 name: linux-buildbot-prebuilt-tools
158 path: openwrt/tools.tar
161 push-tools-container:
162 needs: build-linux-buildbot
163 runs-on: ubuntu-latest
164 if: github.event_name == 'push'
171 - name: Set lower case owner name
173 OWNER: ${{ github.repository_owner }}
175 echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV"
177 # Per branch tools container tag
178 # By default stick to latest
179 # For official test targetting openwrt stable branch
180 # Get the branch or parse the tag and push dedicated tools containers
181 # Any branch that will match this pattern openwrt-[0-9][0-9].[0-9][0-9]
182 # will refresh the tools container with the matching tag.
183 # (example branch openwrt-22.03 -> tools:openwrt-22.03)
184 # (example branch openwrt-22.03-test -> tools:openwrt-22.03)
185 - name: Determine tools container tag
189 if [ ${{ github.ref_type }} == "branch" ]; then
190 if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then
191 CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\).*/\1/')"
193 elif [ ${{ github.ref_type }} == "tag" ]; then
194 if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then
195 CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
199 echo "Tools container to push tools:$CONTAINER_TAG"
200 echo "CONTAINER_TAG=$CONTAINER_TAG" >> "$GITHUB_ENV"
203 uses: actions/checkout@v3
207 - name: Download prebuilt tools from build job
208 uses: actions/download-artifact@v3
210 name: linux-buildbot-prebuilt-tools
213 - name: Login to GitHub Container Registry
214 uses: docker/login-action@v2
217 username: ${{ github.actor }}
218 password: ${{ secrets.GITHUB_TOKEN }}
220 - name: Build and push
221 uses: docker/build-push-action@v3
225 tags: ghcr.io/${{ env.OWNER_LC }}/tools:${{ env.CONTAINER_TAG }}
226 file: openwrt/.github/workflows/Dockerfile.tools