|
| 1 | +name: Build Bootloaders |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + branch: |
| 7 | + description: 'Branch to build from' |
| 8 | + default: 'main' |
| 9 | + type: string |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: Build ${{ matrix.defconfig }} |
| 14 | + runs-on: ubuntu-latest |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + defconfig: |
| 19 | + - fireant_boot |
| 20 | + - cn9130_crb_boot |
| 21 | + - aarch64_qemu_boot |
| 22 | + - rpi4_boot |
| 23 | + env: |
| 24 | + MAKEFLAGS: -j5 |
| 25 | + steps: |
| 26 | + - name: Cleanup Build Folder |
| 27 | + run: | |
| 28 | + ls -la ./ |
| 29 | + rm -rf ./* || true |
| 30 | + rm -rf ./.??* || true |
| 31 | + ls -la ./ |
| 32 | +
|
| 33 | + - name: Checkout infix repo |
| 34 | + uses: actions/checkout@v4 |
| 35 | + with: |
| 36 | + ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.ref }} |
| 37 | + clean: true |
| 38 | + fetch-depth: 0 |
| 39 | + submodules: recursive |
| 40 | + |
| 41 | + - name: Set Build Variables |
| 42 | + id: vars |
| 43 | + run: | |
| 44 | + defconfig=${{ matrix.defconfig }} |
| 45 | + version=$(awk -F'"' '/BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE=/ {print $2}' configs/${defconfig}_defconfig) |
| 46 | + version=${version:-git} |
| 47 | + filename=$(echo "${defconfig}" | tr '_' '-') |
| 48 | +
|
| 49 | + # TODO: Replace hardcoded rev with actual revision stepping |
| 50 | + rev="latest" |
| 51 | +
|
| 52 | + archive="${filename}-${version}-${rev}.tar.gz" |
| 53 | + dirname="${filename}-${version}-${rev}" |
| 54 | +
|
| 55 | + echo "defconfig=${defconfig}" >> $GITHUB_OUTPUT |
| 56 | + echo "version=${version}" >> $GITHUB_OUTPUT |
| 57 | + echo "rev=${rev}" >> $GITHUB_OUTPUT |
| 58 | + echo "archive=${archive}" >> $GITHUB_OUTPUT |
| 59 | + echo "dirname=${dirname}" >> $GITHUB_OUTPUT |
| 60 | +
|
| 61 | + echo "Building ${defconfig}_defconfig, version ${version}-${rev}, artifact ${archive} ..." |
| 62 | +
|
| 63 | + - name: Restore Cache of dl/ |
| 64 | + uses: actions/cache@v4 |
| 65 | + with: |
| 66 | + path: dl/ |
| 67 | + key: dl-boot-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }} |
| 68 | + restore-keys: | |
| 69 | + dl-boot- |
| 70 | + dl- |
| 71 | +
|
| 72 | + - name: Restore Cache of .ccache/ |
| 73 | + uses: actions/cache@v4 |
| 74 | + with: |
| 75 | + path: .ccache/ |
| 76 | + key: ccache-boot-${{ matrix.defconfig }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }} |
| 77 | + restore-keys: | |
| 78 | + ccache-boot-${{ matrix.defconfig }}- |
| 79 | + ccache-boot- |
| 80 | + ccache- |
| 81 | +
|
| 82 | + - name: Configure ${{ matrix.defconfig }}_defconfig |
| 83 | + run: | |
| 84 | + make ${{ matrix.defconfig }}_defconfig |
| 85 | +
|
| 86 | + - name: Build ${{ matrix.defconfig }}_defconfig |
| 87 | + run: | |
| 88 | + echo "Building ${{ matrix.defconfig }}_defconfig ..." |
| 89 | + make -j$((`getconf _NPROCESSORS_ONLN` / 2 + 2)) |
| 90 | +
|
| 91 | + - name: Resulting size of build |
| 92 | + run: | |
| 93 | + printf "Size of output/images/: " |
| 94 | + ls -l output/images/ |
| 95 | +
|
| 96 | + - name: Prepare ${{ matrix.defconfig }} Artifact |
| 97 | + run: | |
| 98 | + cd output/ |
| 99 | + mv images ${{ steps.vars.outputs.dirname }} |
| 100 | + tar cfz ${{ steps.vars.outputs.archive }} ${{ steps.vars.outputs.dirname }}/ |
| 101 | +
|
| 102 | + - uses: actions/upload-artifact@v4 |
| 103 | + with: |
| 104 | + path: output/${{ steps.vars.outputs.archive }} |
| 105 | + name: artifact-${{ matrix.defconfig }} |
| 106 | + |
| 107 | + publish: |
| 108 | + name: Upload Bootloader Artifacts |
| 109 | + runs-on: ubuntu-latest |
| 110 | + needs: build |
| 111 | + permissions: |
| 112 | + contents: write |
| 113 | + steps: |
| 114 | + - uses: actions/download-artifact@v4 |
| 115 | + with: |
| 116 | + pattern: "artifact-*" |
| 117 | + merge-multiple: true |
| 118 | + |
| 119 | + - name: Create checksums ... |
| 120 | + run: | |
| 121 | + for file in *.tar.gz; do |
| 122 | + sha256sum $file > $file.sha256 |
| 123 | + done |
| 124 | +
|
| 125 | + - uses: ncipollo/release-action@v1 |
| 126 | + with: |
| 127 | + allowUpdates: true |
| 128 | + omitName: true |
| 129 | + omitBody: true |
| 130 | + omitBodyDuringUpdate: true |
| 131 | + prerelease: true |
| 132 | + tag: "latest-boot" |
| 133 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 134 | + artifacts: "*.tar.gz*" |
| 135 | + |
| 136 | + - name: Summary |
| 137 | + run: | |
| 138 | + cat <<EOF >> $GITHUB_STEP_SUMMARY |
| 139 | + # Bootloader Build Complete! :rocket: |
| 140 | +
|
| 141 | + For the public download links of these bootloader artifacts, please see: |
| 142 | + <https://github.com/kernelkit/infix/releases/tag/latest-boot> |
| 143 | + EOF |
0 commit comments