|
| 1 | +name: Build |
| 2 | +on: |
| 3 | + schedule: |
| 4 | + - cron: 0 0/6 * * * |
| 5 | + |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + runner_image: |
| 9 | + description: "Runner Image" |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + default: "ubuntu-latest" |
| 13 | + |
| 14 | + debug_with_ssh: |
| 15 | + description: "Debug with SSH" |
| 16 | + type: boolean |
| 17 | + default: false |
| 18 | + |
| 19 | + upload_to_server: |
| 20 | + description: "Upload firmware to file server" |
| 21 | + type: boolean |
| 22 | + default: false |
| 23 | + |
| 24 | + clean_build: |
| 25 | + description: "Skip use cache and clean cache" |
| 26 | + type: boolean |
| 27 | + default: false |
| 28 | + |
| 29 | +jobs: |
| 30 | + lede-x86_64: |
| 31 | + runs-on: ${{ github.event.inputs.runner_image || 'ubuntu-latest' }} |
| 32 | + steps: |
| 33 | + - name: Checkout repo |
| 34 | + uses: actions/checkout@main |
| 35 | + with: |
| 36 | + fetch-depth: 0 |
| 37 | + |
| 38 | + - name: Prepare Environment and Save Build Configs |
| 39 | + env: |
| 40 | + DEBIAN_FRONTEND: noninteractive |
| 41 | + run: | |
| 42 | + bash prenv.sh |
| 43 | + cp lede/x86_64 /tmp/.config |
| 44 | +
|
| 45 | + - name: Checkout repo |
| 46 | + uses: actions/checkout@main |
| 47 | + with: |
| 48 | + repository: coolsnowwolf/lede |
| 49 | + fetch-depth: 0 |
| 50 | + ref: master |
| 51 | + |
| 52 | + - name: Cache |
| 53 | + uses: stupidloud/cachewrtbuild@main |
| 54 | + with: |
| 55 | + ccache: true |
| 56 | + mixkey: "lede_x86_64" |
| 57 | + skip: ${{ ! github.event.inputs.clean_build || true }} |
| 58 | + clean: ${{ github.event.inputs.clean_build || false }} |
| 59 | + |
| 60 | + - name: Download and Load custom configuration |
| 61 | + run: | |
| 62 | + echo -e 'CONFIG_DEVEL=y\nCONFIG_CCACHE=y' >> .config |
| 63 | + ./scripts/feeds update -a && ./scripts/feeds install -a |
| 64 | + cp /tmp/.config .config |
| 65 | + make defconfig clean |
| 66 | +
|
| 67 | + - name: Try to Build When Multi-core compile failure will be rollback to Single core compile |
| 68 | + run: | |
| 69 | + echo "Will be use $(nproc) thread compile" |
| 70 | + sudo df -h |
| 71 | + make -j$(nproc) || make -j1 V=99 |
| 72 | + sudo df -h |
| 73 | +
|
| 74 | + - name: Prepare Image Artifact |
| 75 | + if: success() |
| 76 | + run: | |
| 77 | + mkdir -p images |
| 78 | + cp -r bin/targets/*/*/*.gz images/ |
| 79 | + cp -r bin/targets/*/*/sha256sums images/ |
| 80 | +
|
| 81 | + - name: Upload Artifact Images |
| 82 | + if: success() |
| 83 | + uses: actions/upload-artifact@main |
| 84 | + with: |
| 85 | + compression-level: 9 |
| 86 | + include-hidden-files: true |
| 87 | + name: lede-x86_64-images |
| 88 | + path: images |
| 89 | + |
| 90 | + - name: Prepare Packages Artifact |
| 91 | + if: success() |
| 92 | + run: | |
| 93 | + mkdir -p pkgs |
| 94 | + cp -r bin/targets/*/*/packages/* pkgs/ |
| 95 | +
|
| 96 | + - name: Upload Artifact Packages |
| 97 | + if: success() |
| 98 | + uses: actions/upload-artifact@main |
| 99 | + with: |
| 100 | + name: lede-x86_64-packages |
| 101 | + path: pkgs |
| 102 | + |
| 103 | + - name: Upload firmware to Download Station |
| 104 | + if: ${{ github.event.inputs.upload_to_server || false }} && success() |
| 105 | + run: | |
| 106 | + cd bin/targets/*/* |
| 107 | + zip -r -o -q -9 file.zip . -i *.gz |
| 108 | + [[ -f file.zip ]] && curl -F "token=${{ secrets.UPLOAD_TOKEN }}" -F "location=Router/lede/x86_64" -F "file=@file.zip" ${{ secrets.MAIN_UPLOAD_PROCESSOR }} |
| 109 | +
|
| 110 | + openwrt-x86_64: |
| 111 | + runs-on: ${{ github.event.inputs.runner_image || 'ubuntu-latest' }} |
| 112 | + steps: |
| 113 | + - name: Checkout repo |
| 114 | + uses: actions/checkout@main |
| 115 | + with: |
| 116 | + fetch-depth: 0 |
| 117 | + |
| 118 | + - name: Prepare Environment and Save Build Configs |
| 119 | + env: |
| 120 | + DEBIAN_FRONTEND: noninteractive |
| 121 | + run: | |
| 122 | + bash prenv.sh |
| 123 | + cp openwrt/x86_64 /tmp/.config |
| 124 | +
|
| 125 | + - name: Checkout repo |
| 126 | + uses: actions/checkout@main |
| 127 | + with: |
| 128 | + repository: openwrt/openwrt |
| 129 | + fetch-depth: 0 |
| 130 | + ref: main |
| 131 | + |
| 132 | + - name: Cache |
| 133 | + uses: stupidloud/cachewrtbuild@main |
| 134 | + with: |
| 135 | + ccache: true |
| 136 | + mixkey: "openwrt_x86_64" |
| 137 | + skip: ${{ ! github.event.inputs.clean_build || true }} |
| 138 | + clean: ${{ github.event.inputs.clean_build || false }} |
| 139 | + |
| 140 | + - name: Download and Load custom configuration |
| 141 | + run: | |
| 142 | + echo -e 'CONFIG_DEVEL=y\nCONFIG_CCACHE=y' >> .config |
| 143 | + rm -rf package/helloworld |
| 144 | + git clone --depth=1 https://github.com/fw876/helloworld.git package/helloworld |
| 145 | + ./scripts/feeds update -a && ./scripts/feeds install -a |
| 146 | + cp /tmp/.config .config |
| 147 | + make defconfig clean |
| 148 | +
|
| 149 | + - name: Try to Build When Multi-core compile failure will be rollback to Single core compile |
| 150 | + run: | |
| 151 | + echo "Will be use $(nproc) thread compile" |
| 152 | + sudo df -h |
| 153 | + make -j$(nproc) || make -j1 V=99 |
| 154 | + sudo df -h |
| 155 | +
|
| 156 | + - name: Prepare Image Artifact |
| 157 | + if: success() |
| 158 | + run: | |
| 159 | + mkdir -p images |
| 160 | + cp -r bin/targets/*/*/*.gz images/ |
| 161 | + cp -r bin/targets/*/*/sha256sums images/ |
| 162 | +
|
| 163 | + - name: Upload Artifact Images |
| 164 | + if: success() |
| 165 | + uses: actions/upload-artifact@main |
| 166 | + with: |
| 167 | + compression-level: 9 |
| 168 | + include-hidden-files: true |
| 169 | + name: openwrt_x86_64-images |
| 170 | + path: images |
| 171 | + |
| 172 | + - name: Prepare Packages Artifact |
| 173 | + if: success() |
| 174 | + run: | |
| 175 | + mkdir -p pkgs |
| 176 | + cp -r bin/targets/*/*/packages pkgs/ |
| 177 | +
|
| 178 | + - name: Upload Artifact Packages |
| 179 | + if: success() |
| 180 | + uses: actions/upload-artifact@main |
| 181 | + with: |
| 182 | + name: openwrt_x86_64-packages |
| 183 | + path: pkgs |
| 184 | + |
| 185 | + - name: Upload firmware to Download Station |
| 186 | + if: ${{ github.event.inputs.upload_to_server || false }} && success() |
| 187 | + run: | |
| 188 | + cd bin/targets/*/* |
| 189 | + zip -r -o -q -9 file.zip . -i *.gz |
| 190 | + [[ -f file.zip ]] && curl -F "token=${{ secrets.UPLOAD_TOKEN }}" -F "location=Router/openwrt/x86_64" -F "file=@file.zip" ${{ secrets.MAIN_UPLOAD_PROCESSOR }} |
| 191 | +
|
| 192 | + immortalwrt-x86_64: |
| 193 | + runs-on: ${{ github.event.inputs.runner_image || 'ubuntu-latest' }} |
| 194 | + steps: |
| 195 | + - name: Checkout repo |
| 196 | + uses: actions/checkout@main |
| 197 | + with: |
| 198 | + fetch-depth: 0 |
| 199 | + |
| 200 | + - name: Prepare Environment and Save Build Configs |
| 201 | + env: |
| 202 | + DEBIAN_FRONTEND: noninteractive |
| 203 | + run: | |
| 204 | + bash prenv.sh |
| 205 | + cp immortalwrt/x86_64 /tmp/.config |
| 206 | +
|
| 207 | + - name: Checkout repo |
| 208 | + uses: actions/checkout@main |
| 209 | + with: |
| 210 | + repository: immortalwrt/immortalwrt |
| 211 | + fetch-depth: 0 |
| 212 | + ref: master |
| 213 | + |
| 214 | + - name: Cache |
| 215 | + uses: stupidloud/cachewrtbuild@main |
| 216 | + with: |
| 217 | + ccache: true |
| 218 | + mixkey: "immortalwrt_x86_64" |
| 219 | + skip: ${{ ! github.event.inputs.clean_build || true }} |
| 220 | + clean: ${{ github.event.inputs.clean_build || false }} |
| 221 | + |
| 222 | + - name: Download and Load custom configuration |
| 223 | + run: | |
| 224 | + echo -e 'CONFIG_DEVEL=y\nCONFIG_CCACHE=y' >> .config |
| 225 | + rm -rf package/helloworld |
| 226 | + git clone --depth=1 https://github.com/fw876/helloworld.git package/helloworld |
| 227 | + ./scripts/feeds update -a && ./scripts/feeds install -a |
| 228 | + cp /tmp/.config .config |
| 229 | + make defconfig clean |
| 230 | +
|
| 231 | + - name: Try to Build When Multi-core compile failure will be rollback to Single core compile |
| 232 | + run: | |
| 233 | + echo "Will be use $(nproc) thread compile" |
| 234 | + sudo df -h |
| 235 | + make -j$(nproc) || make -j1 V=99 |
| 236 | + sudo df -h |
| 237 | +
|
| 238 | + - name: Prepare Image Artifact |
| 239 | + if: success() |
| 240 | + run: | |
| 241 | + mkdir -p images |
| 242 | + cp -r bin/targets/*/*/*.gz images/ |
| 243 | + cp -r bin/targets/*/*/sha256sums images/ |
| 244 | +
|
| 245 | + - name: Upload Artifact Images |
| 246 | + if: success() |
| 247 | + uses: actions/upload-artifact@main |
| 248 | + with: |
| 249 | + compression-level: 9 |
| 250 | + include-hidden-files: true |
| 251 | + name: immortalwrt_x86_64-images |
| 252 | + path: images |
| 253 | + |
| 254 | + - name: Prepare Packages Artifact |
| 255 | + if: success() |
| 256 | + run: | |
| 257 | + mkdir -p pkgs |
| 258 | + cp -r bin/targets/*/*/packages pkgs/ |
| 259 | +
|
| 260 | + - name: Upload Artifact Packages |
| 261 | + if: success() |
| 262 | + uses: actions/upload-artifact@main |
| 263 | + with: |
| 264 | + name: immortalwrt_x86_64-packages |
| 265 | + path: pkgs |
| 266 | + |
| 267 | + - name: Upload firmware to Download Station |
| 268 | + if: ${{ github.event.inputs.upload_to_server || false }} && success() |
| 269 | + run: | |
| 270 | + cd bin/targets/*/* |
| 271 | + zip -r -o -q -9 file.zip . -i *.gz |
| 272 | + [[ -f file.zip ]] && curl -F "token=${{ secrets.UPLOAD_TOKEN }}" -F "location=Router/immortalwrt/x86_64" -F "file=@file.zip" ${{ secrets.MAIN_UPLOAD_PROCESSOR }} |
| 273 | +
|
| 274 | + immortalwrt-rm2100: |
| 275 | + runs-on: ${{ github.event.inputs.runner_image || 'ubuntu-latest' }} |
| 276 | + steps: |
| 277 | + - name: Checkout repo |
| 278 | + uses: actions/checkout@main |
| 279 | + with: |
| 280 | + fetch-depth: 0 |
| 281 | + |
| 282 | + - name: Prepare Environment and Save Build Configs |
| 283 | + env: |
| 284 | + DEBIAN_FRONTEND: noninteractive |
| 285 | + run: | |
| 286 | + bash prenv.sh |
| 287 | + cp immortalwrt/rm2100 /tmp/.config |
| 288 | +
|
| 289 | + - name: Checkout repo |
| 290 | + uses: actions/checkout@main |
| 291 | + with: |
| 292 | + repository: immortalwrt/immortalwrt |
| 293 | + fetch-depth: 0 |
| 294 | + ref: master |
| 295 | + |
| 296 | + - name: Cache |
| 297 | + uses: stupidloud/cachewrtbuild@main |
| 298 | + with: |
| 299 | + ccache: true |
| 300 | + mixkey: "immortalwrt_rm2100" |
| 301 | + skip: ${{ ! github.event.inputs.clean_build || true }} |
| 302 | + clean: ${{ github.event.inputs.clean_build || false }} |
| 303 | + |
| 304 | + - name: Download and Load custom configuration |
| 305 | + run: | |
| 306 | + echo -e 'CONFIG_DEVEL=y\nCONFIG_CCACHE=y' >> .config |
| 307 | + ./scripts/feeds update -a && ./scripts/feeds install -a |
| 308 | + cp /tmp/.config .config |
| 309 | + make defconfig clean |
| 310 | +
|
| 311 | + - name: Try to Build When Multi-core compile failure will be rollback to Single core compile |
| 312 | + run: | |
| 313 | + echo "Will be use $(nproc) thread compile" |
| 314 | + sudo df -h |
| 315 | + make -j$(nproc) || make -j1 V=99 |
| 316 | + sudo df -h |
| 317 | +
|
| 318 | + - name: Prepare Image Artifact |
| 319 | + if: success() |
| 320 | + run: | |
| 321 | + mkdir -p images |
| 322 | + cp -r bin/targets/*/*/*.bin images/ |
| 323 | + cp -r bin/targets/*/*/sha256sums images/ |
| 324 | +
|
| 325 | + - name: Upload Artifact Images |
| 326 | + if: success() |
| 327 | + uses: actions/upload-artifact@main |
| 328 | + with: |
| 329 | + compression-level: 9 |
| 330 | + include-hidden-files: true |
| 331 | + name: immortalwrt_ramips_mt7621-images |
| 332 | + path: images |
| 333 | + |
| 334 | + - name: Prepare Packages Artifact |
| 335 | + if: success() |
| 336 | + run: | |
| 337 | + mkdir -p pkgs |
| 338 | + cp -r bin/targets/*/*/packages pkgs/ |
| 339 | +
|
| 340 | + - name: Upload Artifact Packages |
| 341 | + if: success() |
| 342 | + uses: actions/upload-artifact@main |
| 343 | + with: |
| 344 | + name: immortalwrt_ramips_mt7621-packages |
| 345 | + path: pkgs |
| 346 | + |
| 347 | + - name: Upload firmware to Download Station |
| 348 | + if: ${{ github.event.inputs.upload_to_server || false }} && success() |
| 349 | + run: | |
| 350 | + cd bin/targets/*/* |
| 351 | + zip -r -o -q -9 file.zip . -i *.gz |
| 352 | + [[ -f file.zip ]] && curl -F "token=${{ secrets.UPLOAD_TOKEN }}" -F "location=Router/immortalwrt/RM2100" -F "file=@file.zip" ${{ secrets.MAIN_UPLOAD_PROCESSOR }} |
0 commit comments