|
30 | 30 | description: "Languages list" |
31 | 31 | type: string |
32 | 32 | default: '[""]' |
| 33 | + strip: |
| 34 | + description: "Options to build unstripped, stripped or both, must be one of 'unstripped', 'stripped', 'both'" |
| 35 | + type: string |
| 36 | + default: 'unstripped' |
33 | 37 | report: |
34 | 38 | description: "Generate build report" |
35 | 39 | type: boolean |
@@ -69,10 +73,23 @@ jobs: |
69 | 73 | echo "C model list: ${{ inputs.cmodel }}" |
70 | 74 | echo "Report: ${{ inputs.report }}" |
71 | 75 | echo "Languages list: ${{ inputs.languages }}" |
| 76 | + echo "Strip: ${{ inputs.strip }}" |
72 | 77 | echo "Simulator: ${{ inputs.sim }}" |
73 | 78 |
|
| 79 | + validate_inputs: |
| 80 | + name: Validate inputs |
| 81 | + runs-on: ubuntu-latest |
| 82 | + steps: |
| 83 | + - name: Check strip input |
| 84 | + run: | |
| 85 | + if [[ "${{ inputs.strip }}" != "unstripped" && "${{ inputs.strip }}" != "stripped" && "${{ inputs.strip }}" != "both" ]]; then |
| 86 | + echo "Invalid strip option: ${{ inputs.strip }}. Must be one of 'unstripped', 'stripped', 'both'." |
| 87 | + exit 1 |
| 88 | + fi |
| 89 | +
|
74 | 90 | submodule_cache: |
75 | 91 | name: Initialize submodule cache |
| 92 | + needs: [validate_inputs] |
76 | 93 | runs-on: ubuntu-latest |
77 | 94 | outputs: |
78 | 95 | key: ${{ steps.keygen.outputs.smcache_key }} |
@@ -104,7 +121,7 @@ jobs: |
104 | 121 |
|
105 | 122 | build: |
106 | 123 | runs-on: ${{ matrix.os }} |
107 | | - needs: [submodule_cache] |
| 124 | + needs: [submodule_cache,validate_inputs] |
108 | 125 | env: |
109 | 126 | smcache_key: ${{ needs.submodule_cache.outputs.key }} |
110 | 127 | strategy: |
@@ -158,17 +175,13 @@ jobs: |
158 | 175 | if [ -n "${{ matrix.languages }}" ]; then |
159 | 176 | ARGS="$ARGS --enable-languages=${{ matrix.languages }}" |
160 | 177 | fi |
| 178 | + if [ "${{ matrix.strip }}" = "true" ]; then |
| 179 | + ARGS="$ARGS --enable-strip" |
| 180 | + fi |
161 | 181 | $BUILD_TOOLCHAIN $ARGS |
162 | 182 | sudo mkdir /mnt/riscv |
163 | 183 | sudo chown runner:runner /mnt/riscv |
164 | 184 | make -j $(nproc) ${{ matrix.mode }} |
165 | | -
|
166 | | - - name: tarball build |
167 | | - run: | |
168 | | - du -s -h /mnt/riscv |
169 | | - ./.github/dedup-dir.sh /mnt/riscv/ |
170 | | - XZ_OPT="-e -T0" tar cJvf riscv.tar.xz -C /mnt/ riscv/ |
171 | | -
|
172 | 185 | - name: make report |
173 | 186 | if: | |
174 | 187 | matrix.os == 'ubuntu-24.04' |
@@ -196,12 +209,32 @@ jobs: |
196 | 209 | if [ -n "$ARTIFACT_NAME" ]; then |
197 | 210 | ARTIFACT_NAME="-${ARTIFACT_NAME}" |
198 | 211 | fi |
199 | | - echo "TOOLCHAIN_NAME=riscv$BITS-$MODE-${{ matrix.os }}-${{ matrix.compiler }}${ARTIFACT_NAME}" >> $GITHUB_OUTPUT |
200 | | -
|
201 | | - - name: Move output to representative name |
| 212 | + BASE_NAME="riscv$BITS-$MODE-${{ matrix.os }}-${{ matrix.compiler }}" |
| 213 | + echo "TOOLCHAIN_NAME=${BASE_NAME}${ARTIFACT_NAME}" >> $GITHUB_OUTPUT |
| 214 | + echo "TOOLCHAIN_NAME_STRIPPED=${BASE_NAME}-stripped${ARTIFACT_NAME}" >> $GITHUB_OUTPUT |
| 215 | + - name: tarball build unstripped |
| 216 | + if: ${{ inputs.strip == 'unstripped' || inputs.strip == 'both' }} |
202 | 217 | run: | |
| 218 | + du -s -h /mnt/riscv |
| 219 | + ./.github/dedup-dir.sh /mnt/riscv/ |
| 220 | + XZ_OPT="-e -T0" tar cJvf riscv.tar.xz -C /mnt/ riscv/ |
203 | 221 | mv riscv.tar.xz ${{ steps.toolchain-name-generator.outputs.TOOLCHAIN_NAME }}.tar.xz |
| 222 | + - name: strip binaries |
| 223 | + run: | |
| 224 | + find /mnt/riscv -type f -exec strip {} \; |
| 225 | + - name: tarball build stripped |
| 226 | + if: ${{ inputs.strip == 'stripped' || inputs.strip == 'both' }} |
| 227 | + run: | |
| 228 | + du -s -h /mnt/riscv |
| 229 | + XZ_OPT="-e -T0" tar cJvf riscv-stripped.tar.xz -C /mnt/ riscv/ |
| 230 | + mv riscv-stripped.tar.xz ${{ steps.toolchain-name-generator.outputs.TOOLCHAIN_NAME_STRIPPED }}.tar.xz |
204 | 231 | - uses: actions/upload-artifact@v4 |
| 232 | + if: ${{ inputs.strip == 'unstripped' || inputs.strip == 'both' }} |
205 | 233 | with: |
206 | 234 | name: ${{ steps.toolchain-name-generator.outputs.TOOLCHAIN_NAME }} |
207 | 235 | path: ${{ steps.toolchain-name-generator.outputs.TOOLCHAIN_NAME }}.tar.xz |
| 236 | + - uses: actions/upload-artifact@v4 |
| 237 | + if: ${{ inputs.strip == 'stripped' || inputs.strip == 'both' }} |
| 238 | + with: |
| 239 | + name: ${{ steps.toolchain-name-generator.outputs.TOOLCHAIN_NAME_STRIPPED }} |
| 240 | + path: ${{ steps.toolchain-name-generator.outputs.TOOLCHAIN_NAME_STRIPPED }}.tar.xz |
0 commit comments